[GH-ISSUE #33] Use col-major tensor for DeepGemm #20

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

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

It is said that the A tensor should be col-major. and to meet the requirement of TMA, it should do some padding or transposition.

'''
LHS scales must be transposed for TMA load, but not for RHS scales
lhs_scales = get_col_major_tma_aligned_tensor(lhs_scales)
'''

Is there any reason why we don't choose the row-major? It seems that the alignment for K is more easier to meet.

Thanks a lot!

Originally created by @PuALGuo on GitHub (Mar 3, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/33 It is said that the A tensor should be col-major. and to meet the requirement of TMA, it should do some padding or transposition. ''' LHS scales must be transposed for TMA load, but not for RHS scales lhs_scales = get_col_major_tma_aligned_tensor(lhs_scales) ''' Is there any reason why we don't choose the row-major? It seems that the alignment for K is more easier to meet. Thanks a lot!
Author
Owner

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

This is because each stage does a GEMM with K_BLOCK_SIZE=128, so each stage only reads one scale in the K direction. If we were to use row-major layout, TMA would only read one scale (4 bytes) of continuous memory at a time, resulting in very low reading efficiency.

<!-- gh-comment-id:2696094777 --> @soundOfDestiny commented on GitHub (Mar 4, 2025): This is because each stage does a GEMM with K_BLOCK_SIZE=128, so each stage only reads one scale in the K direction. If we were to use row-major layout, TMA would only read one scale (4 bytes) of continuous memory at a time, resulting in very low reading efficiency.
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#20
No description provided.