Inter Process Communication#

Warning

Experimental features:

  • May be replaced, updated, or removed at any time.

  • Do not require maintaining API/ABI stability of their own additions over time.

  • Do not require conformance testing of their own additions.

Motivation#

This extension introduces functionality for allowing processes to share common objects, such as device USM memory allocations and event objects. Doing so lets processes actively communicate with each other through the devices, by explicitly managing handles that represent shareable objects for inter-process communication.

Event sharing semantics#

An event must be created by urEventCreateExp with the :ref:`UR_EXP_EVENT_FLAG_IPC_EXP <ur-exp-event-flags-t>`\ flag set in :ref:`ur-exp-event-desc-t`\::flags to be eligible for inter-process sharing. The flag cannot be enabled after the event is created.

An event opened with :ref:`urIPCOpenEventHandleExp`\ shares state with the source event that produced the IPC handle. Either event can be signaled, waited on, or queried, and a state change made through one event is observable through the other.

An event opened with :ref:`urIPCOpenEventHandleExp`\ is a normal ur_event_handle_t with an initial reference count of 1. It may be passed to entry points that accept events, retained with :ref:`urEventRetain`\, and must be released with :ref:`urEventRelease`\. On the final release, the adapter performs the native cleanup required for an opened IPC event.

Events created with :ref:`UR_EXP_EVENT_FLAG_ENABLE_PROFILING <ur-exp-event-flags-t>`\ cannot be shared via IPC.

Changelog#

Support#

Adapters which support inter-process sharing of memory allocations must return true for the :ref:`UR_DEVICE_INFO_IPC_MEMORY_SUPPORT_EXP <ur-device-info-t>`\ device info query.

Adapters which support inter-process sharing of event objects must return true for the :ref:`UR_DEVICE_INFO_IPC_EVENT_SUPPORT_EXP <ur-device-info-t>`\ device info query.

Contributors#