Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Memory & Resource System

GPU hardware operates on distinct physical memory tiers with differing latency, bandwidth, and scope characteristics:

  • Global VRAM (High Bandwidth Memory): Dedicated device memory accessible by all GPU compute units.
  • ParamArena (Uniform Memory): High-speed linear payload space used for passing configurations and addresses into shader registers.
  • On-Chip Shared Memory (SRAM / LDS): Ultra-low-latency scratchpad memory physically local to each compute workgroup.

Enki mirrors these hardware tiers through five distinct Rust abstractions:

TypePhysical Memory TierOwnership & LifecyclePrimary Use Case
GpuVec<T>Global VRAMOwned allocation via 64-bit BDA. Moves and deep-clones.Large data sets, vertex arrays, simulation state.
Slice<T> / SliceMut<T>Global VRAMBorrowed zero-allocation sub-range views.Sub-slicing without re-allocating VRAM.
GpuParam<T>ParamArena (Uniforms)Packed by-value into linear dispatch payload.Small-to-medium structs (Camera, Config).
GpuAtomic<T>Global VRAMDedicated device storage with hardware atomic instructions.Global counters, locks, parallel compaction.
GpuTileMem<T, N>On-Chip SRAM (LDS)Zero allocation. Allocated in local workgroup registers.Cooperative tile caching, intra-tile reductions.

Chapter Overview