Skip to content

[UR][L0v2] Implement IPC event sharing#22445

Draft
againull wants to merge 4 commits into
intel:syclfrom
againull:ipc_event_l0_adapter_v2
Draft

[UR][L0v2] Implement IPC event sharing#22445
againull wants to merge 4 commits into
intel:syclfrom
againull:ipc_event_l0_adapter_v2

Conversation

@againull

Copy link
Copy Markdown
Contributor

No description provided.

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
@againull againull changed the title Ipc event l0 adapter v2 [UR][L0v2] Implement IPC event sharing in the Level Zero v2 adapter Jun 25, 2026
@againull againull changed the title [UR][L0v2] Implement IPC event sharing in the Level Zero v2 adapter [UR][L0v2] Implement IPC event sharing Jun 25, 2026
againull added 2 commits June 25, 2026 21:12
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
@againull againull force-pushed the ipc_event_l0_adapter_v2 branch from c7ee814 to 15c4fab Compare June 26, 2026 04:20
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.

1 participant