Skip to content

Fix for https://github.com/sgl-project/sglang/issues/22072 / 修复 SGLang MoRI 分离式推理在 MI325X 上的挂起问题 - #1806

Open
davzhuAMD wants to merge 12 commits into
SemiAnalysisAI:mainfrom
davzhuAMD:main
Open

Fix for https://github.com/sgl-project/sglang/issues/22072 / 修复 SGLang MoRI 分离式推理在 MI325X 上的挂起问题#1806
davzhuAMD wants to merge 12 commits into
SemiAnalysisAI:mainfrom
davzhuAMD:main

Conversation

@davzhuAMD

@davzhuAMD davzhuAMD commented Jun 16, 2026

Copy link
Copy Markdown

Fix SGLang MORI disagg tests hanging on MI325X. The test matrix appeared as follows:

Test # Config Decode nodes EP/DP MoRI a2a Status
1 P(tp4) D(tp8) 1 No No Works
2 P(tp8) D(tp8, 2 workers) 1 each No No Works
3 P(tp4) D(tp8/ep8/dp, 1 node) 1 Yes Yes Works (used to hang)
4 P(tp4) D(tp8/ep8/dp, 1 node, MTP) 1 Yes Yes Works (used to hang)
5 P(tp8) D(tp16/ep16/dp16, 2 nodes) 2 Yes Yes Works (used to hang)

Investigation employed helper scripts from https://github.com/davzhuAMD/InferenceX/tree/sglang-pd-mi325x, derived from https://github.com/JohnQinAMD/InferenceX/tree/sglang-pd-mi300-mi325x, to aid investigation and repro. These are the run_* and start_* scripts that essentially act as config instructions to set up the repro.

To validate, copy the run_* and start_* scripts from the sglang-pd-mi325 branch mentioned above into the main InferenceX folder, update the PREFILL_MODEL_HOST_DIR, DECODE_MODEL_HOST_DIR, PREFILL_NODE, and DECODE_NODE IPs per test in these scripts, then run

  • start_test_1.sh
  • start_test_2.sh
  • start_test_3.sh
  • start_test_4.sh
  • start_test_5.sh

Thanks to Akash Dhaka who investigated this issue with me.


Note

Medium Risk
Changes benchmark harness defaults for a narrow model+SKU and alters NCCL/MoRI QoS env propagation cluster-wide when QoS is detected; wrong gates could affect non-MI325X runs or mask fabric misconfiguration.

Overview
Fixes SGLang MoRI prefill/decode disaggregated benchmarks that used to hang or stall under load on MI325X, especially DeepSeek-R1-0528 with decode DP+EP and cross-node MoE all-to-all.

env.sh introduces RUNNER_FAMILY (normalized from RUNNER_TYPE) so SKU-specific tuning can target mi325x without matching fleet labels like cluster:mi325x-amds. When RDMA QoS is detected, traffic class and service level are propagated consistently to MoRI IO and NCCL (NCCL_IB_TC / NCCL_IB_SL), including deriving SL from TC when missing—avoiding bnxt_re DSCP/SL mismatches that downgrade to best-effort and stall KV/NCCL under load. For DeepSeek-R1-0528 on mi325x, decode MORI_MAX_DISPATCH_TOKENS_DECODE is raised from 512 → 4096 (scoped to that model+SKU).

server_sglang.sh applies the same model+SKU gate to set PREFILL_MEM_FRACTION_STATIC=0.9 after the models.yaml loader (so it is not clobbered). The DP+EP decode path no longer ties max-running-requests to bench concurrency alone or shrinks MoRI dispatch buffers to conc/dp_ranks; it scales max-running-requests to conc × TP (floored at dp_ranks) and keeps env.sh MoRI dispatch/MOE limits instead of overriding them downward.

Reviewed by Cursor Bugbot for commit e9863fc. Bugbot is set up for automated code reviews on this repo. Configure here.

中文说明

修复 SGLang MoRI 分离式基准测试在 MI325X 上的挂起问题。通过调优 RoCE/NCCL/MoRI 环境变量默认值和修复解码端 DP+EP 尺寸设置来解决(之前在负载下会导致跨节点 EP 资源不足)。主要变更包括:env.sh 新增默认 NCCL_IB_GID_INDEXNCCL_IB_TCNCCL_IB_SL 用于 bnxt_re RoCEv2 多节点通信;解码 MoRI dispatch 上限从 512 提升至 4096 tokens;server_sglang.sh 修正 max-running-requests 缩放逻辑;新增启动辅助脚本 _disagg_ssh_remote_inner.shdetect_ibdevices_bnxt.shrebuild_bnxt.sh 等。

Comment thread utils/find_reusable_sweep_run.py
Comment thread benchmarks/multi_node/amd_utils/server.sh
Comment thread run_1p1d_tp16_sglang_mi300_mi325x.sh Outdated
Comment thread runners/launch_gb300-nv.sh
Comment thread scripts/_disagg_ssh_remote_inner.sh Outdated
Comment thread run_1p2d_sglang_mi300_mi325x.sh Outdated
Comment thread run_1p1d_tp16_sglang_mi300_mi325x.sh Outdated
Comment thread start_test_1.sh Outdated
export REBUILD_LIBBNXT_IN_CONTAINER=1
export PATH_TO_BNXT_TAR_PACKAGE=/workspace/driver/libbnxt_re-237.1.137.0.tar.gz

export PREFILL_NODE="45.63.71.103"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The start_test_*.sh scripts hardcode many cluster-specific values (real node IPs like 45.63.71.103 / 137.220.60.12 and Docker image tags) directly in a public repo. Maybe we could parameterize these (e.g. via env vars) instead of committing concrete cluster details.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comments. These test scripts themselves (including the new start_test_, run_1p, and start_sglang*) don't necessarily need to make it into the final repo, but I added them to illustrate how we investigated and reproduced the original issue on our side. If it makes things clearer, I can remove the helper scripts from the commit and attach them somewhere else instead, leaving just the actual fixes in this PR.

Comment thread run_1p1d_tp16_sglang_mi300_mi325x.sh Outdated
# IPADDRS order: prefill_ip,decode1_ip,decode2_ip. NNODES=3, xP=1, yD=1.
#
# Prerequisites:
# - Passwordless SSH from this machine to both nodes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this say 3 nodes? This script launches 1 prefill + 2 decode nodes (NNODES=3), but the comments/header still say "both nodes", which were copy-pasted from the single-decode launcher and read as if there are only 2 nodes total.

…er concurrencies.

- Increase the decode dispatch buffer size from 512 to 4096 and correctly pass it along for the DP and EP cases, avoiding a stall under load.
- Correctly set MORI parameters when prioritizing traffic as lossless, which otherwise interferes with the data transfers that the tests generate.
Comment thread benchmarks/multi_node/amd_utils/env.sh Outdated
…e final commit. They'll remain availabel in the sglang-pd-mi325x branch.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread benchmarks/multi_node/amd_utils/rebuild_bnxt.sh Outdated
Comment thread driver/libbnxt_re-237.1.137.0.tar.gz Outdated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guidance would be appreciated for how to handle a library file like this. During investigation and debug, we requested an update of our test nodes' NIC firmware and driver. However, the Docker image we used didn't have the updated driver itself, so our test scripts had to pass export REBUILD_LIBBNXT_IN_CONTAINER=1 to patch in this updated driver. In theory, using an updated image with a later compatible NIC driver should make this archive unnecessary to commit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding my comment on libbnxt_re-237.1.137.0.tar.gz https://github.com/SemiAnalysisAI/InferenceX/pull/1806/changes#r3432816594, if anyone validates this fix using a Docker image that comes with an updated NIC driver compatible with the host's firmware, then this rebuild_bnxt.sh script becomes unnecessary.

@functionstackx functionstackx changed the title Fix for https://github.com/sgl-project/sglang/issues/22072 Fix for https://github.com/sgl-project/sglang/issues/22072 / 修复 SGLang MoRI 分离式推理在 MI325X 上的挂起问题 Jul 4, 2026
@davzhuAMD

davzhuAMD commented Jul 20, 2026

Copy link
Copy Markdown
Author

I removed the added scripts and driver package, as I considered them out of the scope of the InferenceX-side fix for the original issue. Those removed scripts would've mainly covered environment setup, which anyone testing or validating this change would likely need to tailor to their own setup anyway. The scripts still exist at my https://github.com/davzhuAMD/InferenceX/tree/sglang-pd-mi325x as I use them for my own local testing.

@chunfangamd chunfangamd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @davzhuAMD! The fixes are for MI325X, right? It seems the files are common files that can affect MI300X and MI355 too. Could you please check?

Meanwhile, please trigger an e2e test using your branch for verification.

@davzhuAMD

Copy link
Copy Markdown
Author

My pleasure, @chunfangamd, and thanks for your comment.

The changes to server_sglang.sh, and to the env.sh's NCCL and MORI QoS, are meant to be common, as they resolve what I believe is a genuine defect in the original code. Regardless of what node setup we have, the original code inconsistently set NCCL and MORI RDMA environment variables as one contributor to the original #22072 symptom, and my changes try to resolve that.
However, I could look into restricting the MORI_MAX_DISPATCH_TOKENS_DECODE=4096 and models.yaml to affect MI325X only, if we intend to only target MI325X as part of this change.

As for triggering an e2e test, I don't seem to have permission to do so via GitHub Actions. How do I get access?

@davzhuAMD

Copy link
Copy Markdown
Author

I updated my branch to set config settings only if it's DeepSeek-R1-0528 and RUNNER_TYPE mi325x, including for the prefill mem_fraction_static 0.9 that I formerly set in models.yaml (now models.yaml is unmodified). On that topic, what would be the best way to introduce MI325X-specific logic within env.sh and server_sglang.sh? Using RUNNER_TYPE like I have here, or getting the device ID somehow?

I'm currently retesting.

@chunfangamd

Copy link
Copy Markdown
Collaborator

Thanks @davzhuAMD! The MI325X-specific scoping looks good. Could you please address or explain the following two concerns?

  1. NCCL_IB_GID_INDEX=3 should not be a global default in shared env.sh; it is fabric/NIC-specific. Am I right?
  2. Could you provide an E2E result for the original failing MI325X cases ([NVIDIA] update vllm b200 image. TODO: add logic for docker runner. #3/[NVIDIA] Fix vllm & sglang b200 updated containers #4/Add new FW (TRT) and precision support #5). Since QoS and DP+EP sizing remain shared changes, we also need MI300X/MI355X regression coverage, or narrower scoping. The goal is to verify that we are not touching non-MI325 devices.

@davzhuAMD

davzhuAMD commented Aug 25, 2026

Copy link
Copy Markdown
Author

Thank you for your comments, @chunfangamd.

  1. NCCL_IB_GID_INDEX=3 should not be a global default in shared env.sh; it is fabric/NIC-specific. Am I right?

Good point, I'll remove this setting. The correct value could change depending on the exact cluster setup and layout.

  1. Could you provide an E2E result for the original failing MI325X cases ([NVIDIA] update vllm b200 image. TODO: add logic for docker runner. #3/[NVIDIA] Fix vllm & sglang b200 updated containers #4/Add new FW (TRT) and precision support #5). Since QoS and DP+EP sizing remain shared changes, we also need MI300X/MI355X regression coverage, or narrower scoping. The goal is to verify that we are not touching non-MI325 devices.

Please see my previous comment regarding E2E. #1806 (comment) I thought I'd normally click a "Run workflow" button to set up an E2E test, but I don't have see one here. How do I get access, or does "E2E" refer to something else?
image

…h indices can change per cluster setup or layout. Thanks to Chun for pointing it out.
@davzhuAMD

davzhuAMD commented Sep 8, 2026

Copy link
Copy Markdown
Author

Hi @chunfangamd and all, here are Terminal logs from successful runs of Tests 3 to 5 using this PR.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 25e466a. Configure here.

Comment thread benchmarks/multi_node/amd_utils/env.sh
…ch GPU family like in generate.py's _hardware_family.
@davzhuAMD

Copy link
Copy Markdown
Author

I updated my fork to a later SemiAnalysisAI/InferenceX baseline, and the formerly-failing tests still pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants