[ROCm][Perf] Add bpreshuffled blockscaled fp8 GEMM - #51692
Conversation
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
…oproj-bpreshuffle Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
|
@Rohan138 Happy to get a re-review on this one whenever you have time, thanks 🙏 |
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
…lm into orchestrator/consolidate-gemm-loader Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
|
✅ @simondanielsson, CI is now available for this PR.
|
|
@simondanielsson I cancelled this build cause like the other 2 it creates a huge workload for our CI. When you relaunch CI, please wait for each PR to finish and then launch CI for you next PR. |
|
/ci run |
|
✅ Triggered Buildkite CI #87912 for commit |
|
@AndreasKaratzas Same on this PR. Only failing tests are the same as in nightly. Can you check please? 🙏 Thanks |
|
Indeed they are from nightly. |
|
/ci run |
|
✅ Triggered Buildkite CI #88123 for commit |
|
/ci retry |
|
✅ Queued 8 failed job(s) for retry in Buildkite CI #88123. |
|
Was this PR tested on DeepSeek V3/V4 TP8? I'm seeing garbage output on the former, and it refuses to initialize on the latter (it hits the not implemented |
@mawong-amd Hi, yes tested on V3 TP8 (note: vanilla dense v3). Let me also test again |
… N % 128 gate Follow-up to vllm-project#51692 / vllm-project#56433 (AITER preshuffled fp8 block-scale GEMM): * Fusion passes: register transposed-scale variants of the AITER RMSNorm(+add)+group-quant, AllReduce+RMSNorm+group-quant and SiLU*mul+ group-quant patterns, so the quant the preshuffled kernel emits (rocm_aiter_group_fp8_quant(x, 128, transpose_scale=True)) is matched and folded into the fused producer op instead of being left as a separate kernel behind a bf16 norm. MatcherQuantFP8 carries the flag. * Producers write the kernel's column-major scale layout directly: fused_allreduce_rmsnorm_quant_per_group via AITER's transpose_scale (re-viewed [G, M] -> [M, G], no copy), fused_rms_fp8_group_quant via its transpose_scale, act_mul via the HIP silu_and_mul_quant(shuffle_scale) kernel. No transpose copies remain. * AiterPreshuffledFp8BlockScaledMMKernel.can_implement: require N % 16 (the (16,16) preshuffle) and K % 128 instead of N % 128. DeepSeek's fused_qkv_a_proj (N = 2112) was falling back to the Triton GEMM (134.7 vs 44.8 us per layer at M = 1024 on MI355X). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… N % 128 gate Follow-up to vllm-project#51692 / vllm-project#56433 (AITER preshuffled fp8 block-scale GEMM): * Fusion passes: register transposed-scale variants of the AITER RMSNorm(+add)+group-quant, AllReduce+RMSNorm+group-quant and SiLU*mul+ group-quant patterns, so the quant the preshuffled kernel emits (rocm_aiter_group_fp8_quant(x, 128, transpose_scale=True)) is matched and folded into the fused producer op instead of being left as a separate kernel behind a bf16 norm. MatcherQuantFP8 carries the flag. * Producers write the kernel's column-major scale layout directly: fused_allreduce_rmsnorm_quant_per_group via AITER's transpose_scale (re-viewed [G, M] -> [M, G], no copy), fused_rms_fp8_group_quant via its transpose_scale, act_mul via the HIP silu_and_mul_quant(shuffle_scale) kernel. No transpose copies remain. * AiterPreshuffledFp8BlockScaledMMKernel.can_implement: require N % 16 (the (16,16) preshuffle) and K % 128 instead of N % 128. DeepSeek's fused_qkv_a_proj (N = 2112) was falling back to the Triton GEMM (134.7 vs 44.8 us per layer at M = 1024 on MI355X). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… N % 128 gate Follow-up to vllm-project#51692 / vllm-project#56433 (AITER preshuffled fp8 block-scale GEMM): * Fusion passes: register transposed-scale variants of the AITER RMSNorm(+add)+group-quant, AllReduce+RMSNorm+group-quant and SiLU*mul+ group-quant patterns, so the quant the preshuffled kernel emits (rocm_aiter_group_fp8_quant(x, 128, transpose_scale=True)) is matched and folded into the fused producer op instead of being left as a separate kernel behind a bf16 norm. MatcherQuantFP8 carries the flag. * Producers write the kernel's column-major scale layout directly: fused_allreduce_rmsnorm_quant_per_group via AITER's transpose_scale (re-viewed [G, M] -> [M, G], no copy), fused_rms_fp8_group_quant via its transpose_scale, act_mul via the HIP silu_and_mul_quant(shuffle_scale) kernel. No transpose copies remain. * AiterPreshuffledFp8BlockScaledMMKernel.can_implement: require N % 16 (the (16,16) preshuffle) and K % 128 instead of N % 128. DeepSeek's fused_qkv_a_proj (N = 2112) was falling back to the Triton GEMM (134.7 vs 44.8 us per layer at M = 1024 on MI355X). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… N % 128 gate Follow-up to vllm-project#51692 / vllm-project#56433 (AITER preshuffled fp8 block-scale GEMM): * Fusion passes: register transposed-scale variants of the AITER RMSNorm(+add)+group-quant, AllReduce+RMSNorm+group-quant and SiLU*mul+ group-quant patterns, so the quant the preshuffled kernel emits (rocm_aiter_group_fp8_quant(x, 128, transpose_scale=True)) is matched and folded into the fused producer op instead of being left as a separate kernel behind a bf16 norm. MatcherQuantFP8 carries the flag. * Producers write the kernel's column-major scale layout directly: fused_allreduce_rmsnorm_quant_per_group via AITER's transpose_scale (re-viewed [G, M] -> [M, G], no copy), fused_rms_fp8_group_quant via its transpose_scale, act_mul via the HIP silu_and_mul_quant(shuffle_scale) kernel. No transpose copies remain. * AiterPreshuffledFp8BlockScaledMMKernel.can_implement: require N % 16 (the (16,16) preshuffle) and K % 128 instead of N % 128. DeepSeek's fused_qkv_a_proj (N = 2112) was falling back to the Triton GEMM (134.7 vs 44.8 us per layer at M = 1024 on MI355X). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: simondanielsson <simon.danielsson99@hotmail.com>
Purpose
Activated when shapes allow for it and configs are tuned.
Implications (DSv3 1k/1K):
Test Plan
Bench serve & accuracy validation with DSv3 on (1) TP8+DPA (2) TP8+EP on 8xMI350.
(note need to run with
VLLM_ROCM_USE_AITER_FP8BMM=0until #51957 is resolved)VLLM_ROCM_USE_AITER=1 \ VLLM_ROCM_USE_AITER_FP8BMM=0 \ vllm serve deepseek-ai/DeepSeek-V3-0324 \ --data-parallel-size 8 \ --tensor-parallel-size 1 \ --gpu-memory-utilization 0.8 \Sweep concurrencies 1-128, 1k/1k
vllm bench serve \ --backend vllm \ --model deepseek-ai/DeepSeek-V3-0324 \ --dataset-name random \ --random-input-len 1024 \ --random-output-len 1024 \ --host localhost \ --port 8000 \ --ignore-eos \ --ready-check-timeout-sec 6000 \ --seed 5678 \ --max-concurrency 128 \ --num-prompts 1280 --num-warmups 256'Test Result
Profiling
This branch: Using DPA, the MLA decode o-proj is using preshuffled weights. No other GEMM is changed. 21us in trace.
Main branch: ck-tile kernel for o-proj. 52us in trace, so more than 2x slower that of the bpreshuffled version!
TP8+DPA
TP8+EP
GSM8k
This branch (TP8+DPA)
Nightly
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.