Expand description
2026-09-25: The GpuBackend trait: allocation, copies, kernel launches,
graphs, events and memory queries for one device.
Owner: gpu-runtime. Invariants: none beyond the types.
Structs§
- Device
Ptr - 2026-09-25: A device address: a
CUdeviceptron CUDA, anMTLBuffergpuAddresson Metal. 0 is null. - Graph
Handle - 2026-09-25: An instantiated CUDA graph (
CUgraphExec). - Kernel
Handle - 2026-09-25: A kernel function: a
CUfunctionon CUDA, a pipeline slab index on Metal.
Enums§
- Kernel
Arg - 2026-09-25: A typed kernel argument for
launch_typed. The Metal backend binds buffers withsetBuffer:offset:atIndex:and bytes withsetBytes:length:atIndex:; CUDA packs both into parameter slots.
Traits§
- GpuBackend
- 2026-09-25: The device interface the model code calls. Implementations:
MetraleCudaBackend(cudafeature),MetalGpuBackend(metalfeature) andMockGpuBackend(tests and thetest-utilsfeature).
Functions§
- baseline_
free_ bytes - 2026-09-25: The recorded baseline, or
Nonewhile it is unset (stored as 0). - pack_
kernel_ args - 2026-09-25: Pack typed args into u64 slots; returns the slots and each argument’s starting slot index.
- set_
baseline_ free_ bytes - 2026-09-25: Record the free-memory baseline; the last call wins.