[Perf][GDN] Pack unquantized Qwen3.5 GDN input projections and restore compiled FP8 dual-stream overlap #387
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #387"
general
weight: 0.35
yeahdongcn
Summary
Fixes two input-projection bottlenecks in
MusaQwenGatedDeltaNetAttention(Qwen3.5/Qwen3.6GDN hybrid layers) on MUSA S5000:1. Packed Single-GEMM Fusion for Unquantized BF16/FP16 GDN (
MUSA_GDN_PACKED_PROJ=1, default on):- Previously, every GDN layer (
18layers onQwen3.5-2B,30layers onQwen3.5-35B-A3B) executed two separate GEMMs (in_proj_qkvz+ tiny[M, 2 num_v_heads_tp]in_proj_ba), paying an extra GEMM launch and redundanthidden_statesDRAM read per layer.-
process_weights_after_loadinghorizontally packs[in_proj_qkvz.weight; in_proj_ba.weight]once after weight loading when eligible (MergedColumnParallelLinear, unquantized BF16/FP16,bias is None,not disable_tp_for_ba_proj,not gqa_interleaved_layout, 16B-alignedbawidth) and rebindsqkvz_w.data/ba_w.datato views of the packed tensor (zero extra VRAM).- Pairs single
F.linear(hidden_states, packed_weight)with a newfused_zba_packedTileLang kernel (gdn_fused_proj.py) that materializes contiguous(z, b, a)in one launch while keepingmixed_qkv = mixed_qkvzba[:, :qkv_size]as a zero-copy strided view.- Note*: At very large compute-bound prefill
M >= 1024, appending32bacolumns (N = 10240 -> 10272onQwen3.5-2BTP=1) adds onemuBLASLtN-tile (0.91x–0.99xisolated GEMM), whileM = 1..512gains1.27x–1.50xeager and1.30x–1.56xCUDAGraph (+1.27%compiled E2E prefill,+8.72%c=1decode,+3.43%c=64decode).2. Submodule-Deduped Dynamo-Opaque Dual-Stream Overlap for Block-FP8 GDN (
MUSA_GDN_OPAQUE_DUAL_STREAM=1, default on):- Under
torch.compile,_forward_input_projectionspreviously evaluated_is_current_stream_capturing()during Dynamo warmup tracing (False), specializing the graph on the serial path soin_proj_qkvz+in_proj_badual-stream overlap became dead code during CUDAGraph capture and replay across all 30 GDN layers.- Introduces a stateless,
layer_name-free custom optorch.ops.vllm.musa_gdn_fp8_qkvz_bf16_ba_proj(hidden_states, qkvz_weight, qkvz_weight_scale, ba_weight, group_size, use_deep_gemm_e8m0):- Avoids per-layer string constants so vLLM's Inductor cache preserves 100% submodule deduplication (
24compiled artifacts onQwen3.5-35B-A3B-FP8, identical to baseline) and bypasses 30 nestedMergedColumnParallelLinear.forward -> Fp8LinearMethod.applyPython dispatches during eager prefill.- During CUDAGraph capture (
0 < num_tokens < 1024), overlapsrun_deepgemm(...)(in_proj_qkvz) oncurrent_streamconcurrently withtorch.mm(..., out=ba)(in_proj_ba) onalt_stream.---
S5000 Hardware Validation (
MTT S5000, 64 MPs,torch 2.13.0.post1+musa5.2.0,mate 0.2.8.post1)1. Unit & Compile Tests
pytest tests/test_gdn_dual_stream_source.py tests/test_gdn_full_graph_metadata_source.py tests/test_gdn_fused_zba_compile.py tests/test_qwen_gdn_output_allocation.py tests/kernels/test_qwen_gdn_proj_musa.py:46 passed.python3 tools/musa_sync.py check-series&verify:PASS(222 clean / 257 total / 0 need attention).2. Cold-Cache Eager & Multi-Layer CUDAGraph Microbenchmarks
(a) Unquantized BF16 Packed Single-GEMM +
fused_zba_packed| Shape (
layers_cg) |M| Eager Ref (ms) | Eager Packed (ms) | Eager Speedup | CG Serial (ms) | CG Dual-Stream (ms) | CG Packed (ms) | CG vs Serial | CG vs Dual ||---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
Qwen3.5-2BTP=1 (18L) | 1 | 0.1305 | 0.0990 | 1.319x | 0.8477 | 0.8350 | 0.6152 | 1.378x | 1.357x ||
Qwen3.5-2BTP=1 (18L) | 16 | 0.0911 | 0.0648 | 1.405x | 0.8860 | 0.8645 | 0.6189 | 1.432x | 1.397x ||
Qwen3.5-2BTP=1 (18L) | 64 | 0.0964 | 0.0658 | 1.465x | 0.8700 | 0.8376 | 0.6373 | 1.365x | 1.314x ||
Qwen3.5-2BTP=2 (18L) | 1 | 0.1333 | 0.1052 | 1.268x | 0.6623 | 0.6503 | 0.4475 | 1.480x | 1.453x ||
Qwen3.5-2BTP=2 (18L) | 64 | 0.0893 | 0.0599 | 1.489x | 0.6984 | 0.6867 | 0.4485 | 1.557x | 1.531x ||
Qwen3.5-35B-A3BTP=1 (30L) | 1 | 0.0891 | 0.0654 | 1.362x | 1.6524 | 1.3766 | 1.2750 | 1.296x | 1.080x ||
Qwen3.5-35B-A3BTP=2 (30L) | 1 | 0.0920 | 0.0647 | 1.422x | 1.2080 | 1.1907 | 0.8060 | 1.499x | 1.477x ||
Qwen3.5-35B-A3BTP=2 (30L) | 16 | 0.0939 | 0.0647 | 1.451x | 1.2386 | 1.2103 | 0.8161 | 1.518x | 1.483x |(b) Block-FP8 30-Layer
torch.compile+ CUDAGraph (musa_gdn_fp8_qkvz_bf16_ba_proj)| Shape (30L) |
M=1(ms) |M=4(ms) |M=16(ms) |M=32(ms) |M=64(ms) ||---|---:|---:|---:|---:|---:|
|
Qwen3.5-35B-A3B-FP8TP=1 (base -> dual) |1.2836 -> 1.0351(1.240x) |1.2961 -> 1.0408(1.245x) |1.3218 -> 1.0528(1.255x) |1.3499 -> 1.0747(1.256x) |1.3596 -> 1.2711(1.070x) ||
Qwen3.5-35B-A3B-FP8TP=2 (base -> dual) |1.0745 -> 0.9602(1.119x) |1.0862 -> 0.9735(1.116x) |1.0861 -> 0.9691(1.121x) |1.1054 -> 0.9961(1.110x) |1.1444 -> 1.0497(1.090x) |3. Compiled + CUDAGraph End-to-End Serving A/B/A/B (Isolated
VLLM_CACHE_ROOT,enable_prefix_caching=False)| Model (TP=1,
FULL_AND_PIECEWISE) | Stage | Baseline (tok/s) | Optimized (tok/s) | E2E Gain ||---|---|---:|---:|---:|
|
Qwen3.5-2B(BF16) | Prefill (4 × 274) | 18,737.81 | 18,975.96 |+1.27%||
Qwen3.5-2B(BF16) | Decode (c=1) | 210.87 | 229.25 |+8.72%||
Qwen3.5-2B(BF16) | Batched Decode (c=64) | 8,798.06 | 9,100.15 |+3.43%||
Qwen3.5-35B-A3B-FP8(FP8) | Prefill (4 × 274) | 6,686.35 | 6,816.23 |+1.94%||
Qwen3.5-35B-A3B-FP8(FP8) | Decode (c=1) | 95.05 | 97.08 |+2.13%||
Qwen3.5-35B-A3B-FP8(FP8) | Batched Decode (c=16) | 1,001.06 | 1,014.93 |+1.39%|4. TP=2 Compiled + CUDAGraph Regression Smokes
dense_tp2(Qwen3-8B,FLASH_ATTN): PASSmoe_fp8_tp2(Qwen3-30B-A3B-FP8,FLASH_ATTN): PASSmla_tp2(DeepSeek-V2-Lite-Chat,FLASH_MLA): PASSgdn_moe_fp8_tp2(Qwen3.5-35B-A3B-FP8,GDN+FLASH_ATTN): PASS