[GH-ISSUE #35] performance on H800 does not meet expectations for small batchsize #23

Closed
opened 2026-10-26 21:10:41 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @Planck-a on GitHub (Mar 4, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/35

I tested gemm on H800 SXM,k=7168,n=2112. I was confused that when bsz increased from 1 to 64, the gemm time was decreasing as m increased. This phenomenon also occurred in 64-128, which seemed to be related to the number of SMs. It seems that there is only optimized for bsz=64/128, is there any suggestion how to optimize other bsz like 1-32 ,thx

Image

Image

Originally created by @Planck-a on GitHub (Mar 4, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/35 I tested gemm on H800 SXM,k=7168,n=2112. I was confused that when bsz increased from 1 to 64, the gemm time was decreasing as m increased. This phenomenon also occurred in 64-128, which seemed to be related to the number of SMs. It seems that there is only optimized for bsz=64/128, is there any suggestion how to optimize other bsz like 1-32 ,thx ![Image](https://github.com/user-attachments/assets/5bc98ec3-c991-42e8-9c75-22a769b7fac0) ![Image](https://github.com/user-attachments/assets/f0d7c86d-432b-4b0f-8430-e006aaa69db7)
Author
Owner

@soundOfDestiny commented on GitHub (Mar 4, 2025):

This is because TMA load is faster for m=132 than for m=68 due to boundary check.
You can pad your input tensor (LHS and LHS scale) to get better performance.
For a quick test, you could change shape_m in make_2d_tma_a_desc in deep_gemm/include/deep_gemm/fp8_gemm.cuh to a padded size, and you would observe that it becomes faster for m=68.
However, we won't do that due to the risk of illegal read.

<!-- gh-comment-id:2697304429 --> @soundOfDestiny commented on GitHub (Mar 4, 2025): This is because TMA load is faster for m=132 than for m=68 due to boundary check. You can pad your input tensor (LHS and LHS scale) to get better performance. For a quick test, you could change shape_m in make_2d_tma_a_desc in deep_gemm/include/deep_gemm/fp8_gemm.cuh to a padded size, and you would observe that it becomes faster for m=68. However, we won't do that due to the risk of illegal read.
Author
Owner

@Planck-a commented on GitHub (Mar 4, 2025):

@soundOfDestiny thx,but my question is why m=64 is faster than m=4 ? Is this reasonable?

<!-- gh-comment-id:2697317298 --> @Planck-a commented on GitHub (Mar 4, 2025): @soundOfDestiny thx,but my question is why m=64 is faster than m=4 ? Is this reasonable?
Author
Owner

@soundOfDestiny commented on GitHub (Mar 4, 2025):

@soundOfDestiny thx,but my question is why m=64 is faster than m=4 ? Is this reasonable?

It's the same reason and you can do the quick test mentioned above:
You could replace shape_m in make_2d_tma_a_desc in deep_gemm/include/deep_gemm/fp8_gemm.cuh with 64, and you would observe that it becomes faster for m=4.

<!-- gh-comment-id:2697331509 --> @soundOfDestiny commented on GitHub (Mar 4, 2025): > [@soundOfDestiny](https://github.com/soundOfDestiny) thx,but my question is why m=64 is faster than m=4 ? Is this reasonable? It's the same reason and you can do the quick test mentioned above: You could replace `shape_m` in `make_2d_tma_a_desc` in `deep_gemm/include/deep_gemm/fp8_gemm.cuh` with 64, and you would observe that it becomes faster for m=4.
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#23
No description provided.