[SYCL][HIP][CUDA] Report errc::nd_range for oversized work-group size#22678
[SYCL][HIP][CUDA] Report errc::nd_range for oversized work-group size#22678zjin-lcf wants to merge 3 commits into
Conversation
handleInvalidWorkGroupSize only produced the expected "Total number of work-items in a work-group cannot exceed ..." diagnostic (errc::nd_range) for OpenCL. On HIP and CUDA the launch was rejected by the driver but the runtime surfaced a generic error, so Basic/gpu_max_wgs_error.cpp failed. Handle the HIP and CUDA backends explicitly and throw the same errc::nd_range exception when the requested work-group size exceeds the device maximum. Re-enables Basic/gpu_max_wgs_error.cpp on HIP. Co-authored-by: Cursor <cursoragent@cursor.com>
…on on HIP This test passes on HIP (gfx942) with the current toolchain, so remove the UNSUPPORTED: hip marker tracked by intel#22300. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR improves SYCL runtime diagnostics for oversized work-group sizes on the CUDA/HIP backends by translating the underlying launch failure into a consistent sycl::errc::nd_range exception (matching the existing OpenCL behavior), and re-enables a previously-disabled HIP regression test.
Changes:
- Add explicit CUDA/HIP handling in
handleInvalidWorkGroupSize()to throwerrc::nd_rangewhenlocal_sizetotal exceedsUR_DEVICE_INFO_MAX_WORK_GROUP_SIZE. - Re-enable
Regression/invalid_reqd_wg_size_correct_exceptionon HIP by removingUNSUPPORTED: hip. - Re-enable
Basic/gpu_max_wgs_erroron HIP by removingUNSUPPORTED: hip.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sycl/test-e2e/Regression/invalid_reqd_wg_size_correct_exception.cpp | Re-enables the regression test on HIP. |
| sycl/test-e2e/Basic/gpu_max_wgs_error.cpp | Re-enables the work-group-size diagnostic test on HIP (still disabled on CUDA). |
| sycl/source/detail/error_handling/error_handling.cpp | Adds CUDA/HIP-specific translation of oversized work-group size failures into errc::nd_range. |
| // REQUIRES: gpu | ||
| // UNSUPPORTED: cuda | ||
|
|
The CUDA backend does report errc::nd_range for an oversized work-group, but for the work-group size this test uses (max_work_item_sizes in every dimension) the CUDA driver rejects the launch as UR_RESULT_ERROR_OUT_OF_RESOURCES (register exhaustion), which is handled by handleOutOfResources() and throws an nd_range exception with a different, register-count message. Verified on an H100 that the "Total number of work-items in a work-group cannot exceed" branch added in handleInvalidWorkGroupSize() is reached (and matches) only when each dimension is within limits but their product exceeds the max work-group size. Add an explanation and tracker so the CUDA exclusion is documented. Co-authored-by: Cursor <cursoragent@cursor.com>
c756be2 to
97a1862
Compare
|
Not sure Copilot can continue the review. Do you recommend the Runtime fix below ? In handleOutOfResources(), inside the existing CUDA branch, check the work-group total against the device max before emitting the register • The driver returns OUT_OF_RESOURCES when registers are exhausted and INVALID_WORK_GROUP_SIZE otherwise, so the "too many work-items" check now needs to live in both handlers. The PR already added it to handleInvalidWorkGroupSize(); this adds the symmetric case. |
Summary
errc::nd_rangeexception when an oversized work-group size is requested on HIP/CUDA, instead of a generic/opaque failure.Regression/invalid_reqd_wg_size_correct_exceptionon HIP.Test plan
Basic/gpu_max_wgs_errorpasses on gfx942Regression/invalid_reqd_wg_size_correct_exceptionpasses on gfx942Relates to #22300