一句话:提出 SubCuber,一个面向 Strassen 类矩阵乘法的领域特定编译器,生成高效 CUDA 内核。
矩阵乘法是科学计算与机器学习的核心操作,但 Strassen 等亚三次算法因递归结构难以在 GPU 上高效实现,现有方法常导致过多内存访问或计算与访存重叠不足。SubCuber 构建 Strassen 类算法的依赖图,选择高效的内核调度,并针对递归层级、矩阵尺寸和 GPU 应用融合策略;它包含两个旨在最小化输入加载并重叠计算与访存的新型 CUDA 内核。在 NVIDIA A100 和 H200 上,对单精度与半精度矩阵乘法的评估表明,SubCuber 生成的代码优于 Cutlass、cuBLAS 及现有 Strassen 实现:单层递归最多快 12%,两层最多快 22%,并使 Phi-4 14B、Qwen-3 32B、LLaMA-3 405B 等语言模型推理中的矩阵乘法最多快 16%。
Matrix multiplication is a key operation in scientific computing and machine learning, with GPU libraries like NVIDIA Cutlass and cuBLAS providing optimized implementations of the three nested loop cubic algorithm. While sub-cubic algorithms, like the Strassen algorithm and its variants, are theoretically faster, their recursive structure makes it challenging to implement efficient GPU kernels. This is why existing approaches either do excessive memory accesses or do not effectively overlap memory accesses and computations, leading to sub-optimal performance compared to theoretical expectations. This paper presents SubCuber, a domain-specific compiler that generates efficient CUDA kernels for Strassen-like matrix multiplication algorithms. SubCuber contains two novel CUDA kernels that are designed to minimize memory input loads and effectively overlap computation with memory loads. To generate efficient code, SubCuber constructs the dependency graph of a Strassen-like algorithm, selects efficient kernel schedules, and applies fusion strategies tailored to a recursion level, matrix sizes, and GPU. Our evaluation on NVIDIA A100 and H200 GPUs shows that for both single- and half-precision floating point matrix multiplications, SubCuber’s generated code outperforms state-of-the-art CUDA implementations for matrix multiplication and the Strassen algorithm. SubCuber is up to 12% faster for one recursion level and 22% for two recursion levels over Cutlass and cuBLAS, while existing approaches are only up to 8% faster for one-level and 16% faster for two-levels. Furthermore, SubCuber makes matrix multiplication in language models like Phi-4 14B, Qwen-3 32B, and LLaMA-3 405b, up to 16% faster for inference scenarios.
@article{Jangda26,
title = {Compiling Strassen-like Matrix Multiplication Algorithms to Fast CUDA Kernels},
author = {Abhinav Jangda},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {PLDI},
year = {2026},
doi = {10.1145/3808267}
}