You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed in #4831, we should officially deprecate the original reduction extension in favor of the equivalent SYCL 2020 reduction functionality. This PR only makes the changes to the documentation -- adding deprecation notices to the implementation will be done in a separate PR.
Copy file name to clipboardExpand all lines: sycl/doc/extensions/Reduction/Reduction.md
+25-1Lines changed: 25 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# SYCL(TM) Proposals: Reductions for ND-Range Parallelism
2
2
3
-
**IMPORTANT**: This specification is a draft.
3
+
**IMPORTANT**: The functionality introduced by this extension is deprecated in favor of the standard reduction functionality outlined in [Section 4.9.2 "Reduction variables"](https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:reduction) of the SYCL 2020 Specification, Revision 3.
4
4
5
5
**NOTE**: Khronos(R) is a registered trademark and SYCL(TM) is a trademark of the Khronos Group, Inc.
6
6
@@ -17,6 +17,9 @@ It should also be noted that reductions are not limited to scalar values: the be
17
17
# `reduction` Objects
18
18
19
19
```c++
20
+
namespacesycl {
21
+
namespace ext {
22
+
namespace oneapi {
20
23
template <class T, class BinaryOperation>
21
24
unspecified reduction(accessor<T>& var, BinaryOperation combiner);
22
25
@@ -34,12 +37,18 @@ unspecified reduction(span<T, Extent> var, BinaryOperation combiner);
34
37
35
38
template <class T, class Extent, class BinaryOperation>
36
39
unspecified reduction(span<T, Extent> var, const T& identity, BinaryOperation combiner);
40
+
}
41
+
}
42
+
}
37
43
```
38
44
39
45
The exact behavior of a reduction is specific to an implementation; the only interface exposed to the user is the set of functions above, which construct an unspecified `reduction` object encapsulating the reduction variable, an optional operator identity and the reduction operator. For user-defined binary operations, an implementation should issue a compile-time warning if an identity is not specified and this is known to negatively impact performance (e.g. as a result of the implementation choosing a different reduction algorithm). For standard binary operations (e.g. `std::plus`) on arithmetic types, the implementation must determine the correct identity automatically in order to avoid performance penalties.
40
46
41
47
If an implementation can identify the identity value for a given combination of accumulator type `AccumulatorT` and function object type `BinaryOperation`, the value is defined as a member of the `known_identity` trait class:
The dimensionality of the `accessor` passed to the `reduction` function specifies the dimensionality of the reduction variable: a 0-dimensional `accessor` represents a scalar reduction, and any other dimensionality represents an array reduction. Specifying an array reduction of size N is functionally equivalent to specifying N independent scalar reductions. The access mode of the accessor determines whether the reduction variable's original value is included in the reduction (i.e. for `access::mode::read_write` it is included, and for `access::mode::discard_write` it is not). Multiple reductions aliasing the same output results in undefined behavior.
@@ -70,6 +88,9 @@ The dimensionality of the `accessor` passed to the `reduction` function specifie
70
88
# `reducer` Objects
71
89
72
90
```c++
91
+
namespace sycl {
92
+
namespace ext {
93
+
namespace oneapi {
73
94
// Exposition only
74
95
template <class T, class BinaryOperation, int Dimensions, /* implementation-defined */>
75
96
class reducer
@@ -91,6 +112,9 @@ class reducer
91
112
92
113
// other operators should be made available for standard functors
The `reducer` class is not user-constructible, and can only be constructed by an implementation given a `reduction` object. The `combine` function uses the specified `BinaryOperation` to combine the `partial` result with the value held (or referenced) by an instance of `reducer`, and is the only way to update the reducer value for user-supplied combination functions. Other convenience operators should be defined for standard combination functions (e.g. `+=` for `std::plus`).
0 commit comments