[driver] Serialize load_binary to prevent IGC race condition (#7581) - #7860
Draft
NathanVoldman wants to merge 1 commit into
Draft
[driver] Serialize load_binary to prevent IGC race condition (#7581)#7860NathanVoldman wants to merge 1 commit into
NathanVoldman wants to merge 1 commit into
Conversation
IGC 2.38.x has a race condition in its in-process Level Zero JIT path (`zeModuleCreate`). When multiple Triton kernels JIT-compile concurrently in the same process (via AsyncCompileMode's ThreadPoolExecutor), each thread calls `load_binary`, which releases the Python GIL on entry to the C extension and then calls `zeModuleCreate`. With the GIL released, multiple threads can be inside `zeModuleCreate` simultaneously, corrupting IGC's internal state and triggering a `SIGABRT` in `libigdrcl.so`. The crash is confirmed by the definitive test: adding any compilation overhead that serializes the calls (`IGC_PrintToConsole=1`, shader dump) prevents it entirely — proving a timing race, not a deterministic bug. Fix: add a module-level `threading.Lock` that serializes all `load_binary` calls. This ensures only one thread is inside `zeModuleCreate` at a time, preventing the race without requiring an IGC fix. Performance: verified +1.7% startup time difference (within measurement noise) on Arc A770 with vLLM. Hot-path inference is unaffected (kernels are cached after first compilation). Fixes: #7581
NathanVoldman
force-pushed
the
dev/nvoldman/igc-add-lock
branch
from
August 27, 2026 12:23
fce2a47 to
d53fab6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IGC 2.38.x has a race condition in its in-process Level Zero JIT path (
zeModuleCreate). When multiple Triton kernels JIT-compile concurrently in the same process (via AsyncCompileMode's ThreadPoolExecutor), each thread callsload_binary, which releases the Python GIL on entry to the C extension and then callszeModuleCreate. With the GIL released, multiple threads can be insidezeModuleCreatesimultaneously, corrupting IGC's internal state and triggering aSIGABRTinlibigdrcl.so.The crash is confirmed by the definitive test: adding any compilation overhead that serializes the calls (
IGC_PrintToConsole=1, shader dump) prevents it entirely — proving a timing race, not a deterministic bug.Fix: add a module-level
threading.Lockthat serializes allload_binarycalls. This ensures only one thread is insidezeModuleCreateat a time, preventing the race without requiring an IGC fix.Performance: verified +1.7% startup time difference (within measurement noise) on Arc A770 with vLLM. Hot-path inference is unaffected (kernels are cached after first compilation).
Fixes: #7581