Repository navigation
Serialize Level Zero IPC handle operations - #1633
lukaszstolarczuk wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
I asked Copilot to reproduce the issue found occasionally on CI. Please review and let me know if we want to keep this. I'll remove the extra workflow change, once we agree to keep this. // https://github.com/oneapi-src/unified-memory-framework/actions/runs/43421722246/job/131902181115#step:17:222 |
What is this issue about? Could you elaborate/paste links? |
|
... and please add a PR description - it needs a short note why the serialization is required. |
see the links to CI in my prevous comment. That's all I got to reproduce the issue locally. I'll paste more details to PR's description tomorrow. |
|
Added the description to the PR, once we decide to keep these changes I'll clean up the CI change and add proper description to the commit message. |
|
FYI: #1634 is an alternative solution for this issue |
Temporarily borrow the parallel stress loop from oneapi-src#1633 to validate the tracking IPC cache concurrency fix under load.
ldorau
left a comment
There was a problem hiding this comment.
I would prefer not to take the global ze_ipc_lock as the main fix. The failing umfIpcTest.Concurrent*GetPutHandles* tests go through the tracking IPC cache. The crash looks like concurrent zeMemGetIpcHandle / zeMemPutIpcHandle on the same allocation. #1634 fixes that in the cache (single-flight get-or-create, plus Free/retirement handling). It does not serialize all Level Zero IPC calls.
Concerns with this approach:
- A process-global mutex is wider than "same allocation". It may slow down IPC for many allocations or contexts.
- It can hide UMF concurrency bugs that we should fix in tracking instead.
I reproduced the CI crash on this PVC machine, traced it to a race inside the Level Zero driver, and added a workaround in UMF that stopped the crash in my stress runs.
How to reproduce it: run the test binary many times in parallel so the CPU is busy:
seq 1 400 | xargs -P 16 -I{} sh -c './test_provider_level_zero_dlopen_global >/dev/null 2>&1 || echo FAIL {}'Running it one at a time didn't fail even once in 300 runs. In parallel it crashed 2 times out of 400, in the same
umfIpcTest.Concurrent*GetPutHandlestests as in CI.Where it crashes: I ran it under gdb with a build that has debug symbols. The stack is:
umfPoolFree → trackingFree → ze_memory_provider_put_ipc_handle → zeMemPutIpcHandle → libze_intel_gpu.so → call to a NULL pointer.
This happens on the main thread, after the worker threads have finished. The concurrent phase leaves the driver's IPC handle records broken, and the later single-threaded release of the handle is what crashes.