mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #15] Both layouts of Grouped GEMMs need to be aligned to the GEMM M block size ? #14
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @CtfGo on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/15
m_grouped_gemm_fp8_fp8_bf16_nt_contiguousfunction documentation says thatwhich means the M of each group must be multiples of 128?
m_grouped_gemm_fp8_fp8_bf16_nt_masked, but I test several M(8, 16, 64)that don't meet the requirement ontest/test_core.pybytest_m_grouped_gemm_maskedand found they can't pass the correctness validation, so does the masked layout grouped gemm also has the limitation implicitly?@LyricZhao commented on GitHub (Feb 27, 2025):
Yes.
No limitation for the masked kernel, could you please share you modified test script?
@CtfGo commented on GitHub (Feb 27, 2025):
@LyricZhao Hi, thank you for your reply and appreciate your awesome work.
I just modify the two lines on
test/test_core.py test_m_grouped_gemm_maskedto test othernum_groupsandm, the detail diff is:then run
python test/test_core.py, and will see AssertionError of the diff check:test machine environment: Nvidia H800、cuda 12.4、torch 2.6.0+cu124
@LyricZhao commented on GitHub (Feb 27, 2025):
Fixed in main, commit:
github.com/deepseek-ai/DeepGEMM@ca13ce0fabandgithub.com/deepseek-ai/DeepGEMM@6da94d2d36The reason is wrong TMA store block size when
shape_mis smaller thanBLOCK_M. So currently we restrictshape_m <= BLOCK_M or shape_m % BLOCK_M == 0if for masked GEMM with more than one group.Thanks for feedback!
@CtfGo commented on GitHub (Feb 28, 2025):
It looks well now.
Are these limitations necessary to achieve good performance?can we remove them to support any
m? for example, by passing extra params that can indicate batch size or data address of each group, like exclusive_sum.@LyricZhao commented on GitHub (Feb 28, 2025):
Not necessary, they are TMA limitations. If we are using 2D
[num_groups * m, k]TMA store, I guess there's no way to bypass the limitation (one group may overwrite to the next group).A possible solution is to use 3D TMA
[num_groups, m, k], but I don't think adding such support for some rare cases is good.@CtfGo commented on GitHub (Mar 1, 2025):
Got it, thanks for your explanation.