@@ -12,6 +12,23 @@ set -x
1212ENGINE=" ${ENGINE:- sglang-disagg} "
1313export PYTHONDONTWRITEBYTECODE=1
1414
15+ # =============================================================================
16+ # HiCache / Mooncake settings from job.slurm
17+ # =============================================================================
18+ # job.slurm writes the recipe-provided HiCache/Mooncake tunables to
19+ # hicache_mc_<JID>.env and mounts it read-only at /config/hicache_mc.env. Source
20+ # it here (auto-export) so values like HICACHE_PAGE_SIZE=256 reach the container
21+ # before server_sglang.sh applies its "${VAR:-default}" fallbacks. Without this
22+ # the vars arrive unset and server_sglang.sh defaults HICACHE_PAGE_SIZE to 1,
23+ # overriding the recipe's --page-size. Empty values in the file are harmless:
24+ # the "${VAR:-default}" fallbacks still treat "" as unset.
25+ if [[ -f /config/hicache_mc.env ]]; then
26+ set -a
27+ source /config/hicache_mc.env
28+ set +a
29+ echo " [env.sh] sourced HiCache config from /config/hicache_mc.env (HICACHE_PAGE_SIZE=${HICACHE_PAGE_SIZE:- unset} )"
30+ fi
31+
1532# =============================================================================
1633# Shared: IBDEVICES detection
1734# =============================================================================
@@ -50,11 +67,11 @@ export NCCL_IB_HCA=${NCCL_IB_HCA:-$IBDEVICES}
5067# =============================================================================
5168# Shared by the vLLM MoRIIOConnector and the SGLang/MoRI KV-transfer path.
5269
53- export MORI_IO_SQ_BACKOFF_TIMEOUT_US=50000
54- export MORI_IO_QP_MAX_SEND_WR=16384
55- export MORI_IO_QP_MAX_CQE=32768
56- export MORI_IO_QP_MAX_SGE=2
57- export MORI_IO_TC_DISABLE=0
70+ export MORI_IO_SQ_BACKOFF_TIMEOUT_US=" ${MORI_IO_SQ_BACKOFF_TIMEOUT_US :- 50000} "
71+ export MORI_IO_QP_MAX_SEND_WR=" ${MORI_IO_QP_MAX_SEND_WR :- 16384} "
72+ export MORI_IO_QP_MAX_CQE=" ${MORI_IO_QP_MAX_CQE :- 32768} "
73+ export MORI_IO_QP_MAX_SGE=" ${MORI_IO_QP_MAX_SGE :- 2} "
74+ export MORI_IO_TC_DISABLE=" ${MORI_IO_TC_DISABLE :- 0} "
5875
5976# QoS/DSCP configuration
6077# Priority order: 1) Set by runner, 2) Detect via nicctl, 3) Detect from hostname
@@ -197,14 +214,27 @@ else
197214 export AITER_LOG_LEVEL=ERROR
198215
199216 export SGLANG_MORI_DISPATCH_DTYPE=auto
200- export MORI_COMBINE_DTYPE_PREFILL=fp8_direct_cast
201- export MORI_COMBINE_DTYPE_DECODE=fp8
217+ # export MORI_COMBINE_DTYPE_PREFILL=fp8_direct_cast
218+ # export MORI_COMBINE_DTYPE_DECODE=fp8
219+ export MORI_COMBINE_DTYPE_PREFILL=" "
220+ export MORI_COMBINE_DTYPE_DECODE=" "
202221 export SGLANG_MORI_QP_PER_TRANSFER=4
203222 export SGLANG_MORI_NUM_WORKERS=4
223+ # Keep these as overridable defaults (not hard assignments), otherwise
224+ # later tuning blocks cannot raise them for high-concurrency runs.
225+ # export MORI_IO_SQ_BACKOFF_TIMEOUT_US="${MORI_IO_SQ_BACKOFF_TIMEOUT_US:-500000}"
226+
227+ # export MORI_IO_QP_MAX_SEND_WR="${MORI_IO_QP_MAX_SEND_WR:-16384}"
228+ # export MORI_IO_QP_MAX_CQE=32768
229+ # export MORI_IO_QP_MAX_SGE=1
230+
231+ # export MORI_IO_TC_DISABLE=0
204232
205233 export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=3600
206234 export SGLANG_DISAGGREGATION_WAITING_TIMEOUT=3600
207235
236+ export SGLANG_HEALTH_CHECK_TIMEOUT=600
237+
208238 # GLM-5: uses NSA (not MLA), needs fused-decode-MLA disabled + fast loading
209239 if [[ " $MODEL_NAME " == " GLM-5-FP8" ]]; then
210240 export SGLANG_ROCM_FUSED_DECODE_MLA=0
@@ -242,15 +272,34 @@ else
242272 # 1 mirrors router logs to stdout via tee (useful for live debugging).
243273 export SGLANG_ROUTER_STDOUT_LOGS=" ${SGLANG_ROUTER_STDOUT_LOGS:- 0} "
244274
275+ # FIXME: WA for latest upstream 0305 image
276+ export PYTHONPATH=/sgl-workspace/aiter:${PYTHONPATH}
277+
245278 # =========================================================================
246279 # DeepSeek-V4-Pro PD recipe overrides
247280 # Placed at the end of the SGLang env block so it wins over the global
248281 # MoRI/SGLang defaults set above. Mirrors the validated DSv4 manual PD
249- # commands (see dsv4_mi355x_sglang_disagg_plan.md §2). Only the SGLang/MoRI
250- # env knobs are pinned here; CLI flags live in models.yaml and the cluster
251- # NIC/socket vars (NCCL_IB_HCA, *_SOCKET_IFNAME, IBDEVICES) stay runner-derived.
282+ # commands (ported from InferenceX amd/dsv4_sgl_di). These SGLANG_OPT_* /
283+ # AITER_* kernel-routing knobs steer DSv4 away from the default aiter CK
284+ # fused-MoE path, which raises "Unsupported kernel config for moe heuristic
285+ # dispatch" at decode time on this fp4 model (job 19034 crash). Only the
286+ # SGLang/MoRI env knobs are pinned here; CLI flags live in models.yaml and
287+ # the cluster NIC/socket vars stay runner-derived.
252288 # =========================================================================
253289 if [[ " $MODEL_NAME " == " DeepSeek-V4-Pro" ]]; then
290+ # MoRI RDMA send-queue depth for DSv4 (overrides the global default above).
291+ export MORI_IO_QP_MAX_SEND_WR=32767
292+ # Unified radix tree: cache impl with per-component (full-attn / SWA)
293+ # management for hybrid-attention models. Set unconditionally (not gated on
294+ # hicache) so all SGLang runs use it.
295+ export SGLANG_ENABLE_UNIFIED_RADIX_TREE=1
296+ # Proactively free out-of-window SWA KV slots during chunked prefill.
297+ # Without it, in-flight requests pin SWA KV for their whole context, keeping
298+ # the SWA pool under constant eviction pressure; under LRU the trailing
299+ # window of cached sessions gets flushed, making prefix-cache hits bimodal
300+ # and collapsing the effective hit rate on multi-turn agentic workloads.
301+ export SGLANG_OPT_UNIFIED_CACHE_FREE_OUT_OF_WINDOW_SLOTS=1
302+
254303 # MoRI dispatch/combine dtypes: auto for both roles (not the fp8 split default)
255304 export SGLANG_MORI_DISPATCH_DTYPE=auto
256305 export MORI_COMBINE_DTYPE_PREFILL=auto
@@ -262,42 +311,44 @@ else
262311 unset MORI_MOE_MAX_INPUT_TOKENS_PREFILL
263312 unset MORI_MOE_MAX_INPUT_TOKENS_DECODE
264313
265- # PER_RANK dispatch tokens are pinned independently of the sizing above
266- # (16384 prefill / 128 decode in the reference recipe). server_sglang.sh
267- # prefers these over the MORI_MAX_DISPATCH_TOKENS_* coupling when set.
314+ # PER_RANK dispatch tokens pinned independently (16384 prefill / 128
315+ # decode); server_sglang.sh prefers these over the MORI_MAX_DISPATCH_*
316+ # coupling when set.
268317 export MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK_PREFILL=16384
269318 export MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK_DECODE=128
270319
271- # Fixed inter-kernel switch threshold (not derived). NOTE: the DP+EP path in
272- # server_sglang.sh recomputes this dynamically for the DEP topology.
320+ # Fixed inter-kernel switch threshold (not derived).
273321 export SGLANG_MORI_DISPATCH_INTER_KERNEL_SWITCH_THRESHOLD=4096
274322
275323 # Overlap plan stream on for DSv4 (global default is 0)
276- export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=0
324+ # export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=0
277325
278326 # DSv4 model kernel routing (mirrors the single-node / manual PD recipe)
279327 export SGLANG_DEFAULT_THINKING=1
280- export SGLANG_DSV4_REASONING_EFFORT=max
281- export SGLANG_USE_ROCM700A=0
282- export SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton
328+ export SGLANG_DSV4_REASONING_EFFORT=high
283329 export SGLANG_OPT_DEEPGEMM_HC_PRENORM=false
330+ export SGLANG_USE_AITER=1
331+ export SGLANG_USE_ROCM700A=0
284332 export SGLANG_OPT_USE_FUSED_COMPRESS=true
285- export SGLANG_OPT_USE_FUSED_COMPRESS_TRITON=true
333+ export SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton
286334 export SGLANG_OPT_FP8_WO_A_GEMM=false
287335 export SGLANG_OPT_USE_JIT_INDEXER_METADATA=false
288336 export SGLANG_OPT_USE_TOPK_V2=false
289- export SGLANG_OPT_USE_AITER_INDEXER=true
337+ export SGLANG_OPT_USE_AITER_INDEXER=${SGLANG_OPT_USE_AITER_INDEXER :- true}
290338 export SGLANG_OPT_USE_TILELANG_INDEXER=false
291339 export SGLANG_OPT_USE_TILELANG_MHC_PRE=false
292340 export SGLANG_OPT_USE_TILELANG_MHC_POST=false
293341 export SGLANG_FP8_PAGED_MQA_LOGITS_TORCH=1
342+ export SGLANG_OPT_USE_FUSED_COMPRESS_TRITON=true
294343 export SGLANG_OPT_USE_MULTI_STREAM_OVERLAP=false
295344 export SGLANG_ROCM_USE_MULTI_STREAM=false
296345 export AITER_BF16_FP8_MOE_BOUND=0
297346 export SGLANG_EAGER_INPUT_NO_COPY=true
347+ export SGLANG_SHARED_EXPERT_TP1=1
348+ export SGLANG_DP_SHARED_EXPERT_LOCAL=1
349+ export SGLANG_DP_USE_GATHERV=1
350+ export SGLANG_DP_USE_REDUCE_SCATTER=1
351+ export GPU_MAX_HW_QUEUES=5
298352 fi
299353
300- # FIXME: WA for latest upstream 0305 image
301- export PYTHONPATH=/sgl-workspace/aiter:${PYTHONPATH}
302-
303- fi
354+ fi
0 commit comments