Skip to content

Commit 091b728

Browse files
jzcsteffenlarsen
authored andcommitted
Don't use 0 for named_sub_group_size value
1 parent e07b316 commit 091b728

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

sycl/include/sycl/ext/oneapi/experimental/named_sub_group_sizes.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ inline namespace _V1 {
1515
namespace ext::oneapi::experimental {
1616

1717
struct named_sub_group_size {
18-
static constexpr uint32_t primary = 0;
19-
static constexpr uint32_t automatic = -1;
18+
static constexpr uint32_t primary = -1;
19+
static constexpr uint32_t automatic = -2;
2020
};
2121

2222
inline constexpr sub_group_size_key::value_t<named_sub_group_size::primary>

sycl/test/extensions/properties/properties_kernel_named_sub_group_size.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ int main() {
2121
q.parallel_for<class Kernel2>(ndr, P2, [=](auto id) {});
2222
}
2323

24-
// CHECK: ![[SGSizeAttr]] = !{i32 0}
24+
// CHECK: ![[SGSizeAttr]] = !{i32 -1}

sycl/test/extensions/properties/properties_kernel_negative.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ void check_sub_group_size() {
301301
// expected-error@+1 {{too few template arguments for variable template 'sub_group_size'}}
302302
auto WGSize0 = sycl::ext::oneapi::experimental::sub_group_size<>;
303303

304+
// expected-error-re@sycl/ext/oneapi/kernel_properties/properties.hpp:* {{static assertion failed due to requirement {{.+}}: sub_group_size_key property must contain a non-zero value.}}
305+
// expected-error@sycl/ext/oneapi/kernel_properties/properties.hpp:* {{constexpr variable 'sub_group_size<0>' must be initialized by a constant expression}}
306+
// expected-note@+1 {{in instantiation of variable template specialization 'sycl::ext::oneapi::experimental::sub_group_size<0>' requested here}}
307+
auto WGSize1 = sycl::ext::oneapi::experimental::sub_group_size<0>;
308+
304309
sycl::queue Q;
305310

306311
// expected-error-re@sycl/ext/oneapi/properties/properties.hpp:* {{static assertion failed due to requirement {{.+}}: Failed to merge property lists due to conflicting properties.}}

0 commit comments

Comments
 (0)