Skip to content

[ROCm][DSV4] Add opt-in C4 compressor GEMM fusion - #38920

Open
AMD-yanfeiwang wants to merge 2 commits into
sgl-project:mainfrom
AMD-yanfeiwang:perf/dsv4-c4-compressor-gemm-fusion
Open

AMD-yanfeiwang wants to merge 2 commits into
sgl-project:mainfrom
AMD-yanfeiwang:perf/dsv4-c4-compressor-gemm-fusion

Conversation

@AMD-yanfeiwang

@AMD-yanfeiwang AMD-yanfeiwang commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

DeepSeek V4 C4 computes 2048-wide main-compressor and 512-wide indexer projections from the same hidden state. This PR, stacked on #38919, combines them into one 2560-wide GEMM and splits the result into zero-copy row-strided views. PR2-only diff.

Modifications

  • Build fused weight aliases after loading and rebuild them after state assignment or device/dtype conversion.
  • Run one GEMM and pass the two views into the existing compressor tails.
  • Gate the ROCm path behind default-off SGLANG_OPT_DSV4_C4_COMPRESSOR_GEMM_FUSION=1.
  • Fall back for IPC weight cache, offload, prefill CP, unsupported weights, and C128.

Accuracy Tests

  • Fusion unit tests: 8 passed.
  • C4 v2 tests from [ROCm][DSV4] Support row-strided inputs in C4 v2 compression #38919: 37 passed.
  • IPC weight-cache protocol: 33 passed.
  • DeepSeek-V4-Pro TP8 off/on/off generated the same 128 greedy token IDs and text. Strict cross-restart logprob parity was inconclusive because the two unfused controls also differed.

Speed Tests and Profiling

The projection microbenchmark improved 11/12 graph buckets, with a 10.29% median latency reduction.

DeepSeek-V4-Pro TP8 serving on 8x MI355X/gfx950 used one fresh-container unfused-A/fused/unfused-B sandwich. C1/C4/C8/C16 all used random lengths in the 0.8-1.0x range with 8K/1K maxima, seeds 1001/1002/1003, 10 * concurrency measured requests, and an explicit 2 * concurrency warmup before every sample. Each arm also ran two full-shape priming sweeps. Radix cache, HiCache, and LMCache were disabled. All 36 measured windows were free of serving-time compilation, and request/token workloads matched exactly across arms.

C A / fused / B median tok/s Matched-seed throughput delta Matched-seed TPOT delta Max A/B drift (throughput / TPOT) Gate
1 83.38 / 84.98 / 85.67 +0.36% (+2.51/-0.60/+0.36%) +0.19% 3.11% / 3.29% Fail
4 255.31 / 254.98 / 253.69 -0.01% (-1.00/-0.01/+1.65%) +0.08% 2.94% / 2.87% Fail
8 424.40 / 425.89 / 417.67 +1.64% (+2.26/-1.07/+1.64%) +1.77% 2.17% / 2.05% Fail
16 625.61 / 652.85 / 638.72 +3.19% (+2.58/+4.57/+3.19%) +2.99% 3.06% / 3.07% Pass

The strict per-workload gate requires all three throughput and TPOT deltas to be positive, at least +1% median improvement for both metrics, and at most 5% A/B control drift per seed. C16 passes and supports a stable gain for this exact service workload. C1/C4 are neutral; C8 has a positive median but one negative seed. The feature remains default-off because API concurrency is not a reliable local-GEMM shape gate and the benefit is not uniform across workloads.

Checklist

  • Feature is ROCm-only and disabled by default.
  • Unsupported configurations fail closed to the existing path.

CI States

Latest PR Test (Base): ❌ Run #36813359346
Latest PR Test (Extra): ❌ Run #36813359178
Latest PR Test (AMD ROCm 10): ❌ Run #36813359504

This branch has not been deployed

No deployments
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.

1 participant