Skip to content

Serialize Level Zero IPC handle operations - #1633

Draft
lukaszstolarczuk wants to merge 2 commits into
oneapi-src:mainfrom
lukaszstolarczuk:verify-gpu-test
Draft

lukaszstolarczuk wants to merge 2 commits into
oneapi-src:mainfrom
lukaszstolarczuk:verify-gpu-test

Conversation

@lukaszstolarczuk

@lukaszstolarczuk lukaszstolarczuk commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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*GetPutHandles tests 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.

lukaszstolarczuk and others added 2 commits November 13, 2026 14:09
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lukaszstolarczuk

Copy link
Copy Markdown
Contributor Author

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
or
// https://github.com/oneapi-src/unified-memory-framework/actions/runs/43414531006/job/131861374464#step:17:222

@lukaszstolarczuk lukaszstolarczuk added this to the 1.4 milestone Nov 16, 2026
@ldorau

ldorau commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

I asked Copilot to reproduce the issue found occasionally on CI.

What is this issue about? Could you elaborate/paste links?

@ldorau

ldorau commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

... and please add a PR description - it needs a short note why the serialization is required.

@lukaszstolarczuk

Copy link
Copy Markdown
Contributor Author

I asked Copilot to reproduce the issue found occasionally on CI.

What is this issue about? Could you elaborate/paste links?

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.

@lukaszstolarczuk

Copy link
Copy Markdown
Contributor Author

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.

@ldorau

ldorau commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

FYI: #1634 is an alternative solution for this issue

ldorau added a commit to ldorau/unified-memory-framework that referenced this pull request Nov 25, 2026
Temporarily borrow the parallel stress loop from oneapi-src#1633 to validate
the tracking IPC cache concurrency fix under load.

@ldorau ldorau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. A process-global mutex is wider than "same allocation". It may slow down IPC for many allocations or contexts.
  2. It can hide UMF concurrency bugs that we should fix in tracking instead.

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.

2 participants