Skip to content

[CI] Use TP2 for Qwen3.5 35B target-only evaluation - #117

Merged
apinge merged 3 commits into
apinge:qwen4_v0.5.21from
sammysun0711:ci/qwen35-35b-tp2
Dec 1, 2026
Merged

apinge merged 3 commits into
apinge:qwen4_v0.5.21from
sammysun0711:ci/qwen35-35b-tp2

Conversation

@sammysun0711

@sammysun0711 sammysun0711 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Run Qwen3.5 35B target-only evaluation with two GPUs through both the evaluation guide and Qwen4 CI. The case selector becomes Qwen3.5-35B-TP2-Base.

Modifications

  • Rename launch_qwen3.5-35B-fp8_tp4_disable_prefix_cache.sh to launch_qwen3.5-35B-fp8_tp2_disable_prefix_cache.sh, set --tp-size 2, and update the default log filename.
  • Update the CI case ID, TP size and launcher path. The Actions matrix and GPU allocation derive from this case definition.
  • Update the guide's launch command, case order and accuracy table.
  • Run ./run_qwen35_pure_text_bench.sh for the full Qwen3.5-35B-TP2-Base performance case with MAX_CONCURRENCY=8 and NUM_PROMPTS=256. CI checks all 256 completions. Smoke runs use two prompts at concurrency 1.

Accuracy Tests

python3 -m pytest scripts/ci/test_qwen4_ci.py -q passed all 75 CI driver tests.

Speed Tests and Profiling

A CPU check exercised the CI driver and benchmark shell script with a stub client, verifying 256 prompts, concurrency 8 and 10 warmups for the full TP2 base case. GPU accuracy and performance validation runs in Qwen4 CI.

Checklist

  • CPU tests, Bash syntax, Ruff checks, codespell and git diff --check passed.
  • Updated evaluation documentation and CI case selection.
  • TP2 GPU accuracy/performance validation.

- Rename the launcher and set its tensor parallel size to two.
- Update the CI case and evaluation guide to use TP2.
- Retain the existing accuracy gate pending TP2 validation.

Signed-off-by: Xiake Sun <[email protected]>

Copilot AI 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.

🔵 Needs a closer look

TP2 validation on the target MI308X ROCm GPUs is still pending, and CPU checks cannot establish startup compatibility, memory fit, or compliance with the retained GSM8K acceptance gate.

No open issues 🎉

What changed in this PR

Switches Qwen3.5 35B target-only evaluation from four GPUs to two, keeping the launcher, CI case definition, and evaluation guide aligned.

Changes:

  • Renames the launcher and CI selector to TP2 and sets tensor parallelism to two GPUs.
  • Updates the default log filename, guide launch command, case order, and accuracy table.
  • Retains the TP4 accuracy reference as the acceptance gate pending TP2 GPU validation.
File Description
scripts/​ci/​qwen4_ci.py Updates the case ID, GPU count, and launcher path for TP2.
evaluation/​Qwen4_Evaluation_Guide.md Aligns launch instructions and CI documentation with TP2.
evaluation/​launch_qwen3.5-35B-fp8_tp2_disable_prefix_cache.sh Renames the launcher and configures two GPUs with a matching log filename.

Review effort: Balanced

@sammysun0711
sammysun0711 marked this pull request as ready for review November 25, 2026 11:26
@sammysun0711

sammysun0711 commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

PR #117 MI308X CI comparison

  • Before. PR [AMD] Qwen4-Exp SP: tuned prefill FP8 GEMMs, zero-copy AG consumer and faster hc_combine #108 at a9bfc91030c10f262d51d38edae49834fdc419a5, November 23, 2026 UTC. Run 45099998086, attempt 1
  • After. PR [CI] Use TP2 for Qwen3.5 35B target-only evaluation #117 at b9620354eee2f725d438a19858622d8de5a6d3fd, November 29, 2026 UTC. Attempt 1 supplied both Flash cases and both 35B cases, attempt 2 supplied 397B Base, and attempt 3 supplied 397B DFlash.
  • Runtime. Both runs used the 1node-8mi308x runner, AITER 1cf6209, benchmark client fc6ddbb, amd-mori 1.2.6.dev34+gde97ceace and flydsl 0.3.2. Pyhip changed from 8027faa to 9208930.
  • Inputs. All cases used random-text requests and 10 warmups, with nominal input/output lengths of 12,000/350 tokens for Qwen3.8 and 8,000/500 for Qwen3.5. The 35B Base row moved from 128 requests at concurrency 1 on GPUs 0–3 to 256 at concurrency 8 on GPUs 0–1. The other five rows kept 128 requests, concurrency 1 and the same GPU indices. GSM8K was a separate 200-example evaluation per case.

Performance deltas are 100 × (after / before − 1), computed from unrounded artifact values. Lower latency and higher throughput are better. Accept length applies to speculative decoding.

Accuracy and latency

Case GSM8K Mean TTFT, ms (Δ) Mean TPOT, ms (Δ) Mean E2E, ms/request (Δ)
Qwen3.8-Flash-TP2-Base 98.00% → 98.50% 518.205 → 516.560 (−0.3%) 6.582 → 6.745 (+2.5%) 2,815.171 → 2,870.487 (+2.0%)
Qwen3.8-Flash-TP2-MTP 97.00% → 97.50% 546.562 → 546.631 (0.0%) 3.109 → 3.130 (+0.7%) 1,631.709 → 1,638.901 (+0.4%)
Qwen3.5-35B Base (TP4 → TP2) 98.50% → 97.50% 163.898 → 1,235.743 (+654.0%) 4.130 → 8.695 (+110.5%) 2,224.982 → 5,574.728 (+150.6%)
Qwen3.5-35B-TP1-DFlash 98.00% → 96.50% 298.035 → 299.624 (+0.5%) 2.846 → 2.931 (+3.0%) 1,718.203 → 1,762.193 (+2.6%)
Qwen3.5-397B-TP8-Base 98.50% → 99.00% 330.842 → 350.041 (+5.8%) 6.105 → 7.237 (+18.6%) 3,377.023 → 3,961.362 (+17.3%)
Qwen3.5-397B-TP8-DFlash 98.50% → 99.00% 361.082 → 357.140 (−1.1%) 3.011 → 2.954 (−1.9%) 1,863.648 → 1,831.322 (−1.7%)

Throughput and speculative decoding

Case Output tokens/s (Δ) Requests/s (QPS, Δ) Accept length (Δ)
Qwen3.8-Flash-TP2-Base 124.291 → 121.897 (−1.9%) 0.355 → 0.348 (−1.9%) —
Qwen3.8-Flash-TP2-MTP 214.405 → 213.464 (−0.4%) 0.613 → 0.610 (−0.4%) 3.539 → 3.519 (−0.6%)
Qwen3.5-35B Base (TP4 → TP2) 224.643 → 717.063 (+219.2%) 0.449 → 1.434 (+219.2%) —
Qwen3.5-35B-TP1-DFlash 290.863 → 283.620 (−2.5%) 0.582 → 0.567 (−2.5%) 5.950 → 5.837 (−1.9%)
Qwen3.5-397B-TP8-Base 148.023 → 126.195 (−14.7%) 0.296 → 0.252 (−14.7%) —
Qwen3.5-397B-TP8-DFlash 268.152 → 272.906 (+1.8%) 0.536 → 0.546 (+1.8%) 7.893 → 7.828 (−0.8%)

Key Takeway

  • 35B Base at matched concurrency. This PR change Qwen3.5 35B-Base settings from TP4/con=1 to TP2/con=8. It measured output throughput: 224.643 → 717.063 tokens/s (+219.2%), TTFT: 163.898 → 1,235.743 ms (+654.0%) and TPOT: 4.130 → 8.695 ms (+110.5%). E2E latency: 2,224.982 → 5,574.728 ms (+150.6%), Final GSM8K was 195/200 (97.50%), above the CI minimum of 94.09%. This data will serve as baseline for Qwen3.5 35B TP2 model optimization tracking.

  • Other CI model performance and accuracy within run-to-run variance. The largest throughput decline was 397B TP8 Base, 148.023 → 126.195 output tokens/s (−14.7%), with mean TPOT up 18.6%. It may relate to impact of another workload during the CI run, since 397B DFlash throughput within 2% run-to-run variance.

@sammysun0711

sammysun0711 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

Rerun on another MI308X PTL machine for Qwen3.5-397B-TP8-Base and Qwen3.5-397B-TP8-DFlash on the same SGLang PR117 + AITER base apinge/aiter@1cf6209

Accuracy and latency

Case GSM8K Mean TTFT, ms (Δ) Mean TPOT, ms (Δ) Mean E2E, ms/request (Δ)
Qwen3.8-Flash-TP2-Base 98.00% → 98.50% 518.205 → 516.560 (−0.3%) 6.582 → 6.745 (+2.5%) 2,815.171 → 2,870.487 (+2.0%)
Qwen3.8-Flash-TP2-MTP 97.00% → 97.50% 546.562 → 546.631 (0.0%) 3.109 → 3.130 (+0.7%) 1,631.709 → 1,638.901 (+0.4%)
Qwen3.5-35B Base (TP4 → TP2) 98.50% → 97.50% 163.898 → 1,235.743 (+654.0%) 4.130 → 8.695 (+110.5%) 2,224.982 → 5,574.728 (+150.6%)**
Qwen3.5-35B-TP1-DFlash 98.00% → 96.50% 298.035 → 299.624 (+0.5%) 2.846 → 2.931 (+3.0%) 1,718.203 → 1,762.193 (+2.6%)
Qwen3.5-397B-TP8-Base 98.50% → 99.00% 330.842 → 325.60 (-1.58%) 6.105 → 6.00 (-1.72%) 3,377.023 → 3318.64  (-1.72%)
Qwen3.5-397B-TP8-DFlash 98.50% → 99.00% 361.082 → 347.18 (−3.85%) 3.011 → 2.95 (−2.03%) 1,863.648 → 1817.11 (−2.5%)

Throughput and speculative decoding

Case Output tokens/s (Δ) Requests/s (QPS, Δ) Accept length (Δ)
Qwen3.8-Flash-TP2-Base 124.291 → 121.897 (−1.9%) 0.355 → 0.348 (−1.9%) —
Qwen3.8-Flash-TP2-MTP 214.405 → 213.464 (−0.4%) 0.613 → 0.610 (−0.4%) 3.539 → 3.519 (−0.6%)
Qwen3.5-35B Base (TP4 → TP2) 224.643 → 717.063 (+219.2%) 0.449 → 1.434 (+219.2%) —
Qwen3.5-35B-TP1-DFlash 290.863 → 283.620 (−2.5%) 0.582 → 0.567 (−2.5%) 5.950 → 5.837 (−1.9%)
Qwen3.5-397B-TP8-Base 148.023 → 150.63 (+1.76%) 0.296 → 0.30 (+1.35%) —
Qwen3.5-397B-TP8-DFlash 268.152 → 275.01 (+2.56%) 0.536 → 0.55 (+2.61%) 7.893 → 7.79 (−1.3%)

Key Takeway

  • 35B Base at matched concurrency. This PR change Qwen3.5 35B-Base settings from TP4/con=1 to TP2/con=8. It measured output throughput: 224.643 → 717.063 tokens/s (+219.2%), TTFT: 163.898 → 1,235.743 ms (+654.0%) and TPOT: 4.130 → 8.695 ms (+110.5%). E2E latency: 2,224.982 → 5,574.728 ms (+150.6%), Final GSM8K was 195/200 (97.50%), above the CI minimum of 94.09%. This data will serve as baseline for Qwen3.5 35B TP2 model optimization tracking.

  • Other CI model performance and accuracy within run-to-run variance. Previous largest throughput decline of 397B TP8 Base cannot reproduce on another PTL machine. The previous result may related co-running workload, or PTL not set after GPU reset.

@apinge
apinge merged commit e720631 into apinge:qwen4_v0.5.21 Dec 1, 2026
87 of 105 checks passed
sammysun0711 pushed a commit that referenced this pull request Dec 2, 2026
…e over SDMA (on by default) (#118)

* [AMD] Qwen3.5 TP2 prefill: overlap the layer all-reduces with compute over SDMA

Qwen3.5-35B-A3B TP2 prefill spends ~28% of its GPU time in the two all-reduces
per layer (RCCL at the xGMI limit for 32k-token batches). Apply the Qwen4-Exp
SDMA overlap to Qwen3.5's plain residual stream: at TP2 an all-reduce is
"push the partial to the peer, then add", so the residual stays replicated.

- out_proj / o_proj run in row chunks; each chunk's partial is pushed to the
  peer over SDMA (mori, SdmaAllGather writer) as soon as it is computed.
- Per landed chunk: rank 0 rows + rank 1 rows (bit-identical on both ranks),
  residual add + RMSNorm, then the MoE on that chunk with its all-reduce
  skipped; its output is pushed the same way and consumed by the next layer's
  input norm chunk by chunk.

Eager TP2 EXTEND batches of Qwen3.5 MoE (qwen3_5_moe_text) only; everything
else, including Qwen4-Exp / Qwen3.8, keeps its path. Shares the Qwen4 switches
(no new environment variable): SGLANG_QWEN4_SP_SDMA_RS (default on),
SGLANG_QWEN4_SEQ_PARALLEL_MIN_TOKENS (2048) and SGLANG_QWEN4_SP_SDMA_RS_CHUNKS
(Qwen3.5 default 4). Without mori the all-reduce runs, with a warning.

The TP2 launcher sets the mori runtime environment.

Signed-off-by: Ethan Yang <[email protected]>

* [AMD] Qwen3.5 35B TP2 launcher: FlyDSL GDN decode

Select the gfx942 FlyDSL fused GDN decode kernel (qkvz/ba unpack + conv1d
update + recurrence in one launch) with --linear-attn-decode-backend aiter.
Qwen3.5 shares Qwen3_5GatedDeltaNet with Qwen3.8; at TP2 it runs 8 k-heads /
16 v-heads per rank (ratio 2), which the kernel's (H, HV) JIT covers.

Signed-off-by: Ethan Yang <[email protected]>

* Qwen4 CI: require the Qwen3.5 35B TP2 fast paths; SDMA all-reduce bench and docs

- qwen4_ci.py: Qwen3.5-35B-TP2-Base fails when its server log lacks the
  FlyDSL GDN decode or, after the performance phase, the SDMA all-reduce
  line, so a missing mori cannot pass silently. Accuracy-only runs, which
  may stay below the 2048-token threshold, only require the decode line.
- test_qwen4_ci.py: cover the check and give the #117 workload test a
  server log with both lines.
- benchmark/qwen4_seq_parallel: two-GPU correctness and layer timing for
  the Qwen3.5 SDMA all-reduce; README section with the serving results.
- Evaluation guide: the 35B TP2 launcher's SDMA / mori requirement and the
  new CI check.

Signed-off-by: Ethan Yang <[email protected]>

* [AMD] Qwen3.5 SDMA all-reduce: chunk count follows the batch size

Each row chunk re-runs the MoE (gate, topk, sorting, quant, two GEMMs), the
projection quant + GEMM and the add + norm, about 7 ms of host time per layer
at 4 chunks regardless of the batch size. Small prefills were host-bound:
single 4k-token requests went from 132 ms to 338 ms (GPU idle 329 of 434 ms),
which cancelled the large-batch gain in the 8k-token CI workload's TTFT.

Single-request prefill latency on MI308X TP2 (ms):

  tokens   all-reduce  1 chunk  2 chunks  4 chunks
  4096         132       143      199       338
  8000         225       233      223       342
  12000        337       362      298       352
  16000        460       483      399       386
  24000        724       740      657       598
  32000       1021      1041      924       842

- Batches under 8192 tokens keep the all-reduce; 2 chunks up to 16383
  tokens, 4 from 16384.
- SGLANG_QWEN4_SEQ_PARALLEL_MIN_TOKENS and SGLANG_QWEN4_SP_SDMA_RS_CHUNKS
  still override, but only when set: their defaults are Qwen3.8's.
- CI: smoke runs send single 8k prompts, now under the threshold, so the
  SDMA log line is only required after the full performance phase.

Signed-off-by: Ethan Yang <[email protected]>

* qwen4_seq_parallel README: Qwen3.5 results from run_qwen35_pure_text_bench.sh defaults

Signed-off-by: Ethan Yang <[email protected]>

* [AMD] Qwen3.5 SDMA all-reduce: harden the gating

- Keep the all-reduce with speculative decoding (MTP drafts got accept
  length 1.0 on this path) and with LoRA (its wrappers replace o_proj /
  out_proj and bypass the chunked push, which raised on the first large
  prefill); also check at init that every projection is still wrapped.
- Size the receive buffers to min(max prefill, chunked prefill) tokens and
  keep the all-reduce for larger batches; log the buffer size.
- Require bf16 activations and a TP-partial MoE output.
- Agree on SDMA availability across ranks before the group collective.
- Disable the path after an exception mid-forward.
- Reject SGLANG_QWEN4_SP_SDMA_RS_CHUNKS < 1.
- Trim comments; README notes the excluded cases; the shared mori warning
  no longer names the aiter reduce-scatter.

Signed-off-by: Ethan Yang <[email protected]>

---------

Signed-off-by: Ethan Yang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants