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
Aligns the sub-group implementation with the extension doc:
- Enables reduce and scan to take functors as arguments
- Adds OpenCL-like reduce(x, op) overload to extension doc
Also clarifies interpretation of init values in documentation.
Signed-off-by: John Pennycook <john.pennycook@intel.com>
Copy file name to clipboardExpand all lines: sycl/doc/extensions/SubGroupNDRange/SubGroupNDRange.md
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,9 +143,12 @@ The `plus`, `minimum` and `maximum` functors in the `cl::sycl` namespace corresp
143
143
|Member functions|Description|
144
144
|----------------|-----------|
145
145
|`template <typename T>T broadcast(T x, id<1> local_id) const`| Broadcast the value of `x` from the work-item with the specified id to all work-items within the sub-group. The value of `local_id` must be the same for all work-items in the sub-group. |
146
-
|`template <typename T, class BinaryOp>T reduce(T x, T init, BinaryOp binary_op) const`| Combine the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. |
147
-
|`template <typename T, class BinaryOp>T exclusive_scan(T x, T init, BinaryOp binary_op) const`| Perform an exclusive scan over the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. The value returned on work-item `i` is the exclusive scan of the first `i` work-items in the sub-group. |
148
-
|`template <typename T, class BinaryOp>T inclusive_scan(T x, BinaryOp binary_op, T init) const`| Perform an inclusive scan over the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. The value returned on work-item `i` is the inclusive scan of the first `i` work-items in the sub-group. |
146
+
|`template <typename T, class BinaryOp>T reduce(T x, BinaryOp binary_op) const`| Combine the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. |
147
+
|`template <typename T, class BinaryOp>T reduce(T x, T init, BinaryOp binary_op) const`| Combine the values of `x` from all work-items in the sub-group using an initial value of `init` and the specified operator, which must be one of: `plus`, `minimum` or `maximum`. |
148
+
|`template <typename T, class BinaryOp>T exclusive_scan(T x, BinaryOp binary_op) const`| Perform an exclusive scan over the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. The value returned on work-item `i` is the exclusive scan of the first `i` work-items in the sub-group. The initial value is the identity value of the operator. |
149
+
|`template <typename T, class BinaryOp>T exclusive_scan(T x, T init, BinaryOp binary_op) const`| Perform an exclusive scan over the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. The value returned on work-item `i` is the exclusive scan of the first `i` work-items in the sub-group. The initial value is specified by `init`. |
150
+
|`template <typename T, class BinaryOp>T inclusive_scan(T x, BinaryOp binary_op) const`| Perform an inclusive scan over the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. The value returned on work-item `i` is the inclusive scan of the first `i` work-items in the sub-group. |
151
+
|`template <typename T, class BinaryOp>T inclusive_scan(T x, BinaryOp binary_op, T init) const`| Perform an inclusive scan over the values of `x` from all work-items in the sub-group using the specified operator, which must be one of: `plus`, `minimum` or `maximum`. The value returned on work-item `i` is the inclusive scan of the initial value `init` and the first `i` work-items in the sub-group. |
149
152
150
153
## Extended Functionality
151
154
@@ -214,12 +217,21 @@ struct sub_group {
214
217
template <typename T>
215
218
T broadcast(T x, id<1> local_id) const;
216
219
220
+
template <typename T, class BinaryOp>
221
+
T reduce(T x, BinaryOp binary_op) const;
222
+
217
223
template <typename T, class BinaryOp>
218
224
T reduce(T x, T init, BinaryOp binary_op) const;
219
225
226
+
template <typename T, class BinaryOp>
227
+
T exclusive_scan(T x, BinaryOp binary_op) const;
228
+
220
229
template <typename T, class BinaryOp>
221
230
T exclusive_scan(T x, T init, BinaryOp binary_op) const;
222
231
232
+
template <typename T, class BinaryOp>
233
+
T inclusive_scan(T x, BinaryOp binary_op) const;
234
+
223
235
template <typename T, class BinaryOp>
224
236
T inclusive_scan(T x, BinaryOp binary_op, T init) const;
0 commit comments