The exponential growth in demand for GPU computing resources has created an urgent need for automated CUDA optimization strategies. While recent advances in LLMs show promise for code generation, current SOTA models achieve low success rates in improving CUDA speed. In this paper, we introduce CUDA-L1, an automated reinforcement learning framework for CUDA optimization that employs a novel contrastive RL algorithm. CUDA-L1 achieves significant performance improvements on the CUDA optimization task: trained on A100, it delivers an average speedup of x3.12 with a median speedup of x1.42 against default baselines over across all 250 CUDA kernels of KernelBench, with peak speedups reaching x120. In addition to the default baseline provided by KernelBench, CUDA-L1 demonstrates x2.77 over Torch Compile, x2.88 over Torch Compile with reduce overhead, x2.81 over CUDA Graph implementations, and x7.72 over cuDNN libraries. Furthermore, the model also demonstrates portability across different GPU architectures. Beyond these benchmark results, CUDA-L1 demonstrates several properties: it 1) discovers a variety of CUDA optimization techniques and learns to combine them strategically to achieve optimal performance; 2) uncovers fundamental principles of CUDA optimization, such as the multiplicative nature of optimizations; 3) identifies non-obvious performance bottlenecks and rejects seemingly beneficial optimizations that actually harm performance. The capabilities demonstrate that, RL can transform an initially poor-performing LLM into an effective CUDA optimizer through speedup-based reward signals alone, without human expertise or domain knowledge. This paradigm opens possibilities for automated optimization of CUDA operations, and holds promise to substantially promote GPU efficiency and alleviate the rising pressure on GPU computing resources. Project: deepreinforce-ai.github.io/cudal1_blog


翻译:GPU计算资源需求的指数级增长催生了对自动化CUDA优化策略的迫切需求。尽管近期大语言模型在代码生成方面展现出潜力,但当前最先进模型在提升CUDA运行速度方面成功率较低。本文提出CUDA-L1——一种采用新型对比强化学习算法的自动化CUDA优化强化学习框架。CUDA-L1在CUDA优化任务上实现了显著的性能提升:在A100显卡上训练后,其在KernelBench全部250个CUDA内核测试中,相较于默认基线实现了平均3.12倍、中位数1.42倍的加速效果,峰值加速比达到120倍。除KernelBench提供的默认基线外,CUDA-L1相较于Torch Compile实现2.77倍加速,相较于降低开销的Torch Compile实现2.88倍加速,相较于CUDA Graph实现2.81倍加速,相较于cuDNN库实现7.72倍加速。此外,该模型还展现出跨GPU架构的移植能力。除基准测试结果外,CUDA-L1还展现出以下特性:1)能够发现多种CUDA优化技术并学会策略性地组合它们以实现最优性能;2)揭示了CUDA优化的基本原理,如优化效果的乘性累积特性;3)能识别非显性性能瓶颈,并拒绝那些看似有益实则损害性能的优化方案。这些能力表明,仅通过基于加速比的奖励信号,强化学习即可将初始性能欠佳的大语言模型转化为有效的CUDA优化器,无需人类专家经验或领域知识。该范式为CUDA运算的自动化优化开辟了新途径,有望显著提升GPU效率并缓解日益增长的GPU计算资源压力。项目地址:deepreinforce-ai.github.io/cudal1_blog

0
下载
关闭预览

相关内容

可解释强化学习,Explainable Reinforcement Learning: A Survey
专知会员服务
132+阅读 · 2020年5月14日
【综述】自动驾驶领域中的强化学习,附18页论文下载
专知会员服务
176+阅读 · 2020年2月8日
Distributional Soft Actor-Critic (DSAC)强化学习算法的设计与验证
深度强化学习实验室
19+阅读 · 2020年8月11日
对比学习(Contrastive Learning)相关进展梳理
PaperWeekly
11+阅读 · 2020年5月12日
机器学习中的最优化算法总结
人工智能前沿讲习班
22+阅读 · 2019年3月22日
一文了解强化学习
AI100
15+阅读 · 2018年8月20日
【强化学习】强化学习+深度学习=人工智能
产业智能官
55+阅读 · 2017年8月11日
从浅层模型到深度模型:概览机器学习优化算法
机器之心
27+阅读 · 2017年7月9日
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
39+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
23+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2013年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
国家自然科学基金
11+阅读 · 2008年12月31日
VIP会员
相关VIP内容
可解释强化学习,Explainable Reinforcement Learning: A Survey
专知会员服务
132+阅读 · 2020年5月14日
【综述】自动驾驶领域中的强化学习,附18页论文下载
专知会员服务
176+阅读 · 2020年2月8日
相关资讯
Distributional Soft Actor-Critic (DSAC)强化学习算法的设计与验证
深度强化学习实验室
19+阅读 · 2020年8月11日
对比学习(Contrastive Learning)相关进展梳理
PaperWeekly
11+阅读 · 2020年5月12日
机器学习中的最优化算法总结
人工智能前沿讲习班
22+阅读 · 2019年3月22日
一文了解强化学习
AI100
15+阅读 · 2018年8月20日
【强化学习】强化学习+深度学习=人工智能
产业智能官
55+阅读 · 2017年8月11日
从浅层模型到深度模型:概览机器学习优化算法
机器之心
27+阅读 · 2017年7月9日
相关基金
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
39+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
23+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2013年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
国家自然科学基金
11+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员