Skip to content

Qwen4 v0.5.21 rfork and CI test case - #98

Merged
apinge merged 5 commits into
apinge:qwen4_v0.5.21from
yicyang:qwen4_v0.5.21-rfork
Nov 10, 2026
Merged

apinge merged 5 commits into
apinge:qwen4_v0.5.21from
yicyang:qwen4_v0.5.21-rfork

Conversation

@yicyang

@yicyang yicyang commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@yicyang
yicyang marked this pull request as ready for review November 9, 2026 08:14
@apinge
apinge requested review from apinge and sammysun0711 November 9, 2026 08:37
yicyang and others added 3 commits November 9, 2026 08:39
* [AMD] Make R-Fork (remote_instance, nccl) work for Qwen3.8-Flash-Next FP8 on MI308X

- Client runs quant post-processing before receiving so tensor layout/dtype
  (fnuz, PyHIP GR packing) matches the seed.
- Recompute load-time derived buffers (gemma_weight) after the raw copy.
- Exchange a (name, shape, dtype) manifest digest before broadcasting; a
  mismatch now fails fast on both sides instead of deadlocking RCCL
  (seed RoPE caches grow at runtime).
- Seed no longer crashes when a send group failed to init; client checks
  build_group result.
- SGLANG_DEBUG_WEIGHT_CHECKSUM_DIR: per-rank post-load checksums.
- Client launch script and validation report (benchmark/rfork_mi308x).

* [AMD] Validate ModelExpress-style startup paths on MI308X; fix Mooncake HIP R-Fork

- R-Fork transfer_engine: on ROCm register whole allocator segments, working
  around Mooncake HIP transport resolving addresses from the IPC allocation base
  (silently wrong weights otherwise); add standalone repro.
- R-Fork transfer_engine: recompute derived buffers after the copy.
- Benchmark tools: startup timer, per-model page-cache eviction, first-request
  latency, raw fastsafetensors throughput, weight-cache daemon shim.
- Report: kernel-cache transfer, storage loaders (fastsafetensors, runai,
  prefetch, no-mmap), Mooncake vs RCCL, weight_cache limitation.

* benchmark/rfork_mi308x: add per-phase startup time breakdown

* Add weight-iterator timing debug switch; report per-rank disk read vs load_weights and full launch commands

SGLANG_DEBUG_WEIGHT_ITER_TIMING logs time blocked on the checkpoint iterator vs
time in load_weights, and splits fastsafetensors into file read and per-tensor
distribution.

* benchmark/rfork_mi308x: add bench_startup.py startup-time matrix

* benchmark/rfork_mi308x: add TP2 results and seed-stall finding

* benchmark/rfork_mi308x: correct runai/no-mmap memory note (peak only, KV unaffected)

* remote_instance: refresh KV-cache scale floats after receiving weights

Receivers run process_weights_after_loading before the copy, which sets
k_scale_float/v_scale_float from the -1 placeholders (1.0). The copy then
brings the seed's final k/v_scale tensors, but the floats consumed by the
attention backends stayed at 1.0 for checkpoints with non-unit KV scales.
Refresh them from the received tensors next to the alias rebind.

* benchmark/rfork_mi308x: make bench_startup cache/GPU state explicit

- warm page cache is now prepared (read in) and verified like cold; abort
  if residency is not reached (O_DIRECT loaders left "warm" runs cold)
- remove a stale log before launch so an old "fired up" is not taken as ready
- non-R-Fork runs use HIP_VISIBLE_DEVICES (fastsafetensors uses cuda:rank
  and ignores --base-gpu-id); R-Fork ranges must be contiguous, equal size,
  disjoint
- refuse to launch on GPUs with >2 GiB in use; interleave repeats

* benchmark/rfork_mi308x: add verify_rfork.py; rewrite README with TP2/TP4 rerun

Full rerun at 378743602 with the same scripts and table layout for TP2 and
TP4: startup matrix (6 configs x page cache warm/cold x 2), cold kernel
cache, per-rank checksums and GSM8K for disk/RCCL/Mooncake. README
shortened; adds script usage.

* benchmark/rfork_mi308x: clarify R-Fork cold page-cache cells were not run

* benchmark/rfork_mi308x: measure R-Fork configs with a cold page cache too

* Trim PR to necessary changes

Drop what was only used for analysis or convenience:
- RCCL transfer manifest check (guarded a buffer-transfer variant that is
  not used; parameters-only transfer as before)
- SGLANG_DEBUG_WEIGHT_ITER_TIMING and the iterator/fastsafetensors timers
- rfork client launch script and analysis-only benchmark tools

* benchmark/rfork_mi308x: README with usage and results only

* benchmark/rfork_mi308x: drop prefetch config and results (no gain measured)

* benchmark/rfork_mi308x: stop the seed when a run aborts

* load_model_utils: correct the checksum peak-memory comment

* scripts: add a reference launcher for the fast-startup options

* scripts: add a cross-container R-Fork reference launcher

Starts the new instance in its own container on the same node (host network,
shared IPC, GPU devices) and runs MODE=rfork against a seed in another
container. CROSS_CONTAINER.md lists the requirements, usage and one TP2
measurement.

* Drop Mooncake, storage loaders and seed-startup options; keep R-Fork over RCCL

- transfer_engine path is back to the base branch: no whole-segment
  registration workaround, no pre-receive processing or derived-state
  restore for it (both now NCCL only)
- remove mooncake_hip_offset_repro.py
- bench_startup.py: configs disk and rfork_nccl only; drop the kernel-cache
  option; place every run with HIP_VISIBLE_DEVICES
- verify_rfork.py: disk seed + RCCL instance only
- launcher renamed to launch_qwen38_flash_next_fp8_mi308x_rfork.sh with
  MODE=seed|rfork; cross-container launcher is RCCL only
- README: R-Fork scale-out effect, dependencies (none beyond ROCm), usage

* benchmark/rfork_mi308x: README results from the TP2 re-run at the RCCL-only head

* benchmark/rfork_mi308x: README TP2 results re-measured at the rebased head

---------

Co-authored-by: yicyang <[email protected]>

(cherry picked from commit 6ca1975 on qwen38-flash-next-amd-current-fix-install)
Conflicts resolved in loader.py (post_load_weights rename, import block) and
load_model_utils.py (PLE offload condition now read via get_exec()).
Signed-off-by: yicyang <[email protected]>
Signed-off-by: Ethan Yang <[email protected]>
Launch scripts live in evaluation/ on this branch, so move the R-Fork
launchers there and point bench_startup.py at evaluation/. The base
launch script defaults MTP=1 here; R-Fork is validated without the MTP
draft model, so the R-Fork launcher and bench_startup.py default MTP=0.

Signed-off-by: yicyang <[email protected]>
Qwen3.8-Flash-TP2-RFork starts a TP2 seed from disk, then a TP2 instance
on two other idle GPUs that pulls the seed's weights over RCCL
(--load-format remote_instance). It fails unless the new instance loads
via R-Fork, every rank's per-tensor checksums match the seed, and the new
instance passes the TP2 GSM8K gate (reference 98.0%). The summary also
reports the new instance's startup time and load_weight. Under --pressure
it only checks loading and checksums.

Signed-off-by: yicyang <[email protected]>
Comment thread benchmark/rfork_mi308x/README.md Resolved
Comment thread evaluation/Qwen4_Evaluation_Guide.md Resolved
The launcher no longer requires or mounts a host workspace directory. The
new container runs the image's SGLang at REPO_DIR (default /opt/sglang);
DOCKER_ARGS passes extra docker run arguments, e.g. a mount for a host
checkout used with REPO_DIR.

Signed-off-by: yicyang <[email protected]>
…notes

- Qwen3.8-Flash-TP2-RFork is daily-only: PR runs skip it, the daily
  schedule and an explicit case selection run it. matrix_cases() in
  qwen4_ci.py now builds the Actions matrix and is unit tested.
- Under --pressure the R-Fork case also checks the complete seed and
  server logs after shutdown, like the other pressure cases.
- README: remove the measurement footnotes.

Signed-off-by: yicyang <[email protected]>
@sammysun0711

Copy link
Copy Markdown
Collaborator

RFork mainly focus on ModelExpress feature implementation, model performance and accuracy should keep flat w/ run-to-run variance..

MI308X CI: PR #90 baseline → PR #98

  • Before: PR feat(qsa): backport PyHIP QSA and 1M context support to qwen4_v0.5.21 #90, SGLang 840bec5849ae4ca11f02c39efcc77df8b0211e10, run 42489664232, November 8, 2026 UTC.
  • After: PR #98, SGLang d83b7ae58808bbe3fa31cbede661c7199a42a598, run 42630207194, November 9, 2026 UTC.
  • Shared sources: AITER 514c166e9abad59acde74309923c2d923a89eee0, pyhip 8027faad29415747707670db7776528c6b72db81, and benchmark client fc6ddbbf7aac80167ea04cc00bf200af8adf2b85.
  • Performance inputs: random dataset, configured input/output lengths of 12,000/350 tokens for Qwen3.8 and 8,000/500 for Qwen3.5.

Changes are (after / before - 1) × 100%, calculated from unrounded artifact values and rounded to one decimal place. Negative TTFT/TPOT changes mean lower latency; positive throughput/QPS changes mean higher throughput.

Case GSM8K (before → after) TTFT ms (before → after; Δ %) TPOT ms (before → after; Δ %)
Qwen3.8-Flash-TP2-Base 98.00% → 98.50% 779.086 → 777.516 (-0.2%) 9.250 → 9.114 (-1.5%)
Qwen3.8-Flash-TP2-MTP 99.00% → 98.00% 836.026 → 833.757 (-0.3%) 6.922 → 6.860 (-0.9%)
Qwen3.5-35B-TP4-Base 97.50% → 96.50% 169.664 → 169.910 (+0.1%) 3.996 → 4.087 (+2.3%)
Qwen3.5-35B-TP1-DFlash 98.00% → 97.50% 335.200 → 334.638 (-0.2%) 2.831 → 2.849 (+0.6%)
Qwen3.5-397B-TP8-Base 99.00% → 98.00% 359.001 → 358.808 (-0.1%) 6.168 → 6.215 (+0.8%)
Qwen3.5-397B-TP8-DFlash 98.50% → 99.00% 373.481 → 376.367 (+0.8%) 2.999 → 3.144 (+4.8%)

Additional CI summary metrics:

Case Output tokens/s (before → after; Δ %) QPS (before → after; Δ %) Accept length (before → after; Δ %)
Qwen3.8-Flash-TP2-Base 87.327 → 88.404 (+1.2%) 0.250 → 0.253 (+1.2%) —
Qwen3.8-Flash-TP2-MTP 107.608 → 108.405 (+0.7%) 0.307 → 0.310 (+0.7%) 3.515 → 3.507 (-0.2%)
Qwen3.5-35B-TP4-Base 230.996 → 226.238 (-2.1%) 0.462 → 0.452 (-2.1%) —
Qwen3.5-35B-TP1-DFlash 285.911 → 284.536 (-0.5%) 0.572 → 0.569 (-0.5%) 6.070 → 5.991 (-1.3%)
Qwen3.5-397B-TP8-Base 145.457 → 144.481 (-0.7%) 0.291 → 0.289 (-0.7%) —
Qwen3.5-397B-TP8-DFlash 267.264 → 256.907 (-3.9%) 0.535 → 0.514 (-3.9%) 7.797 → 7.569 (-2.9%)

@apinge
apinge merged commit 21690e9 into apinge:qwen4_v0.5.21 Nov 10, 2026
9 checks passed
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