Skip to content

Build & configuration

The GPU path is vendor-neutral behind a Cargo feature — everything above the backend (storage, profiler, pipeline) is identical across vendors. With no feature, the crate builds and runs a page-aligned host fallback, so it’s fully testable off-GPU on any machine.

Cargo features

FeatureVendorRuntimeEnv var
cudaNVIDIAcudart (dynamic)CUDA_PATH
cuda-kernelsNVIDIAdynamic cudart + compiled kernels.cu (nvcc)CUDA_PATH
cuda-staticNVIDIAstatic cudart baked in — runs on the driver aloneCUDA_PATH
rocmAMDamdhip64 — memory only (no compute kernels)ROCM_PATH
rocm-kernelsAMDamdhip64 + compiled kernels.cu (hipcc) — compute, unverified on hardwareROCM_PATH
(none)—host fallback—
NVIDIA (CUDA) is the only backend with working compute kernels — verified on real hardware against the CPU oracle (tests/gpu_parity.rs). rocm-kernels compiles the same kernels.cu with hipcc for AMD; it type-checks and builds, but has not yet been parity-verified on a real AMD card, so validate with dlm doctor before trusting output. The plain rocm feature provides memory management only — VRAM query and pinned host memory — so with it inference runs on the CPU.
cargo check --features cuda-kernels type-checks the Rust FFI without the toolkit; building a binary that runs the kernels needs nvcc + a GPU.

Build commands

Type-checking works without either toolkit installed; building and linking require the corresponding runtime on the link path.

$cargo check --features cuda # validates the CUDA FFI, no linking
$cargo check --features rocm # validates the ROCm/HIP FFI, no linking
$CUDA_PATH=/usr/local/cuda cargo build --features cuda-kernels
$ROCM_PATH=/opt/rocm cargo build --features rocm
On a CUDA machine, cargo test --features cuda-kernels runs the GPU parity test — it decodes the same random model on both the CPU and GPU kernels and asserts the hidden states match. The CPU kernel is the correctness oracle for the device code.

Environment variables

VariableUsed byPurpose
CUDA_PATHcuda / cuda-kernelsLocate the CUDA toolkit at build/link time.
DLM_CUDA_ARCHScuda-kernels buildGPU architectures to compile for, comma-separated (default 75,80,86,89). Narrow it, e.g. 75, for a quicker local build.
ROCM_PATHrocmLocate the ROCm/HIP runtime.
HF_TOKENpullAuth for gated/private Hugging Face repos.
DLM_CLUSTER_SECRETserve (distributed)Shared master↔worker secret, in place of --cluster-secret — keeps it out of the process list.
DLM_CPUinstallerSet to 1 to force the CPU build.
DLM_INSTALL_DIRinstallerChange the binary install location.

Device selection

Distributed mode

Scale across GPUs and hosts. See Architecture & math for how each works.

FlagEffect
--multi-gpu-ids 0,1,2Pipeline-parallel across local GPUs; only the hidden residual crosses the boundary.
--distributed-mode workerServe a layer shard to a master over TCP (Protobuf-framed).
--draft-model-pathDecode speculatively with a draft model.