@@ -71,7 +71,8 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
71
71
72
72
const size_t maxWorkGroupSize =
73
73
kernel.template get_info <work_group_size>(dev);
74
- const size_t NumWorkItems = maxWorkGroupSize * maxWorkGroupSize;
74
+ // Will try to launch 2 work groups.
75
+ const size_t NumWorkItems = maxWorkGroupSize * 2 ;
75
76
76
77
size_t workGroupSize = 32 ;
77
78
size_t localMemorySizeInBytes{0 };
@@ -100,8 +101,6 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
100
101
// ===================== //
101
102
// We must have at least one active group if we are below resource limits.
102
103
assert (maxWGs > 0 && " max_num_work_groups query failed" );
103
- if (maxWGs == 0 )
104
- return 1 ;
105
104
106
105
// Run the kernel
107
106
auto launch_range = sycl::nd_range<1 >{sycl::range<1 >{NumWorkItems},
@@ -121,7 +120,6 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
121
120
// ========================== //
122
121
// Test 3 - use max resources //
123
122
// ========================== //
124
- // A little over the maximum work-group size for the purpose of exceeding.
125
123
workGroupSize = maxWorkGroupSize;
126
124
workGroupRange[0 ] = workGroupSize;
127
125
size_t localSize =
@@ -133,9 +131,8 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
133
131
syclex::info::kernel_queue_specific::max_num_work_groups>(
134
132
q, workGroupRange, localMemorySizeInBytes);
135
133
134
+ // We must have at least one active group if we are at resource limits.
136
135
assert (maxWGs > 0 && " max_num_work_groups query failed" );
137
- if (maxWGs == 0 )
138
- return 1 ;
139
136
140
137
launch_range = sycl::nd_range<1 >{sycl::range<1 >{NumWorkItems},
141
138
sycl::range<1 >{workGroupSize}};
@@ -155,6 +152,7 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
155
152
// =============================== //
156
153
// Test 4 - exceed resource limits //
157
154
// =============================== //
155
+ // A little over the maximum work-group size for the purpose of exceeding.
158
156
workGroupSize = maxWorkGroupSize + 32 ;
159
157
workGroupRange[0 ] = workGroupSize;
160
158
maxWGs = kernel.template ext_oneapi_get_info <
@@ -163,10 +161,10 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
163
161
// It cannot be possible to launch a kernel successfully with a configuration
164
162
// that exceeds the available resources as in the above defined workGroupSize.
165
163
// workGroupSize is larger than maxWorkGroupSize, hence maxWGs must equal 0.
164
+ // Note: Level-Zero currently always returns a non-zero value. While other
165
+ // backends (i.e., OpenCL, HIP) always return 1 in their implementations.
166
166
if (dev.get_backend () == sycl::backend::ext_oneapi_cuda) {
167
167
assert (maxWGs == 0 && " max_num_work_groups query failed" );
168
- if (maxWGs > 0 )
169
- return 1 ;
170
168
}
171
169
172
170
// As we ensured that the 'max_num_work_groups' query correctly
0 commit comments