arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.01884cs.LGcs.AIcs.CLcs.DC
收藏

CudaForge:一种带有硬件反馈的CUDA内核优化智能体框架

CudaForge: An Agent Framework with Hardware Feedback for CUDA Kernel Optimization

University of Minnesota, Twin Cities(明尼苏达大学,双城分校)

Zijian Zhang, Rong Wang, Shiyang Li, Yuebo Luo, Mingyi Hong, Caiwen Ding

AI总结:

提出免训练多智能体框架CudaForge,通过集成硬件反馈迭代优化CUDA内核,在正确率、加速比及跨硬件泛化性上均超越现有方法,且成本极低。

摘要:

开发高效的CUDA内核对于大规模LLM训练等AI应用日益关键。然而,手动设计内核既昂贵又耗时,促使人们利用LLM进行代码生成的自动化方法。然而,现有的自动内核生成方法通常产生低效内核,产生高计算开销,且无法在不同设置间泛化。在本研究中,我们提出了CudaForge,一种用于CUDA内核生成和优化的免训练多智能体工作流。我们的工作流受人类专家的迭代工作流启发,包含开发初始内核、测试正确性、分析硬件反馈和迭代改进等步骤。更具体地说,CudaForge采用两个LLM智能体:Coder和Judge,它们迭代地生成、纠正和优化CUDA内核,同时集成Nsight Compute (NCU)指标等硬件反馈。在广泛的评估中,我们表明CudaForge通过利用OpenAI-o3等基础模型,实现了97.6%的生成内核正确率,以及相比PyTorch基线平均1.68倍的加速,在KernelBench上大幅超越了包括OpenAI-o3和Kevin在内的最先进模型。除了准确性和速度,CudaForge在跨GPU(A100、RTX 6000、4090、3090)和基础模型(OpenAI-o3、GPT-5、gpt-oss-120B、Claude-Sonnet-4、QwQ-32B)方面展现出强大的泛化能力,同时保持高效率。特别是,生成一个优化内核在一张RTX6000上大约需要26.5分钟,产生约0.3美元的API成本,这比现有需要6个H100小时和每个内核5美元API成本的智能体工作便宜得多。我们的结果强调,多智能体、免训练工作流可以实现具有成本效益、可泛化和高性能的CUDA内核优化。代码可在https://github.com/OptimAI-Lab/CudaForge获取

英文摘要:

Developing efficient CUDA kernels is increasingly critical for AI applications such as large-scale LLM training. However, manual kernel design is both costly and time-consuming, motivating automatic approaches that leverage LLMs for code generation. Existing methods for automatic kernel generation, however, often produce low-efficiency kernels, incur high computational overhead, and fail to generalize across settings. In this work, we propose CudaForge, a training-free multi-agent workflow for CUDA kernel generation and optimization. Our workflow is inspired by the iterative workflow of human experts, which contains steps such as developing initial kernels, testing correctness, analyzing hardware feedback, and iterative improvement. More specifically, CudaForge employs two LLM agents: a Coder and a Judge, that iteratively generate, correct, and optimize CUDA kernels, while integrating hardware feedback such as Nsight Compute (NCU) metrics. In extensive evaluations, we show that CudaForge, by leveraging base models like OpenAI-o3, achieves 97.6\% correctness of generated kernels and an average 1.68$\times$ speedup over PyTorch baselines, substantially surpassing state-of-the-art models including OpenAI-o3 and Kevin on KernelBench.Beyond accuracy and speed, CudaForge demonstrates strong generalization across GPUs (A100, RTX 6000, 4090, 3090) and base models (OpenAI-o3, GPT-5, gpt-oss-120B, Claude-Sonnet-4, QwQ-32B), while maintaining high efficiency. In particular, generating an optimized kernel takes about 26.5 minutes on one RTX6000 and incurs about \$ 0.3 API cost, which is significantly cheaper than existing agentic work that costs 6 H100 hours and \$ 5 API cost per kernel. Our results highlight that multi-agent, training-free workflows can enable cost-effective, generalizable, and high-performance CUDA kernel optimization. Code available at https://github.com/OptimAI-Lab/CudaForge

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

↑