14 views
deepseek-ai/DeepGEMM
DeepGEMM: clean and efficient BLAS kernel library on GPU
Cuda★ 8,776+199 that day#6 on trending
D51.6/100
Duplication36
13.4% in cpp-header, python, bash, perl, cppDead code89
0.8%Complexity59
40% The score is jscpd's own --health model: markup, data and text left out, tests kept. The numbers below are the trending scan's.
17.48%duplicated code · 2,453 of 14,030 lines
243clones in code
78code files of 107 scanned
12.63%duplicated over all files · 252 clones
Most complex files
Dead code 0.75% unused · 12 findings
- deep_gemm/locality_domain.py:get_granularityunused-import
- deep_gemm/utils/layout.py:get_tma_aligned_sizeunused-import
- deep_gemm/locality_domain.py:emptyunused-import
- deep_gemm/utils/layout.py:get_mn_major_tma_aligned_tensorunused-import
- deep_gemm/utils/layout.py:get_mn_major_tma_aligned_packed_ue8m0_tensorunused-import
- deep_gemm/utils/layout.py:get_k_grouped_mn_major_tma_aligned_packed_ue8m0_tensorunused-import
- deep_gemm/locality_domain.py:get_sm_locality_domainsunused-import
- deep_gemm/utils/layout.py:set_mk_alignment_for_contiguous_layoutunused-import
- deep_gemm/locality_domain.py:get_balanced_sm_locality_domainsunused-import
- deep_gemm/utils/layout.py:get_theoretical_mk_alignment_for_contiguous_layoutunused-import
The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code.
Largest clones in the code
- 10 lines in 17 placescpp-header80 tokenscsrc/jit_kernels/impls/sm100_bf16_gemm.hpp:121–130csrc/jit_kernels/impls/sm100_bf16_gemm.hpp:193–202csrc/jit_kernels/impls/sm100_bf16_gemm.hpp:251–260csrc/jit_kernels/impls/sm100_bf16_gemm.hpp:318–327csrc/jit_kernels/impls/sm100_fp8_fp4_gemm_1d1d.hpp:146–155and 12 more
121SM100BF16GemmRuntime::compile_and_launch("sm100_bf16_gemm", { 122 .gemm_desc = desc, 123 .gemm_config = config, 124 .options = { 125 .num_smem_bytes = config.pipeline_config.smem_size, 126 .grid_dim = dim3(config.launch_config.num_sms, 1, 1), 127 .block_dim = dim3(config.launch_config.num_threads, 1, 1), 128 .cluster_dim = dim3(config.layout.get_cluster_size(), 1, 1), 129 }, 130 .grouped_layout = nullptr,193SM100BF16GemmRuntime::compile_and_launch("sm100_bf16_m_grouped_gemm_contiguous", { 194 .gemm_desc = desc, 195 .gemm_config = config, 196 .options = { 197 .num_smem_bytes = config.pipeline_config.smem_size, 198 .grid_dim = dim3(config.launch_config.num_sms, 1, 1), 199 .block_dim = dim3(config.launch_config.num_threads, 1, 1), 200 .cluster_dim = dim3(config.layout.get_cluster_size(), 1, 1), 201 }, 202 .grouped_layout = grouped_layout.data_ptr(), - 31 lines in 2 placescpp-header327 tokenscsrc/jit_kernels/impls/sm100_tf32_hc_prenorm_gemm.hpp:28–58csrc/jit_kernels/impls/sm90_tf32_hc_prenorm_gemm.hpp:30–60
28DG_HOST_ASSERT(n <= 128 and n % 8 == 0); 29DG_HOST_ASSERT(k % block_k == 0); 30 31const auto swizzle_cd_mode = get_swizzle_mode(block_n, sizeof(float)); 32const auto tensor_map_a = make_tma_a_desc(cute::UMMA::Major::K, a, m, k, 33 block_m, block_k, 34 static_cast<int>(a.stride(get_non_contiguous_dim(cute::UMMA::Major::K))), 1, 35 get_swizzle_mode(block_k, a.element_size()), 0, 36 true); 37const auto tensor_map_b = make_tma_b_desc(cute::UMMA::Major::K, b, n, k,First 10 of 31 lines.
- 12 lines in 3 placescpp-header146 tokens
135static void fp8_fp4_gemm_nn(const std::pair<torch::Tensor, torch::Tensor>& a, 136 const std::pair<torch::Tensor, torch::Tensor>& b, 137 const torch::Tensor& d, 138 const std::optional<torch::Tensor>& c, 139 const std::optional<std::tuple<int, int, int>>& recipe, 140 const std::optional<std::tuple<int, int>>& recipe_a, 141 const std::optional<std::tuple<int, int>>& recipe_b, 142 const std::string& compiled_dims, 143 const bool& disable_ue8m0_cast, 144 const std::optional<float>& alpha,First 10 of 12 lines.
7 more
- 13 lines in 4 placescpp-header97 tokens
- 13 lines in 6 placescpp-header52 tokens
- 12 lines in 3 placescpp-header125 tokens
- 7 lines in 4 placescpp-header70 tokens
- 14 lines in 2 placescpp-header204 tokens
- 19 lines in 2 placescpp-header178 tokens
- 10 lines in 2 placespython178 tokens
Largest clones over all files, tests and data included
- 10 lines in 17 placescpp-header80 tokenscsrc/jit_kernels/impls/sm100_bf16_gemm.hpp:121–130csrc/jit_kernels/impls/sm100_bf16_gemm.hpp:193–202csrc/jit_kernels/impls/sm100_bf16_gemm.hpp:251–260csrc/jit_kernels/impls/sm100_bf16_gemm.hpp:318–327csrc/jit_kernels/impls/sm100_fp8_fp4_gemm_1d1d.hpp:146–155and 12 more
121SM100BF16GemmRuntime::compile_and_launch("sm100_bf16_gemm", { 122 .gemm_desc = desc, 123 .gemm_config = config, 124 .options = { 125 .num_smem_bytes = config.pipeline_config.smem_size, 126 .grid_dim = dim3(config.launch_config.num_sms, 1, 1), 127 .block_dim = dim3(config.launch_config.num_threads, 1, 1), 128 .cluster_dim = dim3(config.layout.get_cluster_size(), 1, 1), 129 }, 130 .grouped_layout = nullptr,193SM100BF16GemmRuntime::compile_and_launch("sm100_bf16_m_grouped_gemm_contiguous", { 194 .gemm_desc = desc, 195 .gemm_config = config, 196 .options = { 197 .num_smem_bytes = config.pipeline_config.smem_size, 198 .grid_dim = dim3(config.launch_config.num_sms, 1, 1), 199 .block_dim = dim3(config.launch_config.num_threads, 1, 1), 200 .cluster_dim = dim3(config.layout.get_cluster_size(), 1, 1), 201 }, 202 .grouped_layout = grouped_layout.data_ptr(), - 31 lines in 2 placescpp-header327 tokenscsrc/jit_kernels/impls/sm100_tf32_hc_prenorm_gemm.hpp:28–58csrc/jit_kernels/impls/sm90_tf32_hc_prenorm_gemm.hpp:30–60
28DG_HOST_ASSERT(n <= 128 and n % 8 == 0); 29DG_HOST_ASSERT(k % block_k == 0); 30 31const auto swizzle_cd_mode = get_swizzle_mode(block_n, sizeof(float)); 32const auto tensor_map_a = make_tma_a_desc(cute::UMMA::Major::K, a, m, k, 33 block_m, block_k, 34 static_cast<int>(a.stride(get_non_contiguous_dim(cute::UMMA::Major::K))), 1, 35 get_swizzle_mode(block_k, a.element_size()), 0, 36 true); 37const auto tensor_map_b = make_tma_b_desc(cute::UMMA::Major::K, b, n, k,First 10 of 31 lines.
- 12 lines in 3 placescpp-header146 tokens
135static void fp8_fp4_gemm_nn(const std::pair<torch::Tensor, torch::Tensor>& a, 136 const std::pair<torch::Tensor, torch::Tensor>& b, 137 const torch::Tensor& d, 138 const std::optional<torch::Tensor>& c, 139 const std::optional<std::tuple<int, int, int>>& recipe, 140 const std::optional<std::tuple<int, int>>& recipe_a, 141 const std::optional<std::tuple<int, int>>& recipe_b, 142 const std::string& compiled_dims, 143 const bool& disable_ue8m0_cast, 144 const std::optional<float>& alpha,First 10 of 12 lines.
- 13 lines in 4 placescpp-header97 tokens
- 13 lines in 6 placescpp-header52 tokens
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| cpp-header | 48 | 10,079 | 230 | 2,311 | 22.93% |
| python | 16 | 2,957 | 13 | 142 | 4.8% |
| bash | 12 | 771 | 0 | 0 | 0% |
| perl | 1 | 174 | 0 | 0 | 0% |
| cpp | 1 | 49 | 0 | 0 | 0% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| cpp-header | 48 | 10,079 | 230 | 2,311 | 22.93% |
| python | 36 | 7,760 | 21 | 195 | 2.51% |
| yaml | 3 | 375 | 1 | 16 | 4.27% |
| bash | 12 | 771 | 0 | 0 | 0% |
| markdown | 2 | 684 | 0 | 0 | 0% |
| perl | 1 | 174 | 0 | 0 | 0% |
| cpp | 2 | 54 | 0 | 0 | 0% |
| txt | 1 | 34 | 0 | 0 | 0% |
| text | 2 | 31 | 0 | 0 | 0% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Oct 7, 2026 | #6 | 8,776 (+199) | 107 | 19,962 | 252 | 12.63% | 17.48% | D 51.6 | 057ca59 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.