[GH-ISSUE #52] [Question] Why use one Math Warp-Group when block_m==64? #31

Closed
opened 2026-10-26 21:10:55 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @ZJUGuoShuai on GitHub (Mar 10, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/52

First of all, thanks to all of you guys open-sourcing this amazing repo for showing us how to implement an optimized FP8 GEMM.

I've been reading the implementation these days for learning. And I wonder why it launches CTAs with 1 Math Warp-Group when block_m==64 while launching CTAs with 2 Math Warp-Groups otherwise?

This is the code that determines how many Math Warp-Groups a CTA has, based on block_m.

template <uint32_t kNumTMAThreads, uint32_t kNumMathThreadsPerGroup>
__device__ __host__ constexpr int get_num_threads_per_sm(int block_m) {
    DG_STATIC_ASSERT(kNumMathThreadsPerGroup == 128, "Only support 128 threads per math group");
    return (block_m == 64 ? 1 : 2) * kNumMathThreadsPerGroup + kNumTMAThreads;
}

Can someone give me some hints?

Originally created by @ZJUGuoShuai on GitHub (Mar 10, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/52 First of all, thanks to all of you guys open-sourcing this amazing repo for showing us how to implement an optimized FP8 GEMM. I've been reading the implementation these days for learning. And I wonder **why it launches CTAs with 1 Math Warp-Group when `block_m==64` while launching CTAs with 2 Math Warp-Groups otherwise**? This is the code that determines how many Math Warp-Groups a CTA has, based on `block_m`. ```cpp template <uint32_t kNumTMAThreads, uint32_t kNumMathThreadsPerGroup> __device__ __host__ constexpr int get_num_threads_per_sm(int block_m) { DG_STATIC_ASSERT(kNumMathThreadsPerGroup == 128, "Only support 128 threads per math group"); return (block_m == 64 ? 1 : 2) * kNumMathThreadsPerGroup + kNumTMAThreads; } ``` Can someone give me some hints?
Author
Owner

@LyricZhao commented on GitHub (Mar 10, 2025):

The m dim of WGMMA instruction is 64 (no m-32 instructions), see the PTX doc: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#asynchronous-warpgroup-level-matrix-shape

<!-- gh-comment-id:2709454331 --> @LyricZhao commented on GitHub (Mar 10, 2025): The m dim of WGMMA instruction is 64 (no m-32 instructions), see the PTX doc: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#asynchronous-warpgroup-level-matrix-shape
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepGEMM#31
No description provided.