Add Python bindings for SYCL IPC memory via dpctl#2331
Open
zxue2 wants to merge 5 commits into
Open
Conversation
Add inter-process communication (IPC) support for SYCL USM memory, enabling
zero-copy GPU memory sharing across processes. It wraps
sycl::ext::oneapi::experimental::ipc::memory (get/open/close/put).
C API (libsyclinterface):
- dpctl_sycl_ipc_memory_interface.h: declares DPCTLIPCMem_GetHandle,
DPCTLIPCMem_OpenHandle, DPCTLIPCMem_CloseHandle, DPCTLIPCMem_FreeHandleData
- dpctl_sycl_ipc_memory_interface.cpp: implements the C API by calling the
SYCL experimental ipc::memory functions; auto-discovered by CMake.
Cython declarations:
- _backend.pxd: extern block for the 4 new C functions
Python subpackage (dpctl.ipc):
- IPCMemoryHandle: Cython extension class wrapping IPC memory export/import
__init__(usm_memory): calls get() + put(), stores handle as bytes
to_bytes(): serializable payload for cross-process transport
open(handle_bytes, device, nbytes): returns MemoryUSMDevice
close_mapping(usm_memory): explicitly closes an IPC mapping
Signed-off-by: Zhan Xue <zhan.xue@intel.com>
ndgrigorian
reviewed
Jun 30, 2026
ndgrigorian
reviewed
Jun 30, 2026
ndgrigorian
reviewed
Jun 30, 2026
ndgrigorian
reviewed
Jun 30, 2026
ndgrigorian
reviewed
Jun 30, 2026
add has_aspect_ext_oneapi_ipc_memory checks in __init__ and open() Signed-off-by: Zhan Xue <zhan.xue@intel.com>
Collaborator
a626c94 to
7f907d0
Compare
Signed-off-by: Zhan Xue <zhan.xue@intel.com>
ce669ed to
2b2a3ec
Compare
2b2a3ec to
0a67e67
Compare
zxue2
commented
Jul 6, 2026
antonwolfy
reviewed
Jul 6, 2026
|
|
||
| from dpctl.memory import MemoryUSMDevice, IPCMemoryHandle | ||
| mem = MemoryUSMDevice(4096) | ||
| handle = IPCMemoryHandle(mem) |
Collaborator
There was a problem hiding this comment.
Is the class meant to be public? Then it seems missed in dpctl/memory/__init__.py and __all__ above/
|
|
||
| cdef class MemoryIPCDevice(MemoryUSMDevice): | ||
| """ | ||
| Class representing emory object backed by an IPC-mapped USM device pointer. |
Collaborator
There was a problem hiding this comment.
Suggested change
| Class representing emory object backed by an IPC-mapped USM device pointer. | |
| Class representing memory object backed by an IPC-mapped USM device pointer. |
| * | ||
| * Wraps ``sycl::ext::oneapi::experimental::ipc::memory::get()``. | ||
| * The returned handle bytes are copied out and the driver-side handle | ||
| * resource is released (via ``put``) before returning. |
Collaborator
There was a problem hiding this comment.
The comment seems inaccurate, there is no put call inside DPCTLIPCMem_GetHandle
| "copy of referenced queue" | ||
| ) from sqce | ||
|
|
||
| return MemoryIPCDevice(<object>base) |
Collaborator
There was a problem hiding this comment.
If the construction fails due to some reason, there will be __dealloc__ called, which will do DPCTLIPCMem_CloseHandle(...), because we already did: base._memory_ptr = USMRef.
From other side. since the construction fails at that point, there will be exception raised, and so there will be the 2nd call of DPCTLIPCMem_CloseHandle(...) at line 1214, during the exception handling.
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.
Add inter-process communication (IPC) support for SYCL USM memory, enabling zero-copy GPU memory sharing across processes. It wraps sycl::ext::oneapi::experimental::ipc::memory (get/open/close/put).
C API (libsyclinterface):
Cython declarations:
Python subpackage (dpctl.ipc):
Test In Docker (oneAPI 2026.0 installed):