Skip to content

Commit

Permalink
[SYCL][DOC] Extend sycl_ext_oneapi_root_group (#12643)
Browse files Browse the repository at this point in the history
Adding new enum "execution_scope" and few member functions

---------

Co-authored-by: John Pennycook <[email protected]>
  • Loading branch information
KornevNikita and Pennycook authored Feb 7, 2024
1 parent 9617939 commit 557df1a
Showing 1 changed file with 95 additions and 1 deletion.
96 changes: 95 additions & 1 deletion sycl/doc/extensions/proposed/sycl_ext_oneapi_root_group.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ inline constexpr use_root_sync_key::value_t use_root_sync;
=== The `root_group` class

The `root_group` class implements all member functions common to the
`sycl::group` and `sycl::sub_group` classes.
`sycl::group` and `sycl::sub_group` classes and also contains own
additional functions.

[source,c++]
----
Expand All @@ -191,6 +192,13 @@ namespace ext {
namespace oneapi {
namespace experimental {
enum class execution_scope {
work_item,
sub_group,
work_group,
root_group,
};
template <int Dimensions>
class root_group {
public:
Expand Down Expand Up @@ -221,6 +229,31 @@ public:
bool leader() const;
template <execution_scope Scope>
std::enable_if_t<(Scope == execution_scope::work_item ||
Scope == execution_scope::work_group),
id<Dimensions>>
get_id() const;
template <execution_scope Scope>
std::enable_if_t<Scope == execution_scope::sub_group, id<1>> get_id() const;
template <execution_scope Scope>
size_t get_linear_id() const;
template <execution_scope Scope>
std::enable_if_t<(Scope == execution_scope::work_item ||
Scope == execution_scope::work_group),
range<Dimensions>>
get_range() const;
template <execution_scope Scope>
std::enable_if_t<Scope == execution_scope::sub_group, range<1>>
get_range() const;
template <execution_scope Scope>
size_t get_linear_range() const;
};
} // namespace experimental
Expand Down Expand Up @@ -307,6 +340,67 @@ work-item is the leader of the root-group, and `false` for all other work-items
in the root-group. The leader of the root-group is guaranteed to be the
work-item for which `get_local_id()` returns 0.

[source,c++]
----
template <execution_scope Scope>
std::enable_if_t<(Scope == execution_scope::work_item ||
Scope == execution_scope::work_group),
id<Dimensions>>
get_id() const;
----
_Returns_: An `id` representing the index of the current work-group or work-item at `Scope`
hierarchy level within the `root_group` object.

[source,c++]
----
template <execution_scope Scope>
std::enable_if_t<Scope == execution_scope::sub_group, id<1>> get_id() const;
----
_Returns_: An `id` representing the index of the current sub-group within the
`root_group` object.

[source,c++]
----
template <execution_scope Scope>
size_t get_linear_id() const;
----
_Constraints_: `Scope` must be narrower than
`execution_scope::root_group`.

_Returns_: A linearized number of the current work-group or work-item at `Scope` hierarchy
level within the `root_group` object.

[source,c++]
----
template <execution_scope Scope>
std::enable_if_t<(Scope == execution_scope::work_item ||
Scope == execution_scope::work_group),
range<Dimensions>>
get_range() const;
----
_Returns_: A `range` representing the number of work-groups or work-items of `Scope`
hierarchy level within the `root_group` object.

[source,c++]
----
template <execution_scope Scope>
std::enable_if_t<Scope == execution_scope::sub_group, range<1>>
get_range() const;
----
_Returns_: A `range` representing the number of sub-groups within the `root_group`
object.

[source,c++]
----
template <execution_scope Scope>
size_t get_linear_range() const;
----
_Constraints_: `Scope` must be narrower than
`execution_scope::root_group`.

_Returns_: The number of work-groups or work-items of `Scope` hierarchy level within the
`root_group` object.


=== Using a `root_group`

Expand Down

0 comments on commit 557df1a

Please sign in to comment.