@@ -182,7 +182,8 @@ inline constexpr use_root_sync_key::value_t use_root_sync;
182
182
=== The `root_group` class
183
183
184
184
The `root_group` class implements all member functions common to the
185
- `sycl::group` and `sycl::sub_group` classes.
185
+ `sycl::group` and `sycl::sub_group` classes and also contains own
186
+ additional functions.
186
187
187
188
[source,c++]
188
189
----
@@ -191,6 +192,13 @@ namespace ext {
191
192
namespace oneapi {
192
193
namespace experimental {
193
194
195
+ enum class execution_scope {
196
+ work_item,
197
+ sub_group,
198
+ work_group,
199
+ root_group,
200
+ };
201
+
194
202
template <int Dimensions>
195
203
class root_group {
196
204
public:
@@ -221,6 +229,31 @@ public:
221
229
222
230
bool leader() const;
223
231
232
+ template <execution_scope Scope>
233
+ std::enable_if_t<(Scope == execution_scope::work_item ||
234
+ Scope == execution_scope::work_group),
235
+ id<Dimensions>>
236
+ get_id() const;
237
+
238
+ template <execution_scope Scope>
239
+ std::enable_if_t<Scope == execution_scope::sub_group, id<1>> get_id() const;
240
+
241
+ template <execution_scope Scope>
242
+ size_t get_linear_id() const;
243
+
244
+ template <execution_scope Scope>
245
+ std::enable_if_t<(Scope == execution_scope::work_item ||
246
+ Scope == execution_scope::work_group),
247
+ range<Dimensions>>
248
+ get_range() const;
249
+
250
+ template <execution_scope Scope>
251
+ std::enable_if_t<Scope == execution_scope::sub_group, range<1>>
252
+ get_range() const;
253
+
254
+ template <execution_scope Scope>
255
+ size_t get_linear_range() const;
256
+
224
257
};
225
258
226
259
} // namespace experimental
@@ -307,6 +340,67 @@ work-item is the leader of the root-group, and `false` for all other work-items
307
340
in the root-group. The leader of the root-group is guaranteed to be the
308
341
work-item for which `get_local_id()` returns 0.
309
342
343
+ [source,c++]
344
+ ----
345
+ template <execution_scope Scope>
346
+ std::enable_if_t<(Scope == execution_scope::work_item ||
347
+ Scope == execution_scope::work_group),
348
+ id<Dimensions>>
349
+ get_id() const;
350
+ ----
351
+ _Returns_: An `id` representing the index of the current work-group or work-item at `Scope`
352
+ hierarchy level within the `root_group` object.
353
+
354
+ [source,c++]
355
+ ----
356
+ template <execution_scope Scope>
357
+ std::enable_if_t<Scope == execution_scope::sub_group, id<1>> get_id() const;
358
+ ----
359
+ _Returns_: An `id` representing the index of the current sub-group within the
360
+ `root_group` object.
361
+
362
+ [source,c++]
363
+ ----
364
+ template <execution_scope Scope>
365
+ size_t get_linear_id() const;
366
+ ----
367
+ _Constraints_: `Scope` must be narrower than
368
+ `execution_scope::root_group`.
369
+
370
+ _Returns_: A linearized number of the current work-group or work-item at `Scope` hierarchy
371
+ level within the `root_group` object.
372
+
373
+ [source,c++]
374
+ ----
375
+ template <execution_scope Scope>
376
+ std::enable_if_t<(Scope == execution_scope::work_item ||
377
+ Scope == execution_scope::work_group),
378
+ range<Dimensions>>
379
+ get_range() const;
380
+ ----
381
+ _Returns_: A `range` representing the number of work-groups or work-items of `Scope`
382
+ hierarchy level within the `root_group` object.
383
+
384
+ [source,c++]
385
+ ----
386
+ template <execution_scope Scope>
387
+ std::enable_if_t<Scope == execution_scope::sub_group, range<1>>
388
+ get_range() const;
389
+ ----
390
+ _Returns_: A `range` representing the number of sub-groups within the `root_group`
391
+ object.
392
+
393
+ [source,c++]
394
+ ----
395
+ template <execution_scope Scope>
396
+ size_t get_linear_range() const;
397
+ ----
398
+ _Constraints_: `Scope` must be narrower than
399
+ `execution_scope::root_group`.
400
+
401
+ _Returns_: The number of work-groups or work-items of `Scope` hierarchy level within the
402
+ `root_group` object.
403
+
310
404
311
405
=== Using a `root_group`
312
406
0 commit comments