Skip to content

Commit

Permalink
Move size next to range in khr_group_interface
Browse files Browse the repository at this point in the history
id() and linear_id() are next to each other in the class definitions, which
helps to make it clear that they are closely related.

Since range() and size() share the same relationship, ensuring they also appear
next to each other improves readability. The same reasoning also applies to
size_type and range_type.
  • Loading branch information
Pennycook committed Dec 5, 2024
1 parent d59ccb9 commit 25b35fe
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions adoc/extensions/sycl_khr_group_interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@ class GroupT {
using id_type = /* ... */;
using linear_id_type = /* ... */;
using range_type = /* ... */;
using size_type = /* ... */;
#if defined(__cpp_lib_mdspan)
using extents_type = /* ... */;
using index_type = typename extents_type::index_type; // exposition only
using rank_type = typename extents_type::rank_type; // exposition only
#endif
using size_type = /* ... */;
static constexpr int dimensions = /* ... */;
static constexpr memory_scope fence_scope = /* ... */;
id_type id() const noexcept;
linear_id_type linear_id() const noexcept;
range_type range() const noexcept;
constexpr size_type size() const noexcept;
#if defined (__cpp_lib_mdspan)
#if defined(__cpp_lib_mdspan)
constexpr extents_type extents() const noexcept;
constexpr index_type extent(rank_type r) const noexcept;
static constexpr rank_type rank() noexcept;
static constexpr rank_type rank_dynamic() noexcept;
static constexpr size_t static_extent(rank_type r) noexcept;
#endif
constexpr size_type size() const noexcept;
};
Expand Down Expand Up @@ -121,6 +121,17 @@ group.

'''

.[apidef]#GroupT::size#
[source,role=synopsis,id=api:common-group-size]
----
constexpr size_type size() const noexcept;
----

_Returns_: The total number of work-items in the group, equal to the product of
the number of work-items in each dimension of the group.

'''

.[apidef]#GroupT::extents#
[source,role=synopsis,id=api:khr-group-interface-common-group-extents]
----
Expand Down Expand Up @@ -173,17 +184,6 @@ _Effects_: Equivalent to [code]#return extents_type::static_extent(r);#.

'''

.[apidef]#GroupT::size#
[source,role=synopsis,id=api:common-group-size]
----
constexpr size_type size() const noexcept;
----

_Returns_: The total number of work-items in the group, equal to the product of
the number of work-items in each dimension of the group.

'''

[[sec:khr-group-interface-common-non-member-funcs]]
==== Non-member functions

Expand Down Expand Up @@ -241,10 +241,10 @@ class work_group {
using id_type = id<Dimensions>;
using linear_id_type = size_t;
using range_type = range<Dimensions>;
using size_type = size_t;
#if defined(__cpp_lib_mdspan)
using extents_type = std::dextents<size_t, Dimensions>;
#endif
using size_type = size_t;
static constexpr int dimensions = Dimensions;
static constexpr memory_scope fence_scope = memory_scope::work_group;
Expand Down Expand Up @@ -306,10 +306,10 @@ class sub_group {
using id_type = id<1>;
using linear_id_type = uint32_t;
using range_type = range<1>;
using size_type = uint32_t;
#if defined(__cpp_lib_mdspan)
using extents_type = std::dextents<uint32_t, 1>;
#endif
using size_type = uint32_t;
static constexpr int dimensions = 1;
static constexpr memory_scope fence_scope = memory_scope::sub_group;
Expand Down Expand Up @@ -393,10 +393,10 @@ class work_item {
using id_type = typename ParentGroup::id_type;
using linear_id_type = typename ParentGroup::linear_id_type;
using range_type = typename ParentGroup::range_type;
using size_type = typename ParentGroup::size_type;
#if defined(__cpp_lib_mdspan)
using extents_type = /* extents of all 1s with ParentGroup's index type */
#endif
using size_type = typename ParentGroup::size_type;
static constexpr int dimensions = ParentGroup::dimensions;
static constexpr memory_scope fence_scope = memory_scope::work_item;
Expand Down

0 comments on commit 25b35fe

Please sign in to comment.