Skip to content

Add a preference to force NEO's direct submission - #793

Open
maleadt wants to merge 1 commit into
mainfrom
tb/direct-submission
Open

maleadt wants to merge 1 commit into
mainfrom
tb/direct-submission

Conversation

@maleadt

@maleadt maleadt commented Dec 3, 2026

Copy link
Copy Markdown
Member

Launching a trivial kernel and synchronizing takes ~56 µs on an Arc A770 with the upstream i915 kernel driver, often twice that (#756). Almost all of that is in the driver: appending a launch to an immediate command list costs ~17 µs of host time, and zeCommandListHostSynchronize ~39 µs (p90 ~110 µs), against ~2 µs that oneAPI.jl adds. NEO submits work with a system call there, because it only uses direct submission (a ring buffer the GPU polls) when the kernel driver has VM_BIND, i.e. with xe or Intel's out-of-tree i915.

NEO's debug keys NEOReadDebugKeys=1 EnableDirectSubmission=1 force it on, with i915 in a variant meant for kernel drivers without VM_BIND, which Intel ships for some integrated GPUs. On the A770 that brings launch+sync to ~12 µs without outliers, also after the host has been idle. It is not free for others, though: to the GPU scheduler a polling ring is a busy context, so every process with one delays the other processes on the GPU by a time slice (1 ms with i915's defaults) per round. With 4 such processes alive, another process's 0.5 ms kernel took 4.6 ms instead of 0.58 ms. So this adds an opt-in, the direct_submission preference, overridable per process with ONEAPI_DIRECT_SUBMISSION, and documents the trade-off in the performance guide.

NEO reads its settings when the library is loaded, so oneAPI.jl now loads NEO itself, after setting the keys and before zeInit, and removes the keys again so that child processes don't inherit them. That needs NEO_jll not to load the driver in its __init__ (JuliaPackaging/Yggdrasil#15918). With a NEO_jll that does, opting in warns that it can't apply, and setting the two variables before starting Julia still works.

Closes #756.

With the upstream i915 kernel driver, which lacks VM_BIND, NEO doesn't
use direct submission, and every submission is a system call: launching
a trivial kernel and synchronizing takes ~56 µs on an Arc A770, often
twice that (#756). Forcing it on through NEO's debug keys brings that
down to ~12 µs, but each process with a polling ring delays other
processes on the GPU by a time slice per round, so it is opt-in: the
`direct_submission` preference, or ONEAPI_DIRECT_SUBMISSION.

NEO reads its settings when it is loaded, so the keys are set before
oneAPI.jl loads NEO, which it now does itself before zeInit, and are
removed again afterwards so child processes don't inherit them. This
needs a NEO_jll that doesn't load the driver in its __init__; with one
that does, oneAPI.jl warns that the setting can't apply.
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://juliagpu.github.io/oneAPI.jl/previews/PR793/

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.

High and variable launch + synchronize latency for small kernels (~56 µs, often 2x)

1 participant