Skip to content

GPU on Intel: launches on GPU-resident arrays do not wait (4.6x for small launches) - #1110

Open
ASDAlexander77 wants to merge 1 commit into
mainfrom
gpu-ze-async
Open

ASDAlexander77 wants to merge 1 commit into
mainfrom
gpu-ze-async

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

On Intel, a launch whose arrays all stay on the GPU (GpuArrays, or arrays inside gpuBatch) no longer waits for its kernel, as on CUDA and HIP. Small launches get 4.6x faster.

What changes

Before, Level Zero's immediate command list was synchronous, so every Intel launch blocked until its kernel finished. The list is now asynchronous, with these changes in GpuRuntime.c:

  • A barrier after each launch. A Level Zero list may run its commands in any order unless told otherwise. The barrier makes whatever comes after a kernel wait for it, as on a CUDA or HIP stream: another kernel on the same arrays, or a copy back.
  • Freeing waits for the list. Unlike cuMemFree and hipFree, zeMemFree does not wait for a kernel still using the memory. Without the wait, a GpuArray collected right after an un-waited launch would be freed while its kernel ran.
  • Copies are unchanged. They still wait for the list.

docs/gpu.md no longer says that Intel launches always wait, and it gives the Intel timing below.

Measured

2000 small launches on GpuArrays, on the integrated GPU of a Core Ultra 9 285K:

Launch Time
Waiting after each (as before) 63 ms
Not waiting (now) 13 ms

Tests

  • Intel: all 26 GPU programs pass, under the JIT and as executables, and so do the 11 fault cases.
  • NVIDIA and AMD: not rerun. Only the Level Zero driver code changed.

This branch is cut from main and is independent of #1109.

🤖 Generated with Claude Code

…DA and HIP (4.6x for small launches)

Level Zero's immediate command list was synchronous, so every Intel launch waited for its kernel, where CUDA and
HIP queue a launch whose arrays all stay on the GPU (GpuArrays, gpuBatch) and wait where its results are needed.
The list is now asynchronous:

- each launch is followed by a barrier, as the list runs its commands in any order unless told: what comes after
  a kernel (another kernel on its arrays, a copy back) waits for it, as on a stream;
- a free waits for the list first: zeMemFree does not wait for a kernel still on the memory (cuMemFree and
  hipFree do), and a GpuArray collected after a launch not waited for would be freed under it;
- copies still wait for the list, as before.

2000 small launches on GpuArrays (Core Ultra 9 285K's iGPU): 13 ms, against 63 ms waiting after each.
All 26 GPU programs (JIT and exe) and the 11 fault cases pass on Intel. docs/gpu.md says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant