21 #include <type_traits>
24 inline namespace _V1 {
25 namespace ext::oneapi::experimental {
27 class opportunistic_group;
29 namespace this_kernel {
30 #ifdef __SYCL_DEVICE_ONLY__
31 [[__sycl_detail__::__uses_aspects__(
32 sycl::aspect::ext_oneapi_opportunistic_group)]]
47 #ifdef __SYCL_DEVICE_ONLY__
50 throw runtime_error(
"Non-uniform groups are not supported on host device.",
51 PI_ERROR_INVALID_DEVICE);
56 #ifdef __SYCL_DEVICE_ONLY__
57 return sycl::detail::CallerPositionInMask(
Mask);
59 throw runtime_error(
"Non-uniform groups are not supported on host device.",
60 PI_ERROR_INVALID_DEVICE);
65 #ifdef __SYCL_DEVICE_ONLY__
68 throw runtime_error(
"Non-uniform groups are not supported on host device.",
69 PI_ERROR_INVALID_DEVICE);
74 #ifdef __SYCL_DEVICE_ONLY__
77 throw runtime_error(
"Non-uniform groups are not supported on host device.",
78 PI_ERROR_INVALID_DEVICE);
83 #ifdef __SYCL_DEVICE_ONLY__
86 throw runtime_error(
"Non-uniform groups are not supported on host device.",
87 PI_ERROR_INVALID_DEVICE);
92 #ifdef __SYCL_DEVICE_ONLY__
95 throw runtime_error(
"Non-uniform groups are not supported on host device.",
96 PI_ERROR_INVALID_DEVICE);
101 #ifdef __SYCL_DEVICE_ONLY__
104 throw runtime_error(
"Non-uniform groups are not supported on host device.",
105 PI_ERROR_INVALID_DEVICE);
110 #ifdef __SYCL_DEVICE_ONLY__
113 throw runtime_error(
"Non-uniform groups are not supported on host device.",
114 PI_ERROR_INVALID_DEVICE);
119 #ifdef __SYCL_DEVICE_ONLY__
120 uint32_t Lowest =
static_cast<uint32_t
>(
Mask.
find_low()[0]);
121 return __spirv_SubgroupLocalInvocationId() == Lowest;
123 throw runtime_error(
"Non-uniform groups are not supported on host device.",
124 PI_ERROR_INVALID_DEVICE);
139 namespace this_kernel {
142 #ifdef __SYCL_DEVICE_ONLY__
143 #if defined(__SPIR__) || defined(__SPIRV__)
145 sycl::sub_group sg = sycl::ext::oneapi::experimental::this_sub_group();
148 #elif defined(__NVPTX__)
149 uint32_t active_mask;
150 asm volatile(
"activemask.b32 %0;" :
"=r"(active_mask));
152 sycl::detail::Builder::createSubGroupMask<ext::oneapi::sub_group_mask>(
157 throw runtime_error(
"Non-uniform groups are not supported on host device.",
158 PI_ERROR_INVALID_DEVICE);
170 struct is_group<ext::oneapi::experimental::opportunistic_group>
static constexpr sycl::memory_scope fence_scope
id_type get_local_id() const
static constexpr int dimensions
linear_id_type get_group_linear_id() const
linear_id_type get_local_linear_range() const
range_type get_local_range() const
linear_id_type get_group_linear_range() const
range_type get_group_range() const
id_type get_group_id() const
opportunistic_group(sub_group_mask m)
linear_id_type get_local_linear_id() const
opportunistic_group get_opportunistic_group()
std::enable_if_t< std::is_same_v< std::decay_t< Group >, sub_group >||std::is_same_v< std::decay_t< Group >, sycl::sub_group >, sub_group_mask > group_ballot(Group g, bool predicate=true)