Skip to content

Commit 557df1a

Browse files
[SYCL][DOC] Extend sycl_ext_oneapi_root_group (#12643)
Adding new enum "execution_scope" and few member functions --------- Co-authored-by: John Pennycook <john.pennycook@intel.com>
1 parent 9617939 commit 557df1a

File tree

1 file changed

+95
-1
lines changed

1 file changed

+95
-1
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_root_group.asciidoc

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ inline constexpr use_root_sync_key::value_t use_root_sync;
182182
=== The `root_group` class
183183

184184
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.
186187

187188
[source,c++]
188189
----
@@ -191,6 +192,13 @@ namespace ext {
191192
namespace oneapi {
192193
namespace experimental {
193194
195+
enum class execution_scope {
196+
work_item,
197+
sub_group,
198+
work_group,
199+
root_group,
200+
};
201+
194202
template <int Dimensions>
195203
class root_group {
196204
public:
@@ -221,6 +229,31 @@ public:
221229
222230
bool leader() const;
223231
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+
224257
};
225258
226259
} // namespace experimental
@@ -307,6 +340,67 @@ work-item is the leader of the root-group, and `false` for all other work-items
307340
in the root-group. The leader of the root-group is guaranteed to be the
308341
work-item for which `get_local_id()` returns 0.
309342

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+
310404

311405
=== Using a `root_group`
312406

0 commit comments

Comments
 (0)