ATOM Environment Variables

July 17, 2026 · View on GitHub

This document describes the environment variables used in the ATOM project.


Data Parallelism

VariableTypeDefaultDescription
ATOM_DP_RANKint0The rank ID for the current process in data parallelism.
ATOM_DP_RANK_LOCALint0The local rank ID for the current process (used in SPMD mode).
ATOM_DP_SIZEint1Total number of data parallel ranks.
ATOM_DP_MASTER_IPstr127.0.0.1Master IP address for DP ranks coordination.
ATOM_DP_MASTER_PORTint29500Master port for DP ranks coordination.

Prefill Delayer (DP attention)

Prefill coalescer for DP-attention + EP-MoE serving. Holds back prefill admission until the accumulated prefill (fresh waiting tokens + resumable partials' remaining tokens) fills a worthwhile forward, so fragmented short-input prefills / small partial tail chunks batch into one forward instead of firing many tiny ones. Releases when the fill target is reached, when a must-fire bound trips (no decode to hide behind, KV pressure/starvation, TTFT deadline, partial deadline), or when the queue stops growing. Preserves cross-rank phase alignment (releases only when every rank is prefill-ready, unless a bound forces it). All timing is tick-based (deterministic across ranks — no wall-clock skew). See atom/model_engine/prefill_delayer.py. Active only when data_parallel_size > 1.

VariableTypeDefaultDescription
ATOM_ENABLE_PREFILL_DELAYERbooltrueMaster switch for the prefill coalescer.
ATOM_PREFILL_DELAYER_TARGET_FILLfloat0.7Release once accumulated pending tokens reach target_fill × max_num_batched_tokens (averaged across prefillable ranks). In (0, 1]; higher = fewer, larger prefills at some TTFT cost. Clamped to (0, 1].
ATOM_PREFILL_DELAYER_TTFT_MAX_TICKSint30Max consecutive scheduler ticks a held prefill waits before force-release. Values < 1 clamped to 1.
ATOM_PREFILL_DELAYER_PARTIAL_MAX_TICKSint8Tighter bound for a held mid-chunked-prefill (it holds allocated KV). Values < 1 clamped to 1.
ATOM_PREFILL_DELAYER_STALL_TICKSint3After this many consecutive non-growing ticks, release (burst ended, more won't come). Values < 1 clamped to 1.
ATOM_PREFILL_DELAYER_KV_HIGH_WATERMARKfloat0.9At/above this KV usage a prefillable rank force-releases (can't accumulate a bigger batch anyway).
ATOM_PREFILL_DELAYER_TOKEN_USAGE_LOW_WATERMARKfloat|"""" (None)If set, a prefillable rank below this KV usage force-releases (GPU starving).
ATOM_PREFILL_DELAYER_MAX_QUEUE_MSfloat|"""" (None)TTFT SLA guard: if any rank's oldest schedulable waiting prefill has queued (since arrival) ≥ this many ms, force-release regardless of the fill target. Measures true end-to-end wait (backlog + coalescer holds), unlike the tick-based TTFT bound which only caps one hold episode. Empty = disabled; set to your TTFT budget (a small value under heavy backlog fires every tick and defeats coalescing).
ATOM_PREFILL_DELAYER_DEBUGboolfalsePer-tick FIRE/HOLD debug logging.
ATOM_PREFILL_DELAYER_LOG_EVERYint1000Emit aggregate stats (per-exit fire counts + hold rate) every N decisions (0 disables).

Model Loading

VariableTypeDefaultDescription
ATOM_DISABLE_MMAPboolfalseIf set to true, disable memory-mapped file loading for model weights. Useful in containerized environments where mmap may cause issues.
ATOM_LOADER_NUM_THREADSint16Worker threads for weight loading. >1 (default 16) enables the batched parallel loader (per-fused-param CPU staging flushed with a single H2D copy) with that many threads; set to 1 to fall back to the original sequential per-expert path. Raise on high-core hosts if loading is CPU-bound.

Plugin Mode

VariableTypeDefaultDescription
ATOM_DISABLE_VLLM_PLUGINbool0 (false)If set to 1, disable the vLLM plugin registration entirely.

Kernel / Backend Selection

VariableTypeDefaultDescription
ATOM_USE_TRITON_GEMMbool0 (false)If set to 1, use AITER Triton FP4 weight preshuffled GEMM. Otherwise use AITER ASM FP4 weight preshuffled GEMM.
ATOM_USE_FP4_NON_SHUFFLE_TRITON_GEMMbool0 (false)If set to 1, use AITER Triton FP4 GEMM with non-shuffled weights. Takes precedence over the FP4 preshuffled GEMM path selected by ATOM_USE_TRITON_GEMM.
ATOM_USE_TRITON_MXFP4_BMMbool0 (false)If set to 1, use FP4 BMM in MLA attention module.

Fusion Passes

TP AllReduce Fusion

VariableTypeDefaultDescription
ATOM_ENABLE_ALLREDUCE_RMSNORM_FUSIONbool1 (true)If set to 1, fuse allreduce with RMSNorm in tensor parallel mode.

DeepSeek-style

VariableTypeDefaultDescription
ATOM_ENABLE_DS_INPUT_RMSNORM_QUANT_FUSIONbool1 (true)If set to 1, fuse RMSNorm with quantization.
ATOM_ENABLE_DS_QKNORM_FUSIONbool1 (true)If set to 1, use the fused Q/K RMSNorm path (fused_qk_rmsnorm) in the DeepSeek MLA attention module when Q-LoRA is enabled and QK norm+quant fusion is not used. If set to 0, apply separate RMSNorm for the Q and KV branches instead.
ATOM_ENABLE_DS_QKNORM_QUANT_FUSIONbool1 (true)If set to 1, fuse QK norm with quantization in MLA attention module.
ATOM_DUAL_STREAM_MOE_TOKEN_THRESHOLDint1024Upper bound on MoE token count (num_tokens in the MoE forward) for using the dual-stream path: shared experts on a secondary CUDA stream while routed experts run on the default stream. If num_tokens exceeds this value, that forward uses single-stream MoE instead. Set to 0 to disable dual-stream setup entirely (no alt stream, no maybe_dual_stream_forward registration).

Qwen3-MoE style

VariableTypeDefaultDescription
ATOM_ENABLE_QK_NORM_ROPE_CACHE_QUANT_FUSIONbool0 (false)If set to 1, fuse QK norm, RoPE, and cache quantization into one kernel. Enable this for Qwen3-MoE models for better performance.

Llama-style

VariableTypeDefaultDescription
ATOM_LLAMA_ENABLE_AITER_TRITON_FUSED_RMSNORM_QUANTbool1 (true)If set to 1, use Triton kernel to fuse RMSNorm with quantization.
ATOM_LLAMA_ENABLE_AITER_TRITON_FUSED_SILU_MUL_QUANTbool1 (true)If set to 1, use Triton kernel to fuse SiLU and mul with quantization in MLP module.

V4 Attention Backend (Migration)

Selects between the legacy per-seq Python dispatch path in atom/models/deepseek_v4.py and the new batched V4AttentionBackend (atom/model_ops/v4_attention_backend.py). The new backend removes ~256 GPU→CPU .item() syncs per forward and is required to enable CUDAGraph capture for V4. Legacy stays available during PR-A migration for byte-equal A/B verification via dump-bisect; it is removed once all phases land. See atom/model_ops/v4_backend_gate.py for the selector.

VariableTypeDefaultDescription
ATOM_V4_BACKENDstrlegacylegacy keeps the per-seq dispatch loop. new routes through V4AttentionBackend. Layer-restricted by ATOM_V4_BACKEND_LAYERS if set.
ATOM_V4_BACKEND_LAYERScsv int"" (= all)Comma-separated layer ids that use the new backend (others stay legacy). Empty means: apply ATOM_V4_BACKEND uniformly. Used for layer-by-layer bisect during migration (e.g. 0,3,15,30).

Profiling & Debugging

VariableTypeDefaultDescription
ATOM_TORCH_PROFILER_DIRstrWhen set, enables PyTorch profiler and writes traces to this directory. Create subdirectories per rank (e.g., rank_0, dp0_tp0).
ATOM_PROFILER_MOREbool0 (false)When ATOM_TORCH_PROFILER_DIR is set and this is 1, enables detailed profiling: record_shapes, with_stack, and profile_memory.
ATOM_LOG_MOREbool0 (false)If set to 1, use verbose logging format (includes process name, PID, path, line number, function name).

Debug Dump (atom.utils.debug_helper)

Env-gated dump / compare / monkey-patch primitives for forward bisect & batch invariance investigation. All entries are no-op when their controlling *_DIR is unset, so they are safe to leave wired into production paths. See .claude/skills/dump-bisect-debug.md for the methodology and atom/utils/debug_helper/ for the implementation.

VariableTypeDefaultDescription
ATOM_FWD_DUMP_DIRstrEnables install_block_forward_hooks. Per-Block hidden state is saved to {DIR}/layer{LL}_{Cls}_rank{R}[_call{NNN}].pt.
ATOM_FWD_DUMP_LAYERScsv int"" (= all)Comma-separated layer ids to dump (e.g. 0,5,15,30). Empty string means dump every layer.
ATOM_FWD_DUMP_BLOCK_CLASScsv strBlockModule class names to hook. Multiple values supported (e.g. Block,DeepseekV4Attention,MoE,Compressor,Indexer) for sub-stage bisect. Override per model.
ATOM_FWD_DUMP_LAYER_ATTRstrlayer_idAttribute name on the block carrying its index. Some non-DeepSeek models use layer_idx.
ATOM_FWD_DUMP_ONE_SHOTbool1 (true)When 1, only the first call per layer is dumped (typical: warmup). Set to 0 to enumerate every call (_call000.pt, _call001.pt, …) — required when bisecting per-seq dispatch loops.
ATOM_WEIGHT_DUMP_DIRstrEnables maybe_dump_weights_and_exit. Per-rank params + buffers for selected layers dumped to {DIR}/weight_rank{R}_layer{L}.pt. Skips .experts.* (FP4 packed).
ATOM_WEIGHT_DUMP_LAYERScsv int0Comma-separated layer ids to dump weights for.
ATOM_WEIGHT_DUMP_EXITbool1 (true)When 1 (default), call sys.exit(0) after dumping. Set to 0 to continue inference after dump.
ATOM_DEBUG_TOPKint0Set to K > 0 to log top-K logits per row from Sampler.forward via maybe_log_topk(). Only rank 0 writes.
ATOM_DEBUG_TOPK_PATHstrOptional output file for top-K logs. Writes to stderr if unset.

CLI for comparing dumps:

python -m atom.utils.debug_helper.compare slot-invariance --dir DIR --n-slots 4
python -m atom.utils.debug_helper.compare ref-vs-target  --dir DIR
python -m atom.utils.debug_helper.compare layer-bisect   --dir DIR --threshold 0.99
python -m atom.utils.debug_helper.compare schema --a A.pt --b B.pt

Benchmarks (Optional)

VariableTypeDefaultDescription
OPENAI_API_KEYstrAPI key for OpenAI-compatible benchmark requests.
VLLM_USE_MODELSCOPEboolfalseIf set to true, use ModelScope for model downloads in benchmarks.
SAVE_TO_PYTORCH_BENCHMARK_FORMATboolfalseIf set, save benchmark results in PyTorch benchmark format.

Internal / Set by ATOM

The following variables are set internally by ATOM; users typically do not need to configure them:

VariableDescription
AITER_QUICK_REDUCE_QUANTIZATIONSet to INT4 for Llama models with bf16/fp16.
TORCHINDUCTOR_CACHE_DIRSet by compiler interface for inductor cache.
TRITON_CACHE_DIRSet by compiler interface for Triton cache.

Reference

Environment variables are defined and accessed via atom.utils.envs:

from atom.utils import envs

# Example: check data parallel size
dp_size = envs.ATOM_DP_SIZE

See atom/utils/envs.py for the full list of lazy-evaluated environment variables.