Skip to content

Commit a3a5e4f

Browse files
committed
[SYCL][Doc] Remove overloads for kernel properties
This commit removes the parallel_for and single_task overloads from the sycl_ext_oneapi_kernel_properties extension. The sycl_ext_oneapi_enqueue_functions extension provides an alternative interface for passing kernel properties that is more aligned with our expected long-term direction: specifically, it separates run-time launch properties from compile-time properties which affect kernel compilation, and it introduces new concepts to avoid the need for extra arguments. Signed-off-by: John Pennycook <[email protected]>
1 parent 3c2c938 commit a3a5e4f

File tree

1 file changed

+4
-142
lines changed

1 file changed

+4
-142
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_kernel_properties.asciidoc

+4-142
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
== Notice
2222

2323
[%hardbreaks]
24-
Copyright (C) 2021 Intel Corporation. All rights reserved.
24+
Copyright (C) 2024 Intel Corporation. All rights reserved.
2525

2626
Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks
2727
of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by
@@ -232,141 +232,12 @@ SYCL implementations may introduce additional kernel properties. If any
232232
combinations of kernel attributes are invalid, this must be clearly documented
233233
as part of the new kernel property definition.
234234

235-
=== Adding a Property List to a Kernel Launch
236-
237-
To enable properties to be associated with kernels, this extension adds
238-
new overloads to each of the variants of `single_task`, `parallel_for` and
239-
`parallel_for_work_group` defined in the `queue` and `handler` classes. These
240-
new overloads accept a `sycl::ext::oneapi::experimental::properties` argument. For
241-
variants accepting a parameter pack, the `sycl::ext::oneapi::experimental::properties`
242-
argument is inserted immediately prior to the parameter pack; for variants not
243-
accepting a parameter pack, the `sycl::ext::oneapi::experimental::properties` argument is
244-
inserted immediately prior to the kernel function.
245-
246-
The overloads introduced by this extension are listed below:
247-
```c++
248-
namespace sycl {
249-
class queue {
250-
public:
251-
template <typename KernelName, typename KernelType, typename PropertyList>
252-
event single_task(PropertyList properties, const KernelType &kernelFunc);
253-
254-
template <typename KernelName, typename KernelType, typename PropertyList>
255-
event single_task(event depEvent, PropertyList properties,
256-
const KernelType &kernelFunc);
257-
258-
template <typename KernelName, typename KernelType, typename PropertyList>
259-
event single_task(const std::vector<event> &depEvents,
260-
PropertyList properties,
261-
const KernelType &kernelFunc);
262-
263-
template <typename KernelName, int Dims, typename PropertyList, typename... Rest>
264-
event parallel_for(range<Dims> numWorkItems,
265-
Rest&&... rest);
266-
267-
template <typename KernelName, int Dims, typename PropertyList, typename... Rest>
268-
event parallel_for(range<Dims> numWorkItems, event depEvent,
269-
PropertyList properties,
270-
Rest&&... rest);
271-
272-
template <typename KernelName, int Dims, typename PropertyList, typename... Rest>
273-
event parallel_for(range<Dims> numWorkItems,
274-
const std::vector<event> &depEvents,
275-
PropertyList properties,
276-
Rest&&... rest);
277-
278-
template <typename KernelName, int Dims, typename PropertyList, typename... Rest>
279-
event parallel_for(nd_range<Dims> executionRange,
280-
PropertyList properties,
281-
Rest&&... rest);
282-
283-
template <typename KernelName, int Dims, typename PropertyList, typename... Rest>
284-
event parallel_for(nd_range<Dims> executionRange,
285-
event depEvent,
286-
PropertyList properties,
287-
Rest&&... rest);
288-
289-
template <typename KernelName, int Dims, typename PropertyList, typename... Rest>
290-
event parallel_for(nd_range<Dims> executionRange,
291-
const std::vector<event> &depEvents,
292-
PropertyList properties,
293-
Rest&&... rest);
294-
}
295-
}
296-
297-
namespace sycl {
298-
class handler {
299-
public:
300-
template <typename KernelName, typename KernelType, typename PropertyList>
301-
void single_task(PropertyList properties, const KernelType &kernelFunc);
302-
303-
template <typename KernelName, int dimensions, typename PropertyList, typename... Rest>
304-
void parallel_for(range<dimensions> numWorkItems,
305-
PropertyList properties,
306-
Rest&&... rest);
307-
308-
template <typename KernelName, int dimensions, typename PropertyList, typename... Rest>
309-
void parallel_for(nd_range<dimensions> executionRange,
310-
PropertyList properties,
311-
Rest&&... rest);
312-
313-
template <typename KernelName, typename WorkgroupFunctionType, int dimensions, typename PropertyList>
314-
void parallel_for_work_group(range<dimensions> numWorkGroups,
315-
PropertyList properties,
316-
const WorkgroupFunctionType &kernelFunc);
317-
318-
template <typename KernelName, typename WorkgroupFunctionType, int dimensions, typename PropertyList>
319-
void parallel_for_work_group(range<dimensions> numWorkGroups,
320-
range<dimensions> workGroupSize,
321-
PropertyList properties,
322-
const WorkgroupFunctionType &kernelFunc);
323-
}
324-
}
325-
```
326-
327-
Passing a property list as an argument in this way allows properties to be
328-
associated with a kernel function without modifying its type. This enables
329-
the same kernel function (e.g. a lambda) to be submitted multiple times with
330-
different properties, or for libraries building on SYCL to add properties
331-
(e.g. for performance reasons) to user-provided kernel functions.
332-
333-
All the properties defined in this extension have compile-time values. However,
334-
an implementation may support additional properties which could have run-time
335-
values. When this occurs, the `properties` parameter may be a property list
336-
containing a mix of both run-time and compile-time values, and a SYCL
337-
implementation should respect both run-time and compile-time information when
338-
determining the correct way to launch a kernel. However, only compile-time
339-
information can modify the compilation of the kernel function itself.
340-
341-
A simple example of using this extension to set a required work-group size
342-
and required sub-group size is given below:
343-
344-
```c++
345-
sycl::ext::oneapi::experimental::properties properties{sycl::ext::oneapi::experimental::work_group_size<8, 8>,
346-
sycl::ext::oneapi::experimental::sub_group_size<8>};
347-
q.parallel_for(range<2>{16, 16}, properties, [=](id<2> i) {
348-
a[i] = b[i] + c[i];
349-
}).wait();
350-
```
351-
352-
NOTE: It is currently not possible to use the same kernel function in two
353-
commands with different properties. For example, the following will result in an
354-
error at compile-time:
355-
356-
```c++
357-
auto kernelFunc = [=](){};
358-
q.single_task(kernelFunc);
359-
q.single_task(
360-
sycl::ext::oneapi::experimental::properties{
361-
sycl::ext::oneapi::experimental::sub_group_size<8>},
362-
kernelFunc);
363-
```
364235

365236
== Embedding Properties into a Kernel
366237

367-
In other situations it may be useful to embed a kernel's properties directly
368-
into its type, to ensure that a kernel cannot be launched without a property
369-
that it depends upon for correctness.
238+
Compile-time kernel properties can be embedded directly into its type, to
239+
ensure that a kernel cannot be launched without a property that it depends upon
240+
for correctness.
370241

371242
To enable this use-case, this extension adds a mechanism for implementations to
372243
extract a property list from a kernel functor, if a kernel functor declares
@@ -429,15 +300,6 @@ struct KernelFunctor {
429300
q.parallel_for(range<2>{16, 16}, KernelFunctor(a, b, c)).wait();
430301
```
431302

432-
If a kernel functor with embedded properties is enqueued for execution using an
433-
invocation function with a property list argument, the kernel is launched as-if
434-
the embedded properties and argument were combined. If the combined list
435-
contains any invalid combinations of properties, then this is an error: invalid
436-
combinations that can be detected at compile-time should be reported via a
437-
diagnostic; invalid combinations that can only be detected at run-time should
438-
result in an implementation throwing an `exception` with the `errc::invalid`
439-
error code.
440-
441303
=== Querying Properties in a Compiled Kernel
442304

443305
Any properties embedded into a kernel type via a property list are reflected

0 commit comments

Comments
 (0)