Expand description
Core DeviceMemoryResource trait and supporting types.
Mirrors RMM’s device_memory_resource shape so a future optional
RMM backend can satisfy the same trait without requiring callers to
change. Stream-ordered: every alloc/dealloc names a stream; cross-
stream reuse requires explicit event-based synchronization.
Structs§
- Alloc
Tag - Caller-supplied tag for allocation log lines. Short-lived strings are interned by the logging resource; long-lived borrows are not retained.
- BlockId
- Compact identity of a
DeviceBlocksuitable for snapshotting into structures whose lifetime should not be tied to the source slice’s borrow. The fields needed to validate(ptr, generation)against the resource’s live map and to resolvealloc_streamfor cross-stream waits / dealloc ordering. - Device
Block - One outstanding device-memory allocation. Owned by the caller until
returned to its originating resource via
DeviceMemoryResource::deallocate. - Generation
- Monotonic counter for distinguishing reuse of the same byte address across drop / reallocate cycles. Logging and debug-guard resources use this to detect use-after-free.
- Stream
Id - Identifier for a CUDA stream owned by the runtime’s stream pool.
Wraps the raw cudarc stream handle the resource will use for
cuMemAllocAsync/cuMemFreeAsyncordering. Construction goes through the runtime; do not fabricate.
Enums§
- Access
- Access kind for a single block use. Drives the cross-stream
dependency edges the resource queues during
DeviceMemoryResource::prepare_block_useand the events it records duringDeviceMemoryResource::finish_block_use. - Block
State - State of an outstanding
DeviceBlockfrom the runtime’s perspective. Adaptors flip blocks between these states; bug-detection resources reject operations on blocks in an unexpected state. - Resource
Error - Errors returned by resource implementations. Distinct variants for the cases stress tests need to pin (out-of-budget vs CUDA driver failure vs use-after-free etc.).
Traits§
- Device
Memory Resource - Stream-ordered device memory resource. Implementations: