[UR] Fix nd_range with zero global_size on native CPU - #23032
Conversation
There was a problem hiding this comment.
Pull request overview
Adds native CPU support for zero-sized kernel launches while preserving event dependencies and profiling.
Changes:
- Returns a no-op event for zero-sized launches.
- Relocates the timing-event helper for reuse.
- Enables the zero-range SYCL end-to-end test on native CPU.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
unified-runtime/source/adapters/native_cpu/enqueue.cpp |
Handles zero-sized native CPU launches. |
sycl/test-e2e/Basic/parallel_for_zero_range.cpp |
Removes the native CPU expected failure. |
Suppressed comments (1)
unified-runtime/source/adapters/native_cpu/enqueue.cpp:164
- This early return bypasses the only
_localArgInfo.clear()in the launch path.urEnqueueKernelLaunchWithArgsExphas already appended each local argument before calling here, so every empty launch leaves stale entries on the kernel; later launches duplicate those entries and makeupdateMemPool()allocate progressively more local memory. Clear this per-launch state before returning the no-op event.
return withTimingEvent(UR_COMMAND_KERNEL_LAUNCH, hQueue,
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
https://github.com/intel/llvm/actions/runs/32877207965/job/97904975140?pr=23032 Looks like |
| if (pGlobalWorkSize[0] == 0 || (workDim > 1 && pGlobalWorkSize[1] == 0) || | ||
| (workDim > 2 && pGlobalWorkSize[2] == 0)) { | ||
| return withTimingEvent(UR_COMMAND_KERNEL_LAUNCH, hQueue, | ||
| numEventsInWaitList, phEventWaitList, phEvent, | ||
| []() { return UR_RESULT_SUCCESS; }); |
|
@dyniols would you be applying the Copilot comments? |
I will take a look at them. Not sure about this one #23032 (comment) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
unified-runtime/source/adapters/native_cpu/enqueue.cpp:164
- This adapter path conflicts with the UR contract and is bypassed when parameter validation is enabled:
scripts/core/exp-enqueue-kernel-launch-with-args.yml:153-156defines any zero global dimension asUR_RESULT_ERROR_INVALID_WORK_DIMENSION, andsource/loader/layers/validation/ur_valddi.cpp:6107-6109enforces it before dispatch. The reported SYCL case will therefore still fail under UR validation and behavior will depend on whether that layer is enabled. Please update the UR specification/generated validation together with this adapter change, or handle the zero range above the UR API boundary.
if (pGlobalWorkSize[0] == 0 || (workDim > 1 && pGlobalWorkSize[1] == 0) ||
(workDim > 2 && pGlobalWorkSize[2] == 0)) {
| return withTimingEvent(UR_COMMAND_KERNEL_LAUNCH, hQueue, | ||
| numEventsInWaitList, phEventWaitList, phEvent, | ||
| []() { return UR_RESULT_SUCCESS; }); |
This PR fixes
CMPLRLLVM-77780and it's related to #22893