arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2603.07169cs.LGstat.ML
收藏

使LLMs像专家一样优化多场景CUDA内核

Making LLMs Optimize Multi-Scenario CUDA Kernels Like Experts

Tsinghua University(清华大学)

Yuxuan Han, Meng-Hao Guo, Zhengning Liu, Wenguang Chen, Shi-Min Hu

AI总结:

本文提出CUDAMaster系统,通过多代理和硬件感知方法,实现对多场景CUDA内核的高效优化,显著提升性能并超越现有闭源库。

摘要:

手动优化GPU内核是一项具有挑战性和耗时的任务。随着LLM的快速发展,自动GPU内核优化逐渐成为现实。然而,当前基于LLM的自动优化方法主要集中在机器学习应用,如PyTorch操作符优化,而忽略了更广泛的领域,如科学计算中的稀疏矩阵运算。扩展到这些更广泛的应用带来了新的挑战,因此开发一种通用的自动内核优化方法成为我们的主要目标。在本文中,我们通过引入MSKernelBench来解决多场景设置系统评估的缺失问题,该基准涵盖了多个场景,包括基本代数运算、常见LLM内核、稀疏矩阵运算和科学计算程序,每个都支持FP32和BF16精度。基于此基准,我们引入了CUDAMaster,一种多代理、硬件感知的内核优化系统,利用性能分析信息并自动构建完整的编译和执行工具链。实验结果表明,CUDAMaster在大多数运算上实现了显著的加速,比Astra快约35%。在某些情况下,其性能与高度优化的闭源库如cuBLAS相当。一个展示每个运算原始和优化代码的演示可在https://hanyx2021.github.io/MSKernelBenchDemo/上查看。

英文摘要:

Optimizing GPU kernels manually is a challenging and time-consuming task. With the rapid development of LLMs, automated GPU kernel optimization is gradually becoming a tangible reality. However, current LLM-driven automated optimization methods narrowly focus on machine learning applications, such as PyTorch operator optimization, while overlooking broader domains like sparse matrix operations in scientific computing. Extending to these broader applications brings new challenges for the benchmark and algorithm. Therefore, developing a general-purpose automated kernel optimization method becomes our primary focus. In this paper, we address the absence of systematic evaluation for multi-scenario settings by introducing MSKernelBench, which spans multiple scenarios, including fundamental algebraic operations, common LLM kernels, sparse matrix operators, and scientific computing routines, each supporting both FP32 and BF16 precision. Building on this benchmark, we introduce CUDAMaster, a multi-agent, hardware-aware system for kernel optimization that leverages profiling information and automatically constructs the full compilation and execution toolchain. Experimental results demonstrate that CUDAMaster achieves significant speedups across most operators, outperforming Astra by about 35%. In several cases, its performance matches or surpasses that of highly optimized, closed-source libraries such as cuBLAS. A demo showcasing the original and optimized code for each operator is available at https://hanyx2021.github.io/MSKernelBenchDemo/.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑