core.allocator.vmm_symm_allocator#

CUDA VMM (Virtual Memory Management) allocator for NCCL symmetric-memory pools.

Implements NCCL’s requirements on user-allocated communication buffers (https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/usage/bufferreg.html#memory-allocator) minimally: VMM allocations at the recommended granularity, exportable handle types (POSIX FD, plus FABRIC when supported — dropped on retry if cuMemCreate rejects it), and GPUDirect-RDMA-capable physical memory when supported.

ncclMemAlloc uses the same VMM driver calls; the difference is that this allocator maps memory only on the allocation’s device (peers access it through NCCL windows), while ncclMemAlloc additionally maps every allocation on all P2P-visible peer GPUs — and those persistent peer mappings slow CPU-side kernel launching for the whole training step.

Window registration is delegated to nccl_allocator.register_mem_pool (which calls ncclCommWindowRegister), which accepts this memory and runs its symmetric kernels on it. Building the extension requires nvcc and libcuda at runtime; init/create_vmm_mem_pool raise if it cannot build, and callers decide whether to fall back to ncclMemAlloc-backed pools.

Module Contents#

Functions#

_build_vmm_allocator

create_vmm_mem_pool

Create a symmetric memory pool using the VMM allocator. Callers enforce the torch >= 2.9 floor that symmetric pools need.

init

Initialize the VMM allocator, including the NCCL environment its pools are registered under (same settings as nccl_allocator.init()).

register_mem_pool

Window-register a pool’s segments on group (always symmetric). Delegating to nccl_allocator is safe because its (de)registration walks the pool’s segments and never touches the allocator that produced them.

deregister_mem_pool

Deregister a pool’s windows from group. Delegates to nccl_allocator.

Data#

API#

core.allocator.vmm_symm_allocator.logger#

‘getLogger(…)’

core.allocator.vmm_symm_allocator._allocator#

None

core.allocator.vmm_symm_allocator._build_error#

None

core.allocator.vmm_symm_allocator._build_vmm_allocator()#
core.allocator.vmm_symm_allocator.create_vmm_mem_pool() → torch.cuda.MemPool#

Create a symmetric memory pool using the VMM allocator. Callers enforce the torch >= 2.9 floor that symmetric pools need.

core.allocator.vmm_symm_allocator.init() → None#

Initialize the VMM allocator, including the NCCL environment its pools are registered under (same settings as nccl_allocator.init()).

core.allocator.vmm_symm_allocator.register_mem_pool(pool: torch.cuda.MemPool, group) → None#

Window-register a pool’s segments on group (always symmetric). Delegating to nccl_allocator is safe because its (de)registration walks the pool’s segments and never touches the allocator that produced them.

core.allocator.vmm_symm_allocator.deregister_mem_pool(pool: torch.cuda.MemPool, group) → None#

Deregister a pool’s windows from group. Delegates to nccl_allocator.