Expand description
Device-memory types.
DeviceBuffer<T>— owned, typed GPU allocation.DeviceSlice<'_, T>/DeviceSliceMut<'_, T>— non-owning views into a buffer, with borrow-checker-tracked lifetimes.
Structs§
- Device
Buffer - Owned, typed allocation of device memory.
- Device
Slice - Immutable view into a range of a
DeviceBuffer. - Device
Slice Mut - Mutable view into a range of a
DeviceBuffer. - Managed
Buffer - Owned allocation of unified (managed) memory — a single pointer that
is accessible from both the host and the GPU, with on-demand migration
handled by the driver. Compare with
DeviceBuffer, which is device-only and requires explicit memcpys.
Enums§
- Managed
Attach - Attach-mode for
ManagedBuffer::new_with_flags. - MemAdvise
- Memory-usage advice for
cuMemAdvise. - Prefetch
Target - Destination for
mem_prefetch_v2/mem_advise_v2. Composes theCUmemLocation::{type_, id}pair.
Traits§
- Device
Ptr - Anything that can be read as a
[T]on the device. - Device
PtrMut - A
DevicePtrthat supports writes.
Functions§
- allocation_
properties_ from_ handle - Query the creation props of an existing allocation handle.
- get_
handle_ ⚠for_ address_ range - Export an OS-level handle (e.g. a DMA-buf file descriptor on Linux)
for a
size-byte VA range starting atdptr. - mem_
advise_ v2 cuMemAdvise_v2— unified-memory hint at a specific location.- mem_
get_ info - Current device’s free and total global memory, in bytes.
- mem_
prefetch_ v2 cuMemPrefetchAsync_v2— prefetchcountbytes starting atdptrto the givenPrefetchTarget, ordered onstream.- memcpy⚠
- Generic byte-count copy that works on any pair of CUDA-addressable pointers (device, unified, host-pinned). Use this when the kind of memory at each end isn’t known at the call site (typical for runtime-decided unified-memory paths).
- memcpy_
async ⚠ - Async variant of
memcpyordered onstream. - memcpy_
peer - Peer-to-peer device memory copy between two contexts — the pointers
must be valid device pointers in their respective contexts, and peer
access must be enabled (see
Context::enable_peer_access). - memcpy_
peer_ async - Async peer-to-peer device memory copy ordered on
stream. - memset_
2d_ u8 - 2D pitched 8-bit memset: fill a
width × heightrectangle of bytes atdst(row pitchpitch) withvalue. - memset_
2d_ u16 - 2D pitched 16-bit memset.
- memset_
2d_ u32 - 2D pitched 32-bit memset.
- memset_
u8_ async - Async 8-bit memset on
stream. - memset_
u16 - Fill
count16-bit elements atdstwithvalue(synchronous). - memset_
u32 - Synchronous 32-bit memset.
- memset_
u16_ async - Async variant of
memset_u16ordered onstream. - memset_
u32_ async - Async 32-bit memset on
stream. - retain_
allocation_ handle - Reverse lookup: given a device pointer inside a VMM mapping, bump the
underlying allocation handle’s refcount and return it. Pair with
cuMemReleaseto drop the extra ref.