Skip to main content

Crate tensor_wasm_mem

Crate tensor_wasm_mem 

Source
Expand description

CUDA Unified Memory allocator and Wasmtime MemoryCreator integration.

Two byte-buffer types:

  • unified::UnifiedBuffer — CUDA Unified Memory when the unified-memory feature is enabled; a heap buffer otherwise.
  • pinned_host::GuardedHostBuffer — guarded host memory for the explicit-fallback path used by cargo build --no-default-features. On all hosts the buffer is bracketed by PROT_NONE / PAGE_NOACCESS guard pages catching OOB reads/writes at the OS level. The managed memory path (UnifiedBuffer on CUDA hosts) still cannot use guard pages — that limitation is unchanged. The previous name PinnedHostBuffer is preserved as a deprecated alias.

Pools (pool::UnifiedMemoryPool) amortise the cost of CUDA allocations by carving sub-slices from a single slab. Hints (advise) forward to cudaMemAdvise on CUDA hosts and are no-ops otherwise.

Modules§

advise
cudaMemAdvise hint helpers.
isolation
Memory isolation policy for TensorWasm Wasm instances.
pinned_host
GuardedHostBuffer — host buffer used when the unified-memory feature is disabled.
pool
UnifiedMemoryPool — a bump allocator that amortises the cost of CUDA Unified Memory allocations.
unified
UnifiedBuffer — a region of memory that is addressable from both CPU and GPU when a CUDA backing feature is enabled.
wasm_memory
Wasmtime MemoryCreator backed by UnifiedBuffer.