Skip to content

Commit dbc52d3

Browse files
committed
Add implementation notes to range_type proposal
Signed-off-by: John Pennycook <[email protected]>
1 parent 81fda8c commit dbc52d3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_range_type.asciidoc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,31 @@ option, all kernels and `SYCL_EXTERNAL` functions without an explicitly
181181
specified `range_type` property are compiled as-if `range_type<int>` was
182182
specified as a property of that kernel or function.
183183

184+
185+
== Implementation notes
186+
187+
This non-normative section provides information about one possible
188+
implementation of this extension.
189+
It is not part of the specification of the extension's API.
190+
191+
There are several ways this extension could be implemented:
192+
193+
- A dedicated LLVM-IR pass could recognize functions that compute an ID (e.g.,
194+
`nd_item::get_global_id`), check whether the static call tree comes from a
195+
kernel or function decorated with `range_type`, and then conditionally insert
196+
an equivalent of `__builtin_assume`.
197+
198+
- The existing `__builtin_assume` intrinsic in `__SYCL_ASSUME_INT` could be
199+
replaced by a new (but similar) SPIR-V intrinsic, shifting range-type
200+
optimizations to the device compiler.
201+
This could take the form of a dedicated `__spirv_AssumeInRange` intrinsic,
202+
or a general `__spirv_Assume` intrinsic coupled with a `__spirv_MaxRange`
203+
value.
204+
205+
Ideally, the solution should not generate SPIR-V modules that require new
206+
extensions if `range_type` is not used.
207+
208+
184209
== Issues
185210

186211
None.

0 commit comments

Comments
 (0)