Skip to content

Commit 7a24bd8

Browse files
Implements IPC-enabled memory pools for Linux in DeviceMemoryResource (#930)
* Updates DeviceMemoryResource to accept Device objects for the device_id argument. * Adds IPC support to DeviceMemoryResource. Creates a staticmethod `current` to access the default memory pool. * Added a missing import statement. * Restores DeviceMemoryResource default behavior to return the current memory pool. Removes the `current` staticmethod. Adds an option dataclass for constructor options. * Adjusts docstrings for consistency. * Adjusts dataclass member defs in *Options classes for Cython. * Adds __bool__ to the MemoryResource interface. * Minor docstring update. * Changes verbiage from "shared" or "shareable" handle to "allocation handle" to better align with the driver API. * Significantly reworks the tests for IPC-enabled memory pools. Introduces `IPCAllocationHandle` to manage pool-sharing resources. Introduces `IPCChannel` to for sharing allocation handles in a platform-independent way (though currently only Linux is supported). * Various fixes including: groups cimport statements; removes __bool__ method from MemoryResource; Cythonizes helper classes; disables __init__ for non-API classes; removes abstract factory constructor from IPCChannel; removes the _requires_ipc decorator (checks are now inlined) * Formatting changes. * Creates an attributes suite to bundle the DeviceMemoryResource attributes. * Format changes. * Test updates. Parameterizes tests (rather than use internal loops). Adds stream synchronization. Eliminates unnecessary clean-up. Removes unnecessary check for CUDA 12 or later. * Reworks mempool attribute implementation. * Adds testing for errors when allocating from an imported memory pool. * Move IPC import/export methods into the Buffer class. * Updated release notes. * Reworks DeviceMemoryResourceAttributes to use a descriptor. * Remove use of deprecated abstractproperty. Co-authored-by: Keenan Simpson <ksimpson@nvidia.com>
1 parent de5c843 commit 7a24bd8

File tree

8 files changed

+792
-50
lines changed

8 files changed

+792
-50
lines changed

cuda_core/cuda/core/experimental/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
from cuda.core.experimental._launch_config import LaunchConfig
1515
from cuda.core.experimental._launcher import launch
1616
from cuda.core.experimental._linker import Linker, LinkerOptions
17-
from cuda.core.experimental._memory import Buffer, DeviceMemoryResource, LegacyPinnedMemoryResource, MemoryResource
17+
from cuda.core.experimental._memory import (
18+
Buffer,
19+
DeviceMemoryResource,
20+
IPCChannel,
21+
LegacyPinnedMemoryResource,
22+
MemoryResource,
23+
)
1824
from cuda.core.experimental._module import Kernel, ObjectCode
1925
from cuda.core.experimental._program import Program, ProgramOptions
2026
from cuda.core.experimental._stream import Stream, StreamOptions

0 commit comments

Comments
 (0)