22 #include <type_traits>
25 inline namespace _V1 {
26 namespace ext::oneapi::experimental {
28 template <
size_t PartitionSize,
typename ParentGroup>
class fixed_size_group;
30 template <
size_t PartitionSize,
typename Group>
31 #ifdef __SYCL_DEVICE_ONLY__
32 [[__sycl_detail__::__uses_aspects__(sycl::aspect::ext_oneapi_fixed_size_group)]]
34 inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> &&
35 std::is_same_v<Group, sycl::sub_group>,
36 fixed_size_group<PartitionSize, Group>>
48 #ifdef __SYCL_DEVICE_ONLY__
49 return __spirv_SubgroupLocalInvocationId() / PartitionSize;
51 throw runtime_error(
"Non-uniform groups are not supported on host device.",
52 PI_ERROR_INVALID_DEVICE);
57 #ifdef __SYCL_DEVICE_ONLY__
58 return __spirv_SubgroupLocalInvocationId() % PartitionSize;
60 throw runtime_error(
"Non-uniform groups are not supported on host device.",
61 PI_ERROR_INVALID_DEVICE);
66 #ifdef __SYCL_DEVICE_ONLY__
67 return __spirv_SubgroupSize() / PartitionSize;
69 throw runtime_error(
"Non-uniform groups are not supported on host device.",
70 PI_ERROR_INVALID_DEVICE);
75 #ifdef __SYCL_DEVICE_ONLY__
78 throw runtime_error(
"Non-uniform groups are not supported on host device.",
79 PI_ERROR_INVALID_DEVICE);
84 #ifdef __SYCL_DEVICE_ONLY__
87 throw runtime_error(
"Non-uniform groups are not supported on host device.",
88 PI_ERROR_INVALID_DEVICE);
93 #ifdef __SYCL_DEVICE_ONLY__
96 throw runtime_error(
"Non-uniform groups are not supported on host device.",
97 PI_ERROR_INVALID_DEVICE);
102 #ifdef __SYCL_DEVICE_ONLY__
105 throw runtime_error(
"Non-uniform groups are not supported on host device.",
106 PI_ERROR_INVALID_DEVICE);
111 #ifdef __SYCL_DEVICE_ONLY__
114 throw runtime_error(
"Non-uniform groups are not supported on host device.",
115 PI_ERROR_INVALID_DEVICE);
120 #ifdef __SYCL_DEVICE_ONLY__
123 throw runtime_error(
"Non-uniform groups are not supported on host device.",
124 PI_ERROR_INVALID_DEVICE);
129 #if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
133 #if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
140 get_fixed_size_group<PartitionSize, ParentGroup>(ParentGroup g);
143 sycl::detail::GetMask<fixed_size_group<PartitionSize, ParentGroup>>(
147 template <
size_t PartitionSize,
typename Group>
148 inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> &&
149 std::is_same_v<Group, sycl::sub_group>,
153 #ifdef __SYCL_DEVICE_ONLY__
154 #if defined(__NVPTX__)
155 uint32_t loc_id =
group.get_local_linear_id();
156 uint32_t loc_size =
group.get_local_linear_range();
157 uint32_t bits = PartitionSize == 32
159 : ((1 << PartitionSize) - 1)
160 << ((loc_id / PartitionSize) * PartitionSize);
163 sycl::detail::Builder::createSubGroupMask<ext::oneapi::sub_group_mask>(
169 throw runtime_error(
"Non-uniform groups are not supported on host device.",
170 PI_ERROR_INVALID_DEVICE);
174 template <
size_t PartitionSize,
typename ParentGroup>
181 template <
size_t PartitionSize,
typename ParentGroup>
183 ext::oneapi::experimental::fixed_size_group<PartitionSize, ParentGroup>>
187 template <
size_t PartitionSize,
typename ParentGroup>
189 ext::oneapi::experimental::fixed_size_group<PartitionSize, ParentGroup>>
static constexpr sycl::memory_scope fence_scope
linear_id_type get_group_linear_range() const
linear_id_type get_group_linear_id() const
range_type get_local_range() const
linear_id_type get_local_linear_range() const
id_type get_local_id() const
typename ParentGroup::linear_id_type linear_id_type
id_type get_group_id() const
static constexpr int dimensions
linear_id_type get_local_linear_id() const
range_type get_group_range() const
fence_scope
The scope that fence() operation should apply to.
std::enable_if_t< sycl::is_group_v< std::decay_t< Group > > &&std::is_same_v< Group, sycl::sub_group >, fixed_size_group< PartitionSize, Group > > get_fixed_size_group(Group group)