Skip to content

Commit 90f03ee

Browse files
authored
[SYCL][Doc] Fix spec for passing SPIRV struct args (#12338)
SPIR-V modules may not contain a kernel argument of type **OpTypeStruct**. Structures are passed by reference, so the argument type is actually **OpTypePointer**. Also, slightly loosen the requirements for kernel arguments that are pointers. It is technically OK to pass any pointer, though only a USM pointer can be dereferenced in the kernel.
1 parent 650dc77 commit 90f03ee

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_kernel_compiler_spirv.asciidoc

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ The SPIR-V *OpEntryPoint* that defines a kernel has an associated *OpFunction*.
172172
This *OpFunction* is followed by a list of *OpFunctionParameter* instructions,
173173
one for each kernel argument.
174174
The following table defines the set of argument types that are supported by
175-
this extension, and explains how to pass each type of argument from SYCL.
175+
this extension and explains how to pass each type of argument from SYCL.
176176
However, the set of supported argument types may be further limited by the
177177
backend's SPIR-V client API specification.
178178

@@ -198,21 +198,26 @@ of 32, `double` when the *OpTypeFloat* has a width of 64, and `sycl::half` when
198198
the *OpTypeFloat* has a width of 16.
199199
_{endnote}_]
200200

201-
|*OpTypePointer* with storage class *CrossWorkgroup*
202-
|Either a pointer to USM memory or an `accessor` whose target is
203-
`target::device`.
201+
|*OpTypePointer* with _Storage Class_ *CrossWorkgroup*
202+
|Either a {cpp} pointer (typically a pointer to USM memory) or an `accessor`
203+
whose target is `target::device`.
204204

205-
|*OpTypePointer* with storage class *Workgroup*
205+
|*OpTypePointer* with _Storage Class_ *Workgroup*
206206
|A `local_accessor`.
207207

208-
|*OpTypeStruct* whose member types are limited to *OpTypeInt*, *OpTypeFloat*,
209-
and *OpTypePointer* (with storage class *CrossWorkgroup*).
210-
The *OpTypeStruct* may contain members which are also *OpTypeStruct* so long
211-
as its members are limited to the same types.
212-
|A C++ struct or class that is device copyable.
213-
Each member variable must have the corresponding type as defined above,
214-
except that an *OpTypePointer* member must correspond to a USM pointer.
215-
It is not valid to pass an `accessor` for these members.
208+
|*OpTypePointer* with _Storage Class_ *Function* and _Type_ *OpTypeStruct*
209+
(i.e. the pointed-at type is *OpTypeStruct*).
210+
|A C++ struct or class that is device copyable, which has the same size and
211+
data representation as the *OpTypeStruct*.
212+
213+
[_Note:_ The SYCL argument is a structure even though the SPIR-V argument type
214+
is a pointer because structures are passed by reference.
215+
216+
The SYCL argument must not contain any `accessor` or `local_accessor` members
217+
because these types are not device copyable.
218+
If the *OpTypeStruct* contains an *OpTypePointer* member, the corresponding SYCL
219+
structure member is typically a USM pointer.
220+
_{endnote}_]
216221
|===
217222

218223
When data allocated on the host is accessed by the kernel via a pointer, the

0 commit comments

Comments
 (0)