Commit 7fab237
Do not set global offset unless required (#18242)
Previously, zeKernelSetGlobalOffsetExp was called for every kernel
launch. The vast majority of kernels are expected to never have an
offset, because the offset feature was deprecated in SYCL 2020, and we
should optimize for this case.
The SYCL RT currently passes {0, 0, 0} in the case where there is no
offset. To optimize this case:
- A zero offset is treated equivalently to a NULL offset, and
zeKernelSetGlobalOffsetExp is not called.
- A non-zero offset triggers a call to zeKernelSetGlobalOffsetExp before
launching the kernel.
- A non-zero offset triggers a call to zeKernelSetGlobalOffsetExp after
launching the kernel, to reset the offset to zero.
This will introduce additional overhead to the uncommon case where
offsets are specified, but we plan to remove this anyway.
In the long-term, the check for a {0, 0, 0} offset should probably be
moved into the SYCL headers and NULL should be passed directly to UR.
However, this will require wide-reaching changes to other UR adapters
and the UR specification.
---------
Signed-off-by: John Pennycook <john.pennycook@intel.com>1 parent 4c9944a commit 7fab237
3 files changed
Lines changed: 39 additions & 0 deletions
File tree
- source/adapters/level_zero
- helpers
- v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
222 | 232 | | |
223 | 233 | | |
224 | 234 | | |
| |||
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
| 242 | + | |
| 243 | + | |
232 | 244 | | |
233 | 245 | | |
234 | 246 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
809 | 809 | | |
810 | 810 | | |
811 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
812 | 822 | | |
813 | 823 | | |
814 | 824 | | |
| |||
822 | 832 | | |
823 | 833 | | |
824 | 834 | | |
| 835 | + | |
| 836 | + | |
825 | 837 | | |
826 | 838 | | |
827 | 839 | | |
| |||
0 commit comments