Skip to content

feat: support groupwise scaling for RHS - #31

Closed
XG-zheng wants to merge 1 commit into
deepseek-ai:mainfrom
XG-zheng:groupwise_gemm
Closed

XG-zheng wants to merge 1 commit into
deepseek-ai:mainfrom
XG-zheng:groupwise_gemm

Conversation

@XG-zheng

@XG-zheng XG-zheng commented Mar 1, 2025

Copy link
Copy Markdown

This MR extends the existing FP8 GEMM to support 128x1 groupwise scaling on the RHS.
Just some minor modifications:

  • use TMA to load scales_b from global memory to shared memory
  • scales_b is loaded from shared memory to the register Before each stage of accumulation scaling

test on H800 && CUDA 12.4:

  1. correctness: The shape in the readme can be passed.

  2. perf:

    • Small Shapes: Achieved 90+% performance of the original FP8 gemm.
    • Large Shapes (e.g., 4096x4096x7168): Shows ~30% performance regression.Still need optimization. Tried some optimizations but no good results.
M N K Groupwise FP8 Gemm-Computation FP8 Gemm-Computation
64 2112 7168 153 TFLOPS 190 TFLOPS
64 24576 1536 262 TFLOPS 283 TFLOPS
64 32768 512 212 TFLOPS 207 TFLOPS
64 7168 16384 307 TFLOPS 326 TFLOPS
64 4096 7168 251 TFLOPS 268 TFLOPS
64 7168 2048 246 TFLOPS 262 TFLOPS
128 2112 7168 275 TFLOPS 337 TFLOPS
128 24576 1536 472 TFLOPS 526 TFLOPS
128 32768 512 328 TFLOPS 347 TFLOPS
128 7168 16384 595 TFLOPS 628 TFLOPS
128 4096 7168 456 TFLOPS 502 TFLOPS
128 7168 2048 424 TFLOPS 463 TFLOPS
4096 2112 7168 861 TFLOPS 1016 TFLOPS
4096 24576 1536 767 TFLOPS 973 TFLOPS
4096 32768 512 557 TFLOPS 592 TFLOPS
4096 7168 16384 964 TFLOPS 1313 TFLOPS
4096 4096 7168 925 TFLOPS 1278 TFLOPS
4096 7168 2048 844 TFLOPS 988 TFLOPS

@LyricZhao

Copy link
Copy Markdown
Collaborator

Thanks for your contribution! This is really helpful for WGRAD cases. But I don't think merging it in current status is good: e.g. the FFMA pattern can be still found, making it as a clean/unified/maintainable impl with the original one. And we also have our internal impl waiting to push.

Large shapes (e.g., 4096x4096x7168): shows ~30% performance regression. Still need optimization. Tried some optimizations but no good results.

I guess it is related to the double scaling factor final_accum[i * 4 + 0] += scale_a_0 * scale_b_0 * accum[i * 4 + 0], the performance slow-down is somehow in expectation (we are also trying to figure it out).

Later @xuzhean will follow up (about finishing in this week), and we will push our internal unified impl, so closing it right now.

@LyricZhao LyricZhao closed this Mar 3, 2025
LyricZhao pushed a commit that referenced this pull request Apr 16, 2026
SystemPanic pushed a commit to SystemPanic/DeepGEMM-windows that referenced this pull request Nov 4, 2026
…pseek-ai#31)

When DeepGEMM is vendored under another package name (vLLM ships it as
vllm.third_party.deep_gemm), the hardcoded 'deep_gemm._C.locality_domain'
key does not match the relative 'from ._C.locality_domain import' in
locality_domain.py, so importing the package fails.

Signed-off-by: Yongye Zhu <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants