Module gpu

Module gpu 

Source
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§

DevicePtr
2026-09-25: A device address: a CUdeviceptr on CUDA, an MTLBuffer gpuAddress on Metal. 0 is null.
GraphHandle
2026-09-25: An instantiated CUDA graph (CUgraphExec).
KernelHandle
2026-09-25: A kernel function: a CUfunction on CUDA, a pipeline slab index on Metal.

Enums§

KernelArg
2026-09-25: A typed kernel argument for launch_typed. The Metal backend binds buffers with setBuffer:offset:atIndex: and bytes with setBytes:length:atIndex:; CUDA packs both into parameter slots.

Traits§

GpuBackend
2026-09-25: The device interface the model code calls. Implementations: MetraleCudaBackend (cuda feature), MetalGpuBackend (metal feature) and MockGpuBackend (tests and the test-utils feature).

Functions§

baseline_free_bytes
2026-09-25: The recorded baseline, or None while 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.