cuPilot用多智能体协同优化CUDA内核,平均提速3.09倍。
cuPilot: A Strategy-Coordinated Multi-agent Framework for CUDA Kernel Evolution
- 引入策略作为中间表示,协调多个智能体协同进化
- 在100个内核上平均提速3.09倍,GEMM任务实现关键硬件高利用率
- 适合需要自动优化GPU内核的开发者与性能研究者
CUDA内核优化是一项挑战性大且耗时的任务,需兼具软硬件协同设计知识,且高性能内核库常为专有。尽管近期大语言模型(LLMs)结合进化算法在自动内核优化方面展现潜力,但现有方法因智能体设计不佳和进化表示不匹配而性能不足。本文识别出这些不匹配问题,提出cuPilot——一种策略协同的多智能体框架,将策略作为内核演化的中间语义表示。核心贡献包括:策略协同进化算法、基于roofline的提示生成、策略级种群初始化。实验表明,cuPilot生成的内核在100个基准内核上平均比PyTorch快3.09倍;在GEMM任务中展现出复杂优化能力,显著提升关键硬件单元利用率。生成的内核已开源至https://github.com/champloo2878/cuPilot-Kernels.git。
原文摘要 · Abstract (English)
Optimizing CUDA kernels is a challenging and labor-intensive task, given the need for hardware-software co-design expertise and the proprietary nature of high-performance kernel libraries. While recent large language models (LLMs) combined with evolutionary algorithms show promise in automatic kernel optimization, existing approaches often fall short in performance due to their suboptimal agent designs and mismatched evolution representations. This work identifies these mismatches and proposes cuPilot, a strategy-coordinated multi-agent framework that introduces strategy as an intermediate semantic representation for kernel evolution. Key contributions include a strategy-coordinated evolution algorithm, roofline-guided prompting, and strategy-level population initialization. Experimental results show that the generated kernels by cuPilot achieve an average speed up of 3.09$\times$ over PyTorch on a benchmark of 100 kernels. On the GEMM tasks, cuPilot showcases sophisticated optimizations and achieves high utilization of critical hardware units. The generated kernels are open-sourced at https://github.com/champloo2878/cuPilot-Kernels.git.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。