[UR][L0v2] Implement IPC event sharing#22445
Draft
againull wants to merge 4 commits into
Draft
Conversation
Plumbing:
* platform: lazy loadIpcEventExtension() resolves the IPC trio
via zeDriverGetExtensionFunctionAddress and caches whether the driver
supports it.
* device: UR_DEVICE_INFO_IPC_EVENT_SUPPORT_EXP reports that result (v2/Linux
only, matching the rest of the IPC family).
* event flags: EVENT_FLAGS_IPC (producer side) and EVENT_FLAGS_IPC_IMPORTED
(consumer side). EVENT_FLAGS_USED_BITS is unchanged since IPC events are
never pool-allocated.
* introduced two move-only RAII wrappers, adapter_owned (producer
event, torn down via zeEventDestroy) and ipc_imported (consumer event,
torn down via zexCounterBasedEventCloseIpcHandle). ur_event_handle_t_'s
event_variant includes both. getZeEvent() now uses std::visit and release()
also performes corresponding action through the variant.
Behaviour:
* urEventCreateExp honours UR_EXP_EVENT_FLAG_IPC_EXP: it validates the device
belongs to the context, rejects IPC+profiling with INVALID_VALUE, and
creates a host-visible counter-based event with the IPC flag via
createIpcCounterBasedEvent(). The non-IPC reusable-event path remains an
as unsupported.
* urIPCGetEventHandleExp serializes a producer event, rejecting non-IPC,
imported, and profiling events. Ownership of the handle buffer transfers to
the caller.
* urIPCPutEventHandleExp frees that buffer.
* urIPCOpenEventHandleExp validates the buffer size, opens the handle, and
returns a normal ur_event_handle_t (ipc_imported variant). It is released
through urEventRelease, there is no separate close entry point.
Assited-By: Claude
Add event-test coverage for urIPC{Get,Put,Open}EventHandleExp.
ipc_event_fixtures.h provides urIPCEventTest, which skips on non-Level-Zero
backends and on devices that don't report UR_DEVICE_INFO_IPC_EVENT_SUPPORT_EXP,
creates an IPC-shareable event via urEventCreateExp, and signals it by
appending a barrier on a native immediate command list. The opened event is released
through the normal urEventRelease path; there is no separate close entry point.
Positives (urIPCEventExp.cpp): handle Get returns a sized buffer, same-process
Open, wait on the imported event, retain/release of the imported event,
repeated round trips, multiple opens of one handle, and Put leaving the
producer alive. Open is wrapped in UUR_IPC_OPEN_OR_SKIP so the open/close
cycling cases skip cleanly on drivers that do not yet reclaim a closed imported
counter-based IPC event (full 2-way IPC event driver support is required to run
them; e.g. they execute on BMG+).
Negatives (urIPCEventExpNegative.cpp): null-pointer/null-handle errors on Get,
Put, and Open; mismatched ipcEventHandleDataSize on Open; and rejection of
UR_EXP_EVENT_FLAG_IPC_EXP combined with UR_EXP_EVENT_FLAG_ENABLE_PROFILING at
create time.
Assisted-By: Claude
c7ee814 to
15c4fab
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.
No description provided.