mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #47] [CLOSED] Add kernel‘s config cache and improve TMA alignment #218
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#218
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?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/47
Author: @DXHPC
Created: 3/7/2025
Status: ❌ Closed
Base:
main← Head:dev_config_cache📝 Commits (3)
ba142b8config cache and tensor alignment fix0b5d353tensor alignment fixde1603dfix typo📊 Changes
4 files changed (+122 additions, -92 deletions)
View changed files
➕
deep_gemm/jit_kernels/config.py(+99 -0)📝
deep_gemm/jit_kernels/gemm.py(+2 -75)📝
deep_gemm/jit_kernels/m_grouped_gemm.py(+4 -3)📝
deep_gemm/jit_kernels/utils.py(+17 -14)📄 Description
When testing the function deep_gemm.gemm_fp8_fp8_bf16_nt, we observed that for certain examples, especially matrices with small shapes, the overhead outside of the GEMM kernel's execution was non-negligible. By using PyTorch's profiler, we found that the execution of the functions get_col_major_tma_aligned_tensor and get_best_configs introduces significant overhead.

We tried to perform memory alignment in advance by calling the function get_col_major_tma_aligned_tensor before invoking the function deep_gemm.gemm_fp8_fp8_bf16_nt. But we still noticed that the alignment-related operations were triggered during the execution of deep_gemm.gemm_fp8_fp8_bf16_nt. Additionally, the function get_best_configs redundantly executes for the same inputs, yielding the same results, which introduces unnecessary overhead.
First, we fixed the improper handling of 2D matrices in function get_col_major_tma_aligned_tensor. Additionally, we added a cache to obtain the optimal configuration before the GEMM kernel launches, which reduces overhead for inputs of the same size.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.