ATOM Environment Variables
This document describes the environment variables used in the ATOM project.
Data parallelism
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_DP_RANK |
int |
0 |
The rank ID for the current process in data parallelism. |
ATOM_DP_RANK_LOCAL |
int |
0 |
The local rank ID for the current process (used in SPMD mode). |
ATOM_DP_SIZE |
int |
1 |
Total number of data parallel ranks. |
ATOM_DP_MASTER_IP |
str |
127.0.0.1 |
Master IP address for DP ranks coordination. |
ATOM_DP_MASTER_PORT |
int |
29500 |
Master 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.
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_ENABLE_PREFILL_DELAYER |
bool |
true |
Master switch for the prefill coalescer. |
ATOM_PREFILL_DELAYER_TARGET_FILL |
float |
0.7 |
Release once accumulated pending tokens reach |
ATOM_PREFILL_DELAYER_TTFT_MAX_TICKS |
int |
30 |
Max consecutive scheduler ticks a held prefill waits before force-release. Values |
ATOM_PREFILL_DELAYER_PARTIAL_MAX_TICKS |
int |
8 |
Tighter bound for a held mid-chunked-prefill (it holds allocated KV). Values |
ATOM_PREFILL_DELAYER_STALL_TICKS |
int |
3 |
After this many consecutive non-growing ticks, release (burst ended, more won’t come). Values |
ATOM_PREFILL_DELAYER_KV_HIGH_WATERMARK |
float |
0.9 |
At/above this KV usage a prefillable rank force-releases (can’t accumulate a bigger batch anyway). |
ATOM_PREFILL_DELAYER_TOKEN_USAGE_LOW_WATERMARK |
float|”” |
“” (None) |
If set, a prefillable rank below this KV usage force-releases (GPU starving). |
ATOM_PREFILL_DELAYER_MAX_QUEUE_MS |
float|”” |
“” (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_DEBUG |
bool |
false |
Per-tick FIRE/HOLD debug logging. |
ATOM_PREFILL_DELAYER_LOG_EVERY |
int |
1000 |
Emit aggregate stats (per-exit fire counts + hold rate) every N decisions (0 disables). |
Model loading
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_DISABLE_MMAP |
bool |
false |
If set to |
ATOM_LOADER_NUM_THREADS |
int |
16 |
Worker threads for weight loading. |
Plugin mode
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_DISABLE_VLLM_PLUGIN |
bool |
0 (false) |
If set to |
Kernel / backend selection
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_USE_TRITON_GEMM |
bool |
0 (false) |
If set to |
ATOM_USE_FP4_NON_SHUFFLE_TRITON_GEMM |
bool |
0 (false) |
If set to |
ATOM_USE_TRITON_MXFP4_BMM |
bool |
0 (false) |
If set to |
Fusion passes
TP AllReduce fusion
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_ENABLE_ALLREDUCE_RMSNORM_FUSION |
bool |
1 (true) |
If set to |
DeepSeek-style
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_ENABLE_DS_INPUT_RMSNORM_QUANT_FUSION |
bool |
1 (true) |
If set to |
ATOM_ENABLE_DS_QKNORM_FUSION |
bool |
1 (true) |
If set to |
ATOM_ENABLE_DS_QKNORM_QUANT_FUSION |
bool |
1 (true) |
If set to |
ATOM_DUAL_STREAM_MOE_TOKEN_THRESHOLD |
int |
1024 |
Upper bound on MoE token count ( |
Qwen3-MoE style
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_ENABLE_QK_NORM_ROPE_CACHE_QUANT_FUSION |
bool |
0 (false) |
If set to |
Llama-style
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_LLAMA_ENABLE_AITER_TRITON_FUSED_RMSNORM_QUANT |
bool |
1 (true) |
If set to |
ATOM_LLAMA_ENABLE_AITER_TRITON_FUSED_SILU_MUL_QUANT |
bool |
1 (true) |
If set to |
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.
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_V4_BACKEND |
str |
|
|
ATOM_V4_BACKEND_LAYERS |
csv int |
“” (= all) |
Comma-separated layer ids that use the new backend (others stay legacy). Empty means: apply |
Profiling & debugging
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_TORCH_PROFILER_DIR |
str |
— |
When set, enables PyTorch profiler and writes traces to this directory. Create subdirectories per rank (e.g., |
ATOM_PROFILER_MORE |
bool |
0 (false) |
When |
ATOM_LOG_MORE |
bool |
0 (false) |
If set to |
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.
Variable |
Type |
Default |
Description |
|---|---|---|---|
ATOM_FWD_DUMP_DIR |
str |
— |
Enables |
ATOM_FWD_DUMP_LAYERS |
csv int |
“” (= all) |
Comma-separated layer ids to dump (e.g. |
ATOM_FWD_DUMP_BLOCK_CLASS |
csv str |
|
Module class names to hook. Multiple values supported (e.g. |
ATOM_FWD_DUMP_LAYER_ATTR |
str |
|
Attribute name on the block carrying its index. Some non-DeepSeek models use |
ATOM_FWD_DUMP_ONE_SHOT |
bool |
1 (true) |
When |
ATOM_WEIGHT_DUMP_DIR |
str |
— |
Enables |
ATOM_WEIGHT_DUMP_LAYERS |
csv int |
|
Comma-separated layer ids to dump weights for. |
ATOM_WEIGHT_DUMP_EXIT |
bool |
1 (true) |
When |
ATOM_DEBUG_TOPK |
int |
0 |
Set to |
ATOM_DEBUG_TOPK_PATH |
str |
— |
Optional 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)
Variable |
Type |
Default |
Description |
|---|---|---|---|
OPENAI_API_KEY |
str |
— |
API key for OpenAI-compatible benchmark requests. |
VLLM_USE_MODELSCOPE |
bool |
false |
If set to |
SAVE_TO_PYTORCH_BENCHMARK_FORMAT |
bool |
false |
If 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:
Variable |
Description |
|---|---|
AITER_QUICK_REDUCE_QUANTIZATION |
Set to |
TORCHINDUCTOR_CACHE_DIR |
Set by compiler interface for inductor cache. |
TRITON_CACHE_DIR |
Set 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.