Skip to main content

Module memory

Module memory 

Source
Expand description

Device-memory types.

Structs§

DeviceBuffer
Owned, typed allocation of device memory.
DeviceSlice
Immutable view into a range of a DeviceBuffer.
DeviceSliceMut
Mutable view into a range of a DeviceBuffer.
ManagedBuffer
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§

ManagedAttach
Attach-mode for ManagedBuffer::new_with_flags.
MemAdvise
Memory-usage advice for cuMemAdvise.
PrefetchTarget
Destination for mem_prefetch_v2 / mem_advise_v2. Composes the CUmemLocation::{type_, id} pair.

Traits§

DevicePtr
Anything that can be read as a [T] on the device.
DevicePtrMut
A DevicePtr that 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 at dptr.
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 — prefetch count bytes starting at dptr to the given PrefetchTarget, ordered on stream.
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 memcpy ordered on stream.
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 × height rectangle of bytes at dst (row pitch pitch) with value.
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 count 16-bit elements at dst with value (synchronous).
memset_u32
Synchronous 32-bit memset.
memset_u16_async
Async variant of memset_u16 ordered on stream.
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 cuMemRelease to drop the extra ref.