Skip to content

Commit 2801e1e

Browse files
committed
Fix launch query for invalid group sizes
Signed-off-by: Michael Aziz <[email protected]>
1 parent c579870 commit 2801e1e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

sycl/source/detail/kernel_impl.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ kernel_impl::queryMaxNumWorkGroups(queue Queue,
332332
if (auto Result = Adapter->call_nocheck<
333333
UrApiKind::urKernelSuggestMaxCooperativeGroupCountExp>(
334334
Handle, Dimensions, WG, DynamicLocalMemorySize, &GroupCount);
335-
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
336-
// The feature is supported. Check for other errors and throw if any.
335+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE &&
336+
Result != UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE) {
337+
// The feature is supported and the group size is valid. Check for other
338+
// errors and throw if any.
337339
Adapter->checkUrResult(Result);
338340
return GroupCount;
339341
}

sycl/test-e2e/Basic/launch_queries/max_num_work_groups.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,10 @@ int test_max_num_work_groups(sycl::queue &q, const sycl::device &dev) {
161161
// It cannot be possible to launch a kernel successfully with a configuration
162162
// that exceeds the available resources as in the above defined workGroupSize.
163163
// workGroupSize is larger than maxWorkGroupSize, hence maxWGs must equal 0.
164-
// Note: Level-Zero currently always returns a non-zero value.
165-
// TODO: Remove the backend condition once the Level-Zero API issue is fixed.
166-
if (dev.get_backend() != sycl::backend::ext_oneapi_level_zero) {
167-
assert(maxWGs == 0 &&
168-
"max_num_work_groups query failed.\n"
169-
"It should return 0 possible groups when the requested resources "
170-
"by the lanuch config exceed those available in the hardware.");
171-
}
164+
assert(maxWGs == 0 &&
165+
"max_num_work_groups query failed.\n"
166+
"It should return 0 possible groups when the requested resources "
167+
"by the lanuch config exceed those available in the hardware.");
172168

173169
// As we ensured that the 'max_num_work_groups' query correctly
174170
// returns 0 possible work-groups, test that the kernel launch will fail.

0 commit comments

Comments
 (0)