Skip to content

Reference tables

Related reference pages

The Reference section holds the full tables: Environment variables, the torch.tpu API matrix and the llm-d API reference. For the checks to run before a workload goes to production, see the Production readiness checklist.


A.1 Environment variables

Table A.1a lists the names in TorchTPU's env_vars.h (a row may group related names), A.1b the entries of vLLM-TorchTPU's envs.py, and A.1c the fields of SGLang-TorchTPU's TpuEnvs plus a selection from SGLang's environ.py. A.1d covers the TorchTitan, llm-d and tpu-agent-suite variables, flags and flag bundles that the code reads. The behaviour descriptions in A.1b and A.1c summarise the source comments. For the variables the book explains, with sources, use the environment variable reference.


Table A.1a: torch_tpu environment variables (csrc/common/env_vars.h, TorchTPU Public APIs & TorchTPU API Reference)

Only the Stable and Experimental rows are public. TorchTPU calls any API outside its public list undefined behaviour; the InternalApi and InternalImplementation rows document what TorchTPU reads and writes, not settings to build on (reference). The SymbolStage column follows kEnvVarToStage in env_vars.h.

# Environment Variable SymbolStage (kEnvVarToStage) Type Default Exact Runtime Behavior & Source Contract
1 LIBTPU_INIT_ARGS Stable flags Set by Google Cloud Space-separated libtpu and PJRT flags, including TPU compiler flags --xla_tpu_*; rejects generic XLA flags such as --xla_dump_to. Supports ${RANK} expansion via ExpandAndGetLibtpuInitArgsEnvVarOnce().
2 LOCAL_RANK Stable int Launcher-set Local device index on the current host (set by torchrun / launchers).
3 MASTER_ADDR Stable str Launcher-set Rendezvous coordinator IP/hostname for distributed initialization.
4 MASTER_PORT Stable int Launcher-set Rendezvous coordinator TCP port for distributed initialization.
5 NNODES Stable int Launcher-set Number of hosts in a multi-host job (torchrun).
6 NODE_RANK Stable int Launcher-set Index of the current host (0 .. NNODES-1) in a multi-host job.
7 RANK Stable int Launcher-set Global process rank (0 .. WORLD_SIZE-1).
8 TMPDIR Stable path System default Temporary directory used for compiler dumps and runtime artifacts.
9 TORCH_DEVICE_BACKEND_AUTOLOAD Stable bool "1" Owned by PyTorch; when "0", skips autoloading out-of-tree backends (torch_tpu._loader temporarily sets "0" during import to break cycle).
10 TPU_PREMAPPED_BUFFER_SIZE Stable int (bytes) libtpu default Size in bytes of the premapped pinned host DMA buffer in the PJRT client (e.g. 4294967296 = 4 GiB).
11 TPU_VISIBLE_DEVICES Stable csv Not stated Source of truth for TPU device visibility in torch_tpu (overwrites TPU_VISIBLE_CHIPS so libtpu honors it).
12 WORLD_SIZE Stable int Launcher-set Total number of processes in the distributed job.
13 TORCHCOMM_RANK Experimental int Falls back to RANK, then LOCAL_RANK, then 0 Process rank as seen by torchcomm; takes precedence over RANK.
14 TORCHCOMM_SIZE Experimental int Falls back to WORLD_SIZE, then 1 Total process count as seen by torchcomm; takes precedence over WORLD_SIZE.
15 TORCH_SHOW_CPP_STACKTRACES Experimental bool "0" Shared with PyTorch; when "1", appends C++ stack traces to torch_tpu error messages.
16 TORCH_TPU_ALLOW_LEGACY_DEVICE_APIS Experimental bool "false" When "1"/"true", calling internal legacy torch.tpu.* device APIs (e.g. torch.tpu.device_count) outside PyTorch emits a 1-time warning instead of raising RuntimeError.
17 TORCH_TPU_BASE_PORT Experimental int 8070 First TCP port used when deriving slicebuilder addresses for a multi-host job (base + local_rank).
18 TORCH_TPU_DEFER_AND_FUSE Experimental bool "0" When "1"/"true", enables EagerMode.DEFER_AND_FUSE (kDeferAndFuse) by default (accumulates and fuses eager ops until materialization).
19 TORCH_TPU_DEVICES_PER_HOST Experimental int nproc_per_node, else the attached device count, else 8 Number of TPU devices per host used when deriving multi-host slicebuilder addresses.
20 TORCH_TPU_ENABLE_DEBUG_CHECKS Experimental bool "0" ("1" in debug) Enables expensive device-side/eager debug assertions in torch_tpu.
21 TORCH_TPU_LAUNCH_BLOCKING Experimental bool "0" TPU equivalent of CUDA_LAUNCH_BLOCKING; sets EagerMode.DEFER_NEVER_AND_LAUNCH_BLOCKING by default.
22 TORCH_TPU_PROFILER_OUTPUT_DIR Experimental path Unset Output directory for TPU profiler XPlane files; the fallback when TpuProfilerConfig.run_dir is unset (chapter 10).
23 TORCH_TPU_SLICEBUILDER_ADDRESSES Experimental csv Auto-derived Comma-separated host:port slicebuilder addresses across all workers in a multi-host job (set_tpu_launch_env).
24 TORCH_TPU_SPMD_HANDSHAKE_STAGE Experimental str "OFF" Stage at which ranks verify identical collective graphs ("OFF", "COMPILE_STAGE", "DISPATCH_STAGE").
25 TORCH_TPU_TIER2_COMPILATION_CACHE Experimental str Auto ("default" if WS>1) Name of the host-local tier-2 cache directory under /dev/shm/torch_tpu_cache/ ("disabled" turns it off; off by default when WORLD_SIZE == 1).
26 TORCH_TPU_TIER3_COMPILATION_CACHE_ROOT Experimental path "" (disabled) Root filesystem/GCS directory for the persistent Tier-3 on-disk compilation cache.
27 TORCH_TPU_TOPOLOGY Experimental str Auto Physical TPU topology grid set by launchers (e.g. "2x2x1", "2,2,2").
28 TORCH_TPU_XPROF_SESSION_ID Experimental str Auto Shared XProf profiling session identifier across all workers of a job.
29 TORCH_TRACE Experimental path "" Enables structured compilation tracing for tlparse.
30 XLA_FLAGS Experimental flags Unset Generic XLA compiler and debug flags (--xla_dump_to, --xla_dump_hlo_as_text); rejects TPU compiler flags --xla_tpu_*. Supports ${RANK} expansion via ExpandAndGetXlaFlagsEnvVarOnce().
31 JOB_COMPLETION_INDEX InternalApi int Unset Kubernetes Indexed Job pod index; read by torch_tpu launchers to derive NODE_RANK.
32 NPROC InternalApi int Unset Set by build/test runners (e.g. Bazel) to adjust compilation thread concurrency.
33 TPU_WORKER_HOSTNAMES InternalApi csv GCE/GKE metadata Comma-separated hostnames of every worker in a multi-host TPU slice.
34 TORCH_TPU_INTERNAL_HANDSHAKE_PORT InternalApi int Auto Fixed TCP port number for the distributed SPMD handshake server.
35 TORCH_TPU_INTERNAL_HANDSHAKE_TIMEOUT_S InternalApi int 60 Seconds to wait for the distributed SPMD handshake before timing out.
36 TORCH_TPU_INTERNAL_DETECT_REPEATED_OPS InternalApi str "safe" Repeated op sequence detection mode in eager ("safe" = kSplitGraph, "aggressive" = kFullGraph).
37 TORCH_TPU_INTERNAL_DISABLE_INPLACE_BUFFER_DONATION InternalApi bool "false" When "1"/"true", disables input buffer donation for in-place ATen operations in eager mode.
38 TORCH_TPU_INTERNAL_DUMP_MLIR_PASSES_TO InternalApi str "" Dumps MLIR optimization pass IR artifacts ("print" for stdout or a directory path).
39 TORCH_TPU_INTERNAL_ENABLE_REASSOCIATE_NORM_WEIGHTS InternalApi bool "true" When "0"/"false", disables reassociating normalization weights with downstream matmuls.
40 TORCH_TPU_INTERNAL_MATERIALIZE_COLLECTIVE_TENSORS InternalApi bool "true" When "0"/"false", disables forcing graph breaks at collective ops (used in SPMD workloads where all ranks trace identical graphs).
41 TORCH_TPU_INTERNAL_SKINNY_SC_OFFLOAD InternalApi bool "0" When "1", traversals containing a single "skinny collective" are automatically pinned to the SparseCore.
42 TORCH_TPU_INTERNAL_SPLIT_RNG_STATE_UPDATE InternalApi bool "0" When "1", isolates RNG state updates into a separate compilation unit for cleaner error recovery.
43 TORCH_TPU_INTERNAL_STORAGE_AWARE_PLACEHOLDERS InternalApi bool "false" When "1"/"true", StaticCompiler creates one placeholder per shared input storage and rebuilds aliasing inputs as views.
44 TORCH_TPU_INTERNAL_USE_UNBOUNDED_DYNAMIC_KERNELS InternalApi bool "true" Loads pre-compiled unbounded dynamic kernels in eager mode instead of compiling static shapes ("0" disables).
45 TORCH_TPU_INTERNAL_XLA_OPTIONS InternalApi str "" Space-separated "key1=value1 key2=value2" overrides applied to xla::CompileOptions::env_option_overrides (takes precedence over XLA_FLAGS).
46 TORCH_TPU_INTERNAL_TOPMOST_PID InternalImplementation int Auto-set PID of the earliest torch_tpu ancestor process in the process lineage.
47 ACCELERATOR_TYPE / CLOUD_TPU_TASK_ID InternalImplementation str / int Cloud metadata Set/read by Google Cloud TPU runtime environment.
48 ALLOW_MULTIPLE_LIBTPU_LOAD / SKIP_MEGASCALE_PJRT_CLIENT InternalImplementation str Written by torch_tpu Controls libtpu.so multi-load lock and MegaScale PJRT client bypass.
49 MEGASCALE_PORT / MEGASCALE_DEBUG_PORT InternalImplementation int 8080 / 8081 (libtpu's defaults) MegaScale (DCN) port and debug server port of this process in a multi-slice job; read by libtpu.
50 TPU_CHIPS_PER_HOST_BOUNDS / TPU_CHIPS_PER_PROCESS_BOUNDS / TPU_HOST_BOUNDS / TPU_PROCESS_ADDRESSES / TPU_PROCESS_BOUNDS / TPU_PROCESS_PORT / TPU_VISIBLE_CHIPS / TPU_VISIBLE_DEVICE_PATHS InternalImplementation str Written by torch_tpu Internal libtpu / Cloud TPU slice geometry variables managed by torch_tpu launchers (GetEnvOnce static-asserts against reading InternalImplementation vars).

Table A.1b: vLLM-TorchTPU environment variables (src/vllm_torchtpu/envs.py & the environment variable reference)

Category Environment Variable Type Default Exact Runtime Behavior in vllm_torchtpu/envs.py
Core Platform, Rank Binding & Multihost JAX_PLATFORMS str "" Lowercased JAX platform selector ("tpu", "cpu", "proxy") used for CPU-only Pallas export.
TPU_ACCELERATOR_TYPE / TPU_NAME / TPU_WORKER_ID str \| None None TPU accelerator type (e.g. "v5litepod-16", "v6e-8"), resource name, and multi-host worker ID.
TPU_LIBRARY_PATH str \| None None Explicit path to prebuilt libtpu.so (takes precedence over pip libtpu package).
TPU_MULTIHOST_BACKEND str "" (auto "mp") Multihost backend ("" auto-selects "mp" when --nnodes > 1; choices: "ray", "mp").
RAY_USAGE_STATS_ENABLED / VLLM_USE_RAY_COMPILED_DAG_CHANNEL_TYPE str "0" / "shm" Ray telemetry toggle and compiled DAG channel type ("shm").
TPU_LOCAL_RANK_OFFSET / DEBUG_TPU_LOCAL_RANK_OFFSET int 0 Offset added to each worker's local rank when binding to a physical TPU chip (tpu_rank_binding.py).
VLLM_TPU_DEVICE_ORDER str "" Comma-separated physical device index per local rank (e.g. "0,2,1,3,4,6,5,7"); empty uses native order.
TORCH_TPU_BASE_PORT / TORCH_TPU_MP_RENDEZVOUS_PORT int / int \| None 8070 / None First slicebuilder port (base + local_rank) and TCPStore port for "mp" multihost rendezvous (None = vLLM coord port + 1).
Compilation, Bucketing, Precompile & Hot-Reload TORCH_TPU_TIER3_COMPILATION_CACHE_ROOT str "" Persistent on-disk TorchTPU Tier-3 compilation cache directory.
VLLM_XLA_CHECK_RECOMPILATION bool False Checks for unexpected XLA recompilations during steady-state execution.
VLLM_TPU_MOST_MODEL_LEN int \| None None Model context length cap used for TPU compile bucketing.
TPU_TOKEN_BUCKET_EXTRA list[int] [] Comma-separated extra token bucket sizes appended to the default compile bucket list.
TPU_TOKEN_BUCKET_LINEAR bool False Adds linear token buckets above one quarter of the token budget for prompt-sized steps.
TPU_PARALLEL_PRECOMPILE bool False Rotates bucket precompilation across local host ranks to accelerate server startup.
TPU_PRECOMPILE_BIGGEST_FIRST bool False Under TPU_PARALLEL_PRECOMPILE, compiles largest token buckets first so rank 0 starts on the heaviest graph.
TPU_PRECOMPILE_PEER_REPLAY / TPU_PRECOMPILE_PEER_WAIT_S bool / float False / 600.0 One owner rank per host compiles each bucket while peer ranks wait up to PEER_WAIT_S seconds and replay the cached artifact.
TPU_PRECOMPILE_TRACE_FIRST bool False Traces all shape-specialized token-bucket groups before compiling any bucket so all ranks compile in parallel.
TPU_KERNEL_ITER_MODE / TPU_KERNEL_RELOAD_MODULES bool / str False / "" Splits compiled graph at Pallas custom ops, excludes kernel sources from compile-cache key, and enables /reload_kernel hot-reloading.
Scheduling (SRPT, DP, Pipeline Parallelism) DP_SCHED_ENABLED bool False Enables TpuDpScheduler for Data-Parallel load balancing.
VLLM_TPU_SRPT_MAX_CONSECUTIVE_HOLDS int 8 SrptPrefillScheduler: max consecutive steps a prefill chunk can be held back without getting 1 KV block before promotion (0 = off).
VLLM_TPU_SRPT_ATTN_WORK_CAP / VLLM_TPU_SRPT_ATTN_TILE_TOKENS int 0 / 32 SrptPrefillScheduler: caps attention work \(\sum n(\text{ctx} + n/2)\) while any DP rank decodes, rounding shrunk chunks down to multiples of TILE_TOKENS.
TPU_PP_DYNAMIC_CHUNKS / TPU_PP_CHUNK_SLACK bool / float True / 0.1 Pipeline Parallelism: sizes prefill chunks by a per-step time budget (pp_chunks.py) with CHUNK_SLACK headroom (0 keeps token budgets).
TPU_PP_LAZY_PUSH bool False For PP \(> 2\) stages: pushes the pipeline only when stage 0 would otherwise idle and drops empty steps (pp_lazy_step.py).
TPU_PP_HANDOFF / TPU_PP_RING_DEPTH str / int "wave" / 2 PP stage activation handoff mode ("wave" collective launch vs "ring" P2P send with queue depth TPU_PP_RING_DEPTH).
Attention (RPA v3, MLA, Sparse MLA / DCP, GDN, KDA) USE_RPA_PIPELINED_DMA_STAGING / USE_PIPELINED_DMA_STAGING bool False Enables pipelined double-buffered DMA staging in ragged_kv_cache_update and fused query DMA layout in RPA v3.
MIXED_Q_SPLIT / MIXED_NUM_QUERIES_PER_BLOCK / MIXED_NUM_KV_PAGES_PER_BLOCK int \| None None Overrides query split, b_q, and b_kv_pages block sizes for mixed prefill+decode RPA steps.
MLA_XPOSE_N_TILE_SIZE int 160 Tile size for the MLA transpose pipeline.
TPU_SPARSE_MLA_NOPE_LAYOUT / TPU_SPARSE_MLA_ROPE_LAYOUT str "sparsecore" KV cache layouts allocated for sparse MLA ("sparsecore" or "tensorcore").
TPU_SPARSE_MLA_DCP_FUSED_Q_GATHER / TPU_SPARSE_MLA_CHUNK_TOKENS bool / int \| None True / None (64) Fused query gather for DCP sparse MLA and query-token chunk size (num_tokens / chunk gather+attention pairs per layer).
TPU_MLA_SPARSE_SPLIT_Q bool False Passes q_nope and q_pe separately to sparse_ragged_paged_attention (joins in VMEM and exports lane-dense f32[T, H] LSE).
TPU_MLA_MASKED_DENSE_ENABLED / TPU_MLA_MASKED_DENSE_ANALYTIC_MAX_KV_LEN / TPU_MLA_MASKED_DENSE_MAX_KV_LEN bool / int \| None False / None Routes GLM-5.2 eligible prefill steps up to MAX_KV_LEN through register-analytic or SparseCore-bitmap masked-dense MLA instead of sparse gather.
TPU_DCP_MLA_TOPK_CAP / TPU_DCP_MLA_TOPK_CAP_CHUNK int 0 / 256 DCP sparse MLA: gathers at most TOPK_CAP slots per token in chunks of TOPK_CAP_CHUNK query tokens (0 = off).
TPU_DCP_LSE_MERGE_A2A / TPU_DCP_LSE_MERGE_A2A_MAX_TOKENS / TPU_DCP_RS_OUT_PRECISION bool / int / bool False / 64 / True Uses all-to-all DCP MLA LSE merge for steps \(\le 64\) tokens and reduce-scatters backbone outputs in bf16 (RS_OUT_PRECISION=True).
TPU_DCP_INDEXER_A2A_MERGE / TPU_DCP_INDEXER_A2A_MIN_TOKENS bool / int False / 64 Merges DCP indexer candidates via token-axis all-to-all instead of candidate-axis all-gather for buckets \(\ge 64\) tokens.
TPU_STREAMIDX_CHUNK_TOKENS / TPU_STREAMIDX_SMALL_BUCKET_BQ / TPU_STREAMIDX_SMALL_BUCKET_BKVP / TPU_STREAMIDX_SMALL_BUCKET_TOKENS int \| None / int None / None / None / 64 GLM-5.2 / DSv4 StreamIndex top-k token chunking (overlaps SparseCore top-k with TensorCore scoring) and small-bucket MIXED block overrides (recommended BQ=4).
VLLM_TPU_INDEXER_KV_CACHE_MODE str "sal" Indexer K-cache writer & layout mode for StreamIndex ("sal" = SEQ_ALONG_LANE, "has" = HEAD_ALONG_SUBLANE, "xla" = .at[].set).
TPU_GDN_CONV_QK_PAIR_LAYOUT / TPU_GDN_QKVZ_KERNEL_LAYOUT / TPU_ENABLE_GDN_DYNAMIC_TILING bool False Gated DeltaNet QK pair-blocked conv layout, (k, n) matmul layout for in_proj_qkvz, and VMEM-derived dynamic decode/prefill tiling (kernels/gdn/v3/tiling.py).
KDA_MANUAL_STATE_DMA / KDA_MANUAL_H0_DMA / KDA_MANUAL_HT_DMA / KDA_OVERLAP_H0_DMA / KDA_OVERLAP_HT_DMA / KDA_PACK_HEAD_INV / KDA_PACKED_METADATA / KDA_FWD_MB bool \| None / int \| None None / True / None Kimi-K3 KDA kernel manual/overlapped H0/HT/state DMA staging, packed head inverse/metadata, and forward microbatching knobs.
TPU_K3_SP_PREFILL / TPU_LATENT_PROJ_INTRA_CHIP_TP / TPU_DSV4_ATTN_INTRA_CHIP_TP / TPU_DSV4_HONOR_CONTINUE_FINAL_MESSAGE bool False Kimi-K3 TP32/EP32 sequence-parallel prefill, intra-chip TP sharding for K3 latent projections or DSv4 wq_b/wo_a/wo_b, and DSv4 tokenizer continue_final_message.
TPU_ROPE_CACHE_TRUNCATE / TPU_ROPE_CACHE_ROW_MAJOR bool False Slices rotary cos_sin cache to max_model_len at load or materializes it in row-major {1,0} layout.
MoE, SparseCore & Collectives USE_MOE_SPARSE_CORE / RAGGED_GATHER_REDUCE_VERSION bool / str True / "v2" Selects SparseCore MoE ragged gather + gather-reduce path and combine kernel version ("v1", "v2", "v3").
ONEHOT_MOE_PERMUTE_THRESHOLD / TPU_MOE_OWNER_OUTPUT_MODE / TPU_MOE_DENSE_EXPERT_THRESHOLD int \| None / str / int None (auto) / "off" / 0 One-hot matmul permute threshold (num_tokens * topk), blockwise owner-output kernel ("off"/"on"), and dense expert MoE token threshold.
FUSED_MOE_DECODE_KERNEL / FUSED_MOE_DECODE_KERNEL_MAX_TOKENS / USE_MOE_TP_DECODE_KERNEL bool / int / bool False / 256 / False Single-Pallas-call fused MoE decode kernels folding routed experts + shared expert + TP all-reduce for small token steps.
USE_MOE_FUSED_EP_KERNEL / MOE_FUSED_EP_KERNEL_IMPL / MOE_FUSED_EP_ENABLE_W4A8 / MOE_FUSED_EP_KERNEL_MIN_TOKENS / MOE_FUSED_EP_V2_SHARDED_PLAN / MOE_FUSED_EP_SORTED_GATHER / MOE_FUSED_EP_V2_HEIGHT_RUNGS_OVERRIDE bool / str \| None / int False / None ("v2", "adaptive") / 1024 / 0 Whole-layer SPMD Pallas Expert-Parallel MoE kernel overlapping cross-rank transport with expert matmuls (adaptive auto-enables NVFP4/W4A8).
TPU_MOE_SINGLE_SORT / TPU_MOE_COUNTING_SORT / TPU_MOE_ROUTER_TOPK / TPU_MOE_TOPK_WEIGHTS_FLOAT32 bool / str True / True / "rowmax" / False Packed single sort, MXU counting sort, sort-free "rowmax" vs "sort" router top-k, and FP32 routing weights for RL/MaxText parity.
TPU_MOE_SKIP_PADDED_TOKENS / TPU_MOE_HIERARCHICAL_EP / TPU_MOE_SEQUENCE_PARALLEL / TPU_ATTN_MOE_OVERLAP bool False Skips padded tokens in MoE, enables inter-chip EP + intra-chip TP, shards tokens over TP between attention and MoE, or folds attention reduce-scatter into MoE all-reduce.
TPU_MOE_COLLECTION_CHUNK_SIZE / TPU_MOE_FP8_ALL_GATHER / TPU_MOE_HASH_TABLE_ROW_MAJOR int / bool 0 / False Post-gather MoE token chunking, FP8 activation quantization before DP/PCP all-gather, and row-major MoE hash table layout.
SC_ALLREDUCE_ALLGATHER_OFFLOAD_MIN_BYTES / TPU_PCP_TOPOLOGY_AWARE_MESH int \| None / bool None (auto) / True Minimum byte threshold for SparseCore collective offload and topology-aware device mesh ordering for PCP.
Quantization & Weight Loading ENABLE_QUANTIZED_MATMUL_KERNEL / REQUANTIZE_BLOCK_SIZE / REQUANTIZE_WEIGHT_DTYPE bool / int \| None / str False / None / "float8_e4m3fn" Enables blockwise Pallas quantized matmul kernel and runtime weight requantization block size/dtype for dense linears.
TPU_FP8_LINEAR_W8A16_MAX_ROWS int 0 Keeps bf16 activations against FP8 weights (W8A16) for padded token buckets \(\le\) MAX_ROWS on TPU v7x (0 keeps W8A8 everywhere).
MOE_REQUANTIZE_WEIGHT_DTYPE / MOE_REQUANTIZE_BLOCK_SIZE str / int \| None "float8_e4m3fn" / None Runtime requantization dtype and block size for MoE expert weights.
QUANTIZE_ON_LOAD_PREFIXES / VLLM_TPU_MXFP4_DEVICE_DEQUANT list[str] / bool [] / True Comma-separated module prefixes quantized to FP8 at load, and on-TPU MXFP4 expert weight dequantization.
TPU_EVICT_WEIGHTS_PAGE_CACHE / TPU_SHARDED_LOAD_SYNC_EVERY bool / int False / 512 Evicts OS page cache (posix_fadvise) after weight load and syncs device every \(N\) tensors during sharded EP loading.
Raiden, KV Transfer & Offloading TPU_VLLM_ENABLE_UNIFIED_BLOCK_POOL / VLLM_TPU_BLOCK_MAJOR_KV bool \| None / bool None (auto) / False Tri-state unified block-pool cache layout for hybrid models and single-DMA block-major KV cache layout for Raiden offloading.
TPU_USE_RAIDEN_KV_CACHE_MANAGER / TPU_USE_RAIDEN_CONNECTOR bool False Enables Raiden KVCacheManager pool manifest registration and Raiden KV transfer connector.
TPU_RAIDEN_QWEN35_ADMISSION / TPU_RAIDEN_KIMIK3_ADMISSION / TPU_RAIDEN_GLM_ADMISSION / TPU_RAIDEN_DSV4_ADMISSION / TPU_RAIDEN_POOL_TAGS_PER_LAYER bool False Model-specific Stage-3 shared hybrid-pool admission gates and per-layer pool tagging for PP producers.
TPU_KV_RESHARD_TRANSPORT / TPU_RAIDEN_RESHARD_IMPL str "zmq" / "controller" Controller-driven PCP\(\rightarrow\)DP reshard transport ("zmq" or "raiden") and control-plane hosting ("controller" sidecar vs in-process "store").
TPU_RAIDEN_CONTROLLER_ADDRESS / TPU_RAIDEN_JOB_NAME / TPU_RAIDEN_ENGINE_ID / TPU_RAIDEN_ADVERTISE_HOST / TPU_RAIDEN_RESHARD_PORT_BASE / TPU_RAIDEN_STORE_DISPATCH_PORT_BASE str / int "" / "0" / 27000 / 27100 Raiden controller/store endpoint configuration and deterministic port bases (BASE + dp_rank).
TPU_RAIDEN_TRANSFER_PARALLELISM / TPU_RAIDEN_DST_SHARDS / TPU_RAIDEN_MAX_TRANSFER_TOKENS / TPU_RAIDEN_TRANSFER_NUM_SLOTS / TPU_RAIDEN_POOL_STAGING_LEASES / TPU_RAIDEN_INLINE_LOAD / TPU_RAIDEN_PREFIX_AWARE_LOAD int / bool 8 / None / None / 0 / 8 / False / False Raiden transfer concurrency, destination TP shard count, staging slot/lease limits, inline pre-forward KV load, and prefix-cache-aware delta suffix load (dst_skip_bytes).
TPU_RAIDEN_STAGE3_STATUS_PROBE_S / TPU_RAIDEN_STAGE3_DEFERRED_SUBMIT / TPU_RAIDEN_STAGE3_REGISTER_AHEAD / TPU_RAIDEN_STAGE3_REGISTRATION_WAIT_S / TPU_RAIDEN_TEST_REGISTRATION_DELAY_S float / bool 1.0 / True / True / 30.0 / 0.0 Stage-3 producer/consumer registration timing, register-ahead in prompt completion step, and deferred submit knobs.
TPU_KV_TRANSFER_PORT / TPU_SIDE_CHANNEL_PORT / TPU_NODE_ID / TPU_KV_TRANSFER_CHANNEL_NUMBER / TPU_KV_COORD_EXECUTOR_MAX_WORKERS / TPU_KV_CHANNEL_EXECUTOR_MAX_WORKERS / TPU_KV_STAGE_WAITER_POOL_SIZE str / int "9100" / "9600" / 0 P2P KV wire port, side-channel port, host ordinal, and pull/waiter thread-pool worker counts (0 = auto).
TPU_P2P_WAIT_PULL_TIMEOUT / TPU_KV_STAGE_WAIT_TIMEOUT_SECS / TPU_KV_SHM_POOL_GB / TPU_KV_PIN_SHM / TPU_KV_WARMUP_ENABLED / TPU_KV_LATENCY_LOG_INTERVAL / TPU_KV_TRANSFER_NAMESPACE / TPU_IPC_SOCKET_DIR / VLLM_TORCHTPU_IPC_KEY int / float / bool / str 120 / 30.0 / 128.0 / False / True / 30.0 / "" / "/tmp" / "" KV transfer timeouts, 128 GiB host SHM staging budget (mlock via PIN_SHM), startup gather/scatter warmup, and IPC socket namespace/secret.
RAIDEN_DISABLE_SINGLETON_WORKER / RAIDEN_SHM_KEY / RAIDEN_STORAGE_PATH / RAIDEN_STORAGE_TYPE / RAIDEN_STORAGE_CAPACITY_GB / RAIDEN_STORAGE_PROPERTIES / EXPERIMENTAL_RAIDEN_STORAGE_SKIP_PARALLELISM_CHECK / VLLM_TPU_OFFLOAD_WAIT_TIMEOUT_S / VLLM_TPU_OFFLOAD_SAVE_RETRIES bool / str / float / int True / "" / 30.0 / 1 Raiden 3rd-tier storage offload behind host DRAM (posix backend, direct_io, metadata_cache_max_entries) and scheduler drain timeouts.
Speculative Decoding, Sampling, Multimodal & Profiling SPEC_WARMUP / TPU_SPEC_STATIC_VERIFY / VLLM_TPU_FUSED_DRAFT_LOOP / VLLM_TPU_FAST_TOKEN_SUBSTITUTION / VLLM_TPU_DISABLE_EAGLE_BLOCK_DROP bool True / True / False / False / False Speculative decoding startup warmup, static verify window attention pass, single-program fused MTP draft loop (1..K-1), device-sliced fast token substitution, and EAGLE prefix-block retention.
TPU_GREEDY_TOP_TOKENS / TPU_SAMPLER_TOPK_CANDIDATES bool / int False / 0 Vocabulary-parallel greedy argmax (greedy_top_tokens.py) and 128-logit block max pre-filtering before top-k/top-p sampling.
MM_ENCODER_FRAME_CHUNK_PATCH_SIZE / VLLM_TPU_STATIC_POOLER / VLLM_TPU_POOLING_KV_CACHE_TOKENS int / bool 0 / True / -1 Video frame patch chunking (t*h*w) to bound ViT VMEM, AOT-compiled static embed pooler (LAST/CLS/MEAN), and pooling KV token cap.
PYTHON_TRACER_LEVEL / HOST_TRACER_LEVEL / DEVICE_TRACER_LEVEL / TPU_TRACE_MODE / TPU_NUM_SPARSE_CORES_TO_TRACE / TPU_NUM_SPARSE_CORE_TILES_TO_TRACE / USE_PHASED_PROFILER / VLLM_TPU_DEBUG_PCP_LAYOUT int / str / bool 1 / 2 / 1 / "TRACE_COMPUTE" / 1 / 1 / False XProf Python/Host/Device/SparseCore tracer levels, trace mode (TRACE_COMPUTE, TRACE_COMPUTE_AND_SYNC), per-phase trace capture (USE_PHASED_PROFILER), and PCP layout logging.

Table A.1c: TpuEnvs fields and selected SGLANG_* variables in sglang-torchtpu (sglang_tpu/envs.py TpuEnvs & python/sglang/srt/environ.py)

Category Environment Variable Type Default Exact Runtime Behavior in TpuEnvs / environ.py
Platform, Host Memory & Core environ.py Knobs SGLANG_PLATFORM str "" "tpu" selects TpuSRTPlatform; "tpu_oot" selects the out-of-tree TpuOOTPlatform (sparse attention is served only under "tpu").
SGLANG_TPU_REQ_TO_TOKEN_ON_HOST / SGLANG_TPU_ASYNC_COPY_WORKER / SGLANG_TPU_MM_EMBED_ON_DEVICE bool True / True / False Keeps req_to_token on CPU (mandatory for host padding/CP/DCP), offloads D2H/KV copies to async threads, and stages multimodal scatter on host.
SGLANG_TPU_ENABLE_ROPE_CACHE_SLICE / SGLANG_TPU_INT4_MOE_MODE / SGLANG_TPU_ENABLE_CONTIGUOUS_FLOAT_LOGITS / SGLANG_TPU_PD_COLOCATED bool / str \| None False / None / True / False Slices RoPE cache to context_length, selects INT4 MoE mode (None, "vmem-bf16", "vmem-fp8"), materializes contiguous float logits, or splits slice 50/50 for colocated P/D.
SGLANG_TPU_BENCHMARK_BATCH_SIZE / SGLANG_TPU_BENCHMARK_TIMEOUT_SEC int / float 0 / 600.0 Opt-in request-tagged benchmark batch admission gate (benchmark_batch_gate.py).
SGLANG_TPU_RELEASE_CHECKPOINT_PAGE_CACHE / SGLANG_TPU_RELEASE_COMPILE_ARTIFACTS bool True Evicts OS page cache for checkpoints and tmpfs compiler artifacts before server readiness (page_cache.py).
SGLANG_TPU_MALLOC_TRIM_AFTER_WARMUP_ENABLED / SGLANG_TPU_MALLOC_TRIM_INTERVAL_SEC bool / float True / 0.0 Clears JAX export caches, runs gc.freeze(), and invokes malloc_trim after warmup (and periodically if INTERVAL_SEC > 0).
SGLANG_TPU_ENABLE_SCHEDULER_THREAD_PINNING bool False Pins each scheduler's main thread to a dedicated physical CPU core (hooks/cpu_pinning.py).
SGLANG_TPU_TOPOLOGY_BOOTSTRAP_PORT int \| None None Multi-host node normalization discovery store port (None = --dist-init-addr port + 1).
Attention, KV Pool Layouts & Vision SGLANG_TPU_KV_PACK_HEADS bool False Packs a rank's KV heads side-by-side in one 128-lane row when they fit (e.g. \(2 \times 64\)), halving zero-padding bytes.
SGLANG_TPU_USE_BLOCK_MAJOR_KV bool False Allocates RPA v3 MHA KV as [num_blocks, layer_num, page_size, ...] so all layers of a page transfer in a single Raiden DMA.
SGLANG_TPU_USE_SEQ_ALONG_LANE_KV bool False Uses SEQ_ALONG_LANE KV layout (TpuSeqAlongLaneKVPool) on pallas_tpu_rpa_batched (256 B/token FP8 at 1 KV head/rank).
SGLANG_TPU_FORCE_RPA_PREFILL_BKV / SGLANG_TPU_WORKLOAD_AWARE_KV_TILES int \| None / bool None / False Overrides VMEM-derived k-block size in RPA prefill/mixed kernels or enables runtime KV-tile promotion (1024/2048).
SGLANG_TPU_ENABLE_QBLOCK_SPARSE_MLA_PREFILL bool False Routes 512+ token pooled-DSA prefill batches through query-blocked mla_sparse_qblock.py.
SGLANG_TPU_ENABLE_ATTN_METADATA_CACHE / SGLANG_TPU_ENABLE_HOST_QUERY_LENS bool True Reuses uploaded attention metadata across forwards and reads extend query lengths from a host mirror instead of device D2H.
SGLANG_TPU_ENABLE_VISION_SPLASH_ATTENTION / SGLANG_TPU_VISION_FLASH_BLOCK_Q / SGLANG_TPU_VISION_FLASH_BLOCK_Q_MAX_SEQ / SGLANG_TPU_VISION_FLASH_BAND_SKIP bool / int False / 0 / 4096 / False Vision encoder block-skipping Splash attention, custom Q-tile size up to MAX_SEQ, and band-skip Pallas FlashAttention.
SGLANG_TPU_VIT_PRECOMPILE_SIZES / SGLANG_TPU_VIT_MAX_PRECOMPILE_PATCHES / SGLANG_TPU_VIT_NUM_PRECOMPILE_BUCKETS tuple / int / int \| None () / 4900 / None Vision-encoder precompile patch ladder, max patch cap, and bucket rung count override.
MoE, Linear Kernels & Collectives SGLANG_TPU_FUSED_MOE_SC_GATHER / SGLANG_TPU_FUSED_MOE_SC_GATHER_MIN_ROWS / SGLANG_TPU_FUSED_MOE_PERMUTE_DENSE_THRESHOLD bool / int True / 0 / 0 Offloads MoE gather/scatter to SparseCore, routes \(< \text{MIN\_ROWS}\) (~1024) to TensorCore, or uses one-hot dense matmul + sort-free rank route below DENSE_THRESHOLD.
SGLANG_TPU_FUSED_MOE_DECODE_MAX_TOKENS int 256 Max decode batch tokens for --moe-runner-backend pallas_tpu_fused_decode before falling back to gmm_v2.
SGLANG_TPU_ENABLE_SINGLE_TOKEN_MOE_KERNEL / SGLANG_TPU_ENABLE_STREAMING_MOE_KERNEL / SGLANG_TPU_ENABLE_ROUTER_TOPK_KERNEL bool True / False / True Fused 1-token MXFP4 decode MoE (single_token_moe.py), 1..8 token streaming FP8 MoE (moe_stream.py), and Pallas biased sigmoid router top-k (router_topk.py).
SGLANG_TPU_ENABLE_FP8_LINEAR_SMALL_M_KERNEL bool False Uses kernels/fp8_linear_small_m.py W8A8 Pallas kernel for decode-sized batches.
SGLANG_TPU_FP8_MOE_FP32_SCALES / SGLANG_TPU_INT4_MOE_FP32_SCALES / SGLANG_TPU_FP8_MOE_COMPACT_SCALES / SGLANG_TPU_FP8_MOE_COMPACT_W1_SCALES / SGLANG_TPU_FP8_MOE_COMPACT_W2_SCALES bool False Preserves FP32 expert scales in FP8/INT4 MoE and compacts W1/W2 scale tensors.
SGLANG_TPU_DISABLE_EP_LOCAL_EXPERT_READS / SGLANG_TPU_LIBTPU_WORKAROUND_FOR_ONLINE_QUANT_SCALE bool False / True Disables EP-local expert shard reads and enables libtpu 0.0.46/47 online quant scale workaround.
SGLANG_TPU_ENABLE_TWOLEVEL_ALLREDUCE bool False Uses two-level one-shot Pallas all-reduce (host-local then cross-host) for 1-token TP decode (twolevel_allreduce.py).
Whole-Decoder Megakernels (Kimi-K3, GLM-5.3-Flash, Muse) SGLANG_TPU_ENABLE_K3_DECODE_MEGAKERNEL / SGLANG_TPU_OPT_K3_MEGAKERNEL_RELAX / SGLANG_TPU_K3_MEGAKERNEL_KERNEL_OPTS / SGLANG_TPU_K3_MEGAKERNEL_PREFILL / SGLANG_TPU_K3_MEGAKERNEL_VERIFY / SGLANG_TPU_K3_MEGAKERNEL_EXPERT_LOAD_PROCS / SGLANG_TPU_K3_MEGAKERNEL_EXPERT_LOAD_SLOTS / SGLANG_TPU_K3_MEGAKERNEL_KEEP_SGLANG_WEIGHTS bool / tuple / str / int False / () / "" / "auto" / "rows" / 8 / 4 / False Kimi-K3 StackKernel megakernel (k3_megakernel/), numeric relaxations, SERVING_KERNEL_OPTIONS (moe_ring, wire_relax), prefill/verify modes ("auto", "rows", "loop"), parallel expert loader procs/slots, and A/B weight retention.
SGLANG_TPU_K3_STATIC_FP8 / SGLANG_TPU_ENABLE_K3_STATIC_FP8_PALLAS_GEMV / SGLANG_TPU_ENABLE_K3_HOST_SPLIT_GEMV / SGLANG_TPU_ENABLE_K3_ATTN_RES_KERNEL tuple / bool () / True / False / False Kimi-K3 static-scale W8A8 decode GEMVs (moe_front,latent_up,kda_qkvg,mla_qkv_a or "all"), Pallas GEMV kernel, intra-host column-split GEMV, and fused attention-residual aggregation kernel.
SGLANG_TPU_GLM_FLASH_MEGAKERNEL / SGLANG_TPU_GLM_FLASH_MEGAKERNEL_MAX_LEN / SGLANG_TPU_ENABLE_GLM5_NEXT_FUSED_MHC bool / int \| None False / None / False GLM-5.3-Flash single-request decode/MTP verify Pallas megakernel (glm_flash_megakernel/) and fused Pallas mHC kernel (mhc.py).
SGLANG_TPU_MUSE_MEGAKERNEL / SGLANG_TPU_ENABLE_MUSE_BF16_FIRST_LAST_LAYER_EXPERTS bool False Muse Spark whole-decoder Pallas megakernel (muse_megakernel/) and BF16 expert preservation for first/last layers on NVFP4 checkpoints.
Speculative Decoding SGLANG_TPU_HOST_PADDING_NO_D2H / SGLANG_TPU_ENABLE_EXPERIMENTAL_SPEC_WORKER bool True Keeps speculative metadata on host and routes DFLASH/DSPARK to TpuBlockSpecWorker and MTP/EAGLE3 to TpuChainSpecWorker.
SGLANG_TPU_SPEC_RANK_CHECK_INTERVAL / SGLANG_TPU_SPEC_BLOCK_VERIFICATION / SGLANG_TPU_PD_DECODE_DRAFT_PREFILL / SGLANG_TPU_DFLASH_FP8_DRAFT int / bool 8192 / False / False / False Cross-rank committed token digest verification interval, Sun et al. 2024 Algorithm 2 block verification, PD target hidden-state transfer (pd_hidden_pool.py), and DFlash FP8 weight-only decode draft linears.
Raiden (tpu-sync) & ZMQ-Push Disaggregation / HiCache SGLANG_RAIDEN_KV_PORT / SGLANG_TPU_RAIDEN_TRANSFER_PARALLELISM / SGLANG_RAIDEN_PUSH_WORKERS int 31000 / 4 / 1 Base Raiden control/data port (base + 6 * local_rank), TCP connections per rank pair, and reshard push worker threads.
SGLANG_RAIDEN_HOST_POOL_GB / SGLANG_TPU_RAIDEN_STAGING_LAYERS / SGLANG_RAIDEN_MAX_BLOCKS / SGLANG_RAIDEN_SWA_MAX_BLOCKS / SGLANG_RAIDEN_MAX_MODEL_LEN / SGLANG_RAIDEN_RETRACT_HOST_GB float / int 24.0 / 8 / 0 / 0 / 8192 / 0.0 Per-node host staging DRAM budget, layer buffer count (0 = full mirrors), max pages per request, context fallback, and retraction pinned-host budget.
SGLANG_RAIDEN_DYNAMIC_HOST_STAGING (alias TPU_RAIDEN_DYNAMIC_HOST_STAGING) / SGLANG_RAIDEN_LISTENER_START_READ / SGLANG_RAIDEN_CHUNK_TRANSFER_TIMEOUT_S (alias SGLANG_RAIDEN_TIMEOUT_S) / SGLANG_TPU_RAIDEN_DMA_TIMEOUT_S bool / float True / True / 60.0 / 60.0 Dynamic host-pool page staging (required for asymmetric TP), immediate listener read start, per-chunk transfer deadline, and Raiden KV-offload DMA timeout.
SGLANG_RAIDEN_PIPELINE_TRANSFER / SGLANG_RAIDEN_PIPELINE_EARLY_PARTS / SGLANG_RAIDEN_PIPELINE_PART_PAGES / SGLANG_RAIDEN_PIPELINE_STAGE_PARTS / SGLANG_RAIDEN_PIPELINE_STAGE_GROUP / SGLANG_RAIDEN_PIPELINE_COORD_WORKERS / SGLANG_RAIDEN_PIPELINE_EARLY_CLOSE bool / int False / False / 16 / False / 1 / 1 / False Pipeline-parallel prefill \(\rightarrow\) DP/TP/PP decode KV transfer and early page/stage/close overlap controls.
SGLANG_TPU_HICACHE_WRITE_BACK_COPY_AHEAD_TOKENS int \| None None (4 chunks) Tokens of next eviction victims copied ahead to host on Raiden write_back (0 = synchronous backup).
SGLANG_DEBUG_TPU_KV_STATS_EVERY / SGLANG_TPU_KV_ASYNC / SGLANG_TPU_KV_CHANNELS / SGLANG_TPU_ENABLE_DISAGGREGATION_PERFETTO_TRACING int / bool 100 / True / 2 / False ZMQ-Push (--disaggregation-transfer-backend tpu) latency summary interval, async prefill D2H, parallel ZMQ push streams, and Perfetto tracing.
SGLANG_TPU_PP_DYNAMIC_CHUNKS / SGLANG_TPU_PP_CHUNK_SLACK bool / float True / 0.1 Pipeline-parallel time-budgeted prefill chunking and slack fraction.
Compilation, Sampling & Profiling SGLANG_TPU_EAGER_MODE / SGLANG_TPU_ENABLE_NN_MODULE_GUARD_FILTER / SGLANG_TPU_SHARED_COMPILE_COST_PROFILE str / bool "DEFER_NEVER" / False / "" TorchTPU eager mode, post-warmup nn.Module Dynamo guard filtering, and --use-spmd-compile trace-cost profile JSON.
SGLANG_TPU_CHECK_RECOMPILATION / SGLANG_TPU_CHECK_RECOMPILATION_SITES / SGLANG_TPU_ALLOW_SPEC_RECOMPILE bool False Arms post-warmup recompilation counter, attributes eager compiles to source lines (~9 us/op), or permits speculative recompiles.
SGLANG_TPU_ENABLE_PROMPT_LOGPROB / SGLANG_TPU_LOGPROB_GRID_ROWS / SGLANG_TPU_FOUR_STAGE_LOGIT_ROWS bool / int False / 0 / False Enables compiled input logprobs (CaptureHiddenMode.FULL), grid-aligned eager logprob chunking, and 4-stage ForwardBatch.logit_rows.
SGLANG_TPU_ENABLE_BSEARCH_SAMPLING / SGLANG_TPU_DISTRIBUTED_TOP_K_MIN_BATCH_SIZE / SGLANG_TPU_PADDED_LOGITS_SAMPLING bool / int True / 64 / False Sort-free binary-search top-k/top-p/min-p cutoff, batch cutoff for Pallas distributed TopK, and power-of-two padded logits repetition penalty/greedy argmax.
SGLANG_TPU_ENABLE_PROFILE_AUTO / SGLANG_TPU_PROFILE_AUTO_STEPS / SGLANG_TPU_PROFILE_NUM_CHIPS / SGLANG_TPU_PROFILE_NUM_SPARSE_CORES / SGLANG_TPU_PROFILE_PYTHON_TRACER bool / int False / 5 / 1 / 1 / False Automatic launch-time XProf stage capture (profile_auto.py) and per-task chip/SparseCore/Python tracer scope.

Table A.1d: TorchTitan, llm-d and tpu-agent-suite variables, flags and flag bundles

Subsystem / Repo Variable, flag or bundle Default Purpose & effect (source)
TorchTitan (tpu_flags.py) LIBTPU_INIT_ARGS, XLA_FLAGS Rendered from the config The trainer config carries libtpu_init_flags and xla_flags fields; apply_init_flags exports them "before any TPU device is used". Precedence: the config's set, then --extra-libtpu-init-flags / --extra-xla-flags on the command line (!flag drops one), then an exported variable, which "has the last word"
Flag bundles (Python FlagMap constants, not environment variables): SPARSECORE_LATENCY_HIDING_SCHEDULER, DUAL_SPARSECORE_REDUCE_SCATTER, HIERARCHICAL_REDUCE_SCATTER, SELECTIVE_ICI_RS_PIPELINING, ICI_AG_PIPELINING, SPARSECORE_ASYNC_ALL_GATHER, CONVOLUTION_UNFUSING, SPARSECORE_COLLECTIVE_OFFLOAD, TPU7X_THROUGHPUT_P_STATE, DISABLE_ENHANCED_LAUNCH_BARRIER Off unless a recipe composes them with merge_flags "Groups of flags that only make sense together". For example ICI_AG_PIPELINING is xla_tpu_enable_ici_ag_pipelining=true, and HIERARCHICAL_REDUCE_SCATTER sets three SparseCore reduce-scatter flags ("available in libtpu 0.0.47 and newer")
TORCH_DEVICE_BACKEND_AUTOLOAD Unset TORCH_DEVICE_BACKEND_AUTOLOAD=0 "unregisters the TPU backend", so the run lands on the CPU; gmain.py's --device only checks the detected device (gmain.py)
MEGASCALE_NUM_SLICES, MEGASCALE_SLICE_ID, TPU_WORKER_ID, TPU_WORKER_HOSTNAMES MEGASCALE_NUM_SLICES defaults to "1" Read by cloud_distributed_utils.py to identify multi-slice jobs and the worker's place; MEGASCALE_SLICE_ID is optional in the launcher
NGPU, MODULE, CONFIG, LOG_RANK, TORCHFT_LIGHTHOUSE 8, llama3, llama3_debugmodel, 0, http://localhost:29510 Variables of the generic run_train.sh launcher
WANDB_PROJECT, WANDB_TEAM, WANDB_RUN_NAME torchtitan, unset, unset Weights & Biases metadata (components/metrics.py)
llm-d EPP (router configuration) --config-file, --config-text One is required The EndpointPickerConfig (llm-d.ai/v1), read once at startup; a change needs a restart (reference)
--pool-name Set by the chart The InferencePool the EPP serves; the pool-saturation metric's inference_pool label carries it (KEDA with EPP Metrics)
Ports 9002 ext_proc gRPC, 9090 metrics The ext_proc port appears in the gRPC API and non-Kubernetes deployment docs; the EPP's Prometheus endpoint is on port 9090 at /metrics (Configuration)
tpu-agent-suite (repository) TPU_AGENT_SUITE_HOME ~/.tpu-agent-suite/ Root of the central store; "a test-isolation seam, not a relocation feature" (framework/utils.py)
TPU_AGENT_SUITE_DISABLE_SCHEMA_VERIFIERS Unset Turns off schema validation of requests and results; leave it unset (framework/runtime.py)

A.2 torch.tpu public API summary

The full matrix, with signatures, what each call does and the chapter that teaches it, is the torch.tpu API matrix. TorchTPU Public APIs warns: "Using any other TorchTPU API is undefined behavior and unsupported." This summary lists nothing else.

Group Public names Stage Full table
Devices torch.accelerator.{current_accelerator, is_available, device_count, current_device_index, set_device_index, device_index}; torch.tpu.{is_initialized, get_device_properties, device_of} Stable; Experimental Device queries
Memory torch.accelerator.{memory_allocated, max_memory_allocated, memory_reserved, max_memory_reserved, memory_stats, get_memory_info, reset_peak_memory_stats, empty_cache}, each also under torch.accelerator.memory.* Stable Memory
Layout torch.tpu.{TpuLayout, LayoutContext, get_device_layout_if_materialized} Experimental Layout
Random numbers torch.accelerator.random.{initial_seed, get_rng_state, get_rng_state_all}; torch.tpu.{manual_seed, manual_seed_all, set_rng_state, default_generators} Stable; Experimental Random numbers
Precision torch.tpu.{Precision, precision, allow_excess_precision, get_amp_supported_dtype} Experimental Mixed precision
Execution torch.tpu.{EagerMode, eager_mode, set_eager_mode} (DEFER_NEVER is the default), torch.tpu.compiler.custom_compiler_options; compile with torch.compile(model, backend="tpu") Experimental Execution modes
Streams and events torch.accelerator.{synchronize, current_stream, set_stream}; torch.tpu.{Stream, Event, default_stream, stream} Stable; Experimental Streams and events
Distributed torch.tpu.distributed.{topology_aware_mesh, set_tpu_launch_env, spmd_safe, window_num_stripes, window_stripe_chunk_mb} Experimental Distributed
Operators torch.tpu.ops.max_pool{1,2,3}d and their _backward (Stable); optimization_barrier, splash_sdpa, ragged_dot, ragged_dot_weight_grad, align_jagged_to_multiple, strip_jagged_padding, all_gather_dim, reduce_scatter_dim, ragged_all_to_all, send, recv and the SparseCore sparse_* ops (Experimental) Stable; Experimental Operators
Custom kernels torch.tpu.pallas.{jax_op, get_pallas_mesh}; torch.tpu.pallas.verifier.{verify, VerificationMode, VerificationOptions, VerificationReport, VerificationFinding, VerificationError, Severity, Phase, FindingCategory} Experimental Custom kernels
Fused training step torch.tpu.optimizers.{SingleTraceTrainer, Optimizer, AdamW, Muon, Sgd} Experimental Fused training step
Profiling torch.tpu.profiler.TpuProfilerConfig Experimental Profiling
Deprecated torch.tpu.get_device_name, get_device_properties().{total_memory, multi_processor_count} (0.2.1); torch.tpu.topology_aware_mesh (0.2.0); torch.accelerator.{current_device_idx, set_device_idx} (PyTorch) Deprecated Deprecated
Internal torch.tpu.{is_available, device_count, current_device, set_device, device, synchronize, current_stream, set_stream, get_rng_state, initial_seed}: raise RuntimeError from user code unless TORCH_TPU_ALLOW_LEGACY_DEVICE_APIS=1 Internal Internal

Notes on the public names:

  • The default eager mode is DEFER_NEVER (chapter 4).
  • empty_cache does nothing: the allocator is PjRt-managed and emptyCache is a no-op (chapter 5).
  • torch.tpu.pallas.verifier.verify has the signature verify(target, args, kwargs=None, *, mode, options), and Phase has no public members (chapter 12).
  • optimization_barrier takes a sequence of tensors and returns a list.
  • spmd_safe declares that all ranks run identical TPU operations, so collectives can be fused (chapter 13).

A.3 llm-d API summary

The full tables (every field the book's chapters use, condition reasons, header aliases, dropped-request reasons with status codes, request APIs and artifacts) are the llm-d API reference, following the llm-d 1.0 API Reference.

Table A.3a: Resources and configuration

Kind API group / version Key fields Notes
InferencePool inference.networking.k8s.io/v1 (GAIE CRD) selector.matchLabels, targetPorts[] (at most 8), appProtocol (http or kubernetes.io/h2c), endpointPickerRef (name, port, failureMode: FailClose default or FailOpen) Status per parent Gateway: Accepted, ResolvedRefs; Exported for multi-cluster (reference)
InferenceObjective llm-d.ai/v1 (v1alpha2 deprecated, removal planned for 1.2) priority (unset means 0; negative marks requests sheddable), poolRefs[] (1 to 16) or poolSelector Selected per request with x-llm-d-inference-objective; status condition Accepted with Accepted or Pending (reference)
InferenceModelRewrite llm-d.ai/v1alpha2 poolRef, rules[] (matches[].model with type: Exact, targets[] with modelRewrite and weight 1 to 1,000,000) Precedence: Exact beats an empty match, then the oldest resource, then the first rule (reference)
EndpointPickerConfig llm-d.ai/v1 (v1alpha1 deprecated) featureGates, plugins[], schedulingProfiles[], dataLayer (with crossReplica), flowControl, requestHandler (parsers, propagatePriority) A configuration file or ConfigMap read at startup, "not a Kubernetes CRD" (reference)
DisaggregatedSet disaggregatedset.x-k8s.io/v1 spec.roles[], each with name (prefill, decode) and a spec holding replicas and a leaderWorkerTemplate "A Kubernetes controller and CRD" that extends LeaderWorkerSet so roles such as prefill, decode and encode run as separate, independently scaled pod groups (mirrored from kubernetes-sigs/lws)
LeaderWorkerSet leaderworkerset.x-k8s.io/v1 replicas, leaderWorkerTemplate (size, required workerTemplate, optional leaderTemplate) Multi-host model-server groups scheduled as one unit (LeaderWorkerSet (LWS))

Table A.3b: Request headers, responses and endpoints

Interface Name Contract
Request headers x-llm-d-inference-objective, x-llm-d-inference-fairness-id, x-llm-d-model-name-rewrite, x-llm-d-slo-ttft-ms, x-llm-d-slo-tpot-ms Objective, fairness group (default default-flow), per-request model override, SLO targets in ms. Deprecated aliases x-gateway-* and x-slo-* still accepted; strip x-llm-d-* at your edge (reference)
P/D header x-llm-d-prefiller-host-port Set by disagg-profile-handler so the decode-side sidecar can pull from the chosen prefill endpoint (chapter 20)
Response header x-llm-d-request-dropped-reason rejected-saturated, evicted, rejected-ttl-expired (429); rejected-no-endpoints, rejected-context-cancelled, rejected-shutting-down (503); rejected-internal (500)
HTTP inference APIs /v1/completions, /v1/chat/completions, /v1/responses, /v1/embeddings (OpenAI), /v1/messages (Anthropic), /inference/v1/generate (vLLM Generate) Parsed by default (reference)
gRPC inference vllm.grpc.engine.VllmEngine/{Generate, Embed} Needs the vllmgrpc-parser plugin and appProtocol: kubernetes.io/h2c; token IDs out
EPP ext_proc Envoy external processing, port 9002 The gateway or sidecar proxy calls the EPP to pick an endpoint
Batch Gateway /v1/files (POST, GET, GET {id}, GET {id}/content, DELETE {id}), /v1/batches (POST, ...) OpenAI-compatible batch API of the separate llm-d-batch-gateway repository

Table A.3c: Artifacts

Artifact Where Note
Router charts oci://ghcr.io/llm-d/charts/llm-d-router-standalone, oci://ghcr.io/llm-d/charts/llm-d-router-gateway Standalone mode (EPP with a sidecar proxy) or Gateway mode (behind an existing Gateway)
Router images ghcr.io/llm-d/llm-d-router-endpoint-picker, ghcr.io/llm-d/llm-d-router-disagg-sidecar The EPP image was renamed from llm-d-inference-scheduler in 0.8.0
Async processor oci://ghcr.io/llm-d/charts/llm-d-async, ghcr.io/llm-d/llm-d-async Pulls requests from a message queue and gates dispatch on pool capacity
Upstream engine images docker.io/vllm/vllm-tpu:v0.29.0, docker.io/vllm/vllm-openai:v0.30.0, docker.io/lmsysorg/sglang:v0.5.20 The llm-d TPU guides pin vllm/vllm-torchtpu:v0.29.0 instead (reference)
Source repositories llm-d/llm-d, llm-d/llm-d-router, llm-d/llm-d-latency-predictor, llm-d/llm-d-kv-cache, llm-d/llm-d-workload-variant-autoscaler, llm-d/llm-d-async, llm-d/llm-d-batch-gateway; kubernetes-sigs/gateway-api-inference-extension for the GAIE CRDs From the source-repository table of Artifacts

The EPP's Prometheus metrics are named llm_d_epp_* (chapter 21).

Production readiness

For the checks to run before a TorchTPU workload goes to production, see the book's Production readiness checklist.