Commit d53fab6
committed
[driver] Serialize load_binary to prevent IGC race condition (#7581)
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: #75811 parent 0f45edf commit d53fab6
1 file changed
Lines changed: 21 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
| |||
307 | 314 | | |
308 | 315 | | |
309 | 316 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
320 | 331 | | |
321 | 332 | | |
322 | 333 | | |
| |||
0 commit comments