arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.26758cs.AI
收藏

EGG: 一种专家引导的核函数生成智能体框架

EGG: An Expert-Guided Agent Framework for Kernel Generation

Yaochen Han, Ke Fan, Hongxu Jiang, Wanqi Xu, Weiyu Xie, Runhua Zhang, Chenhui Zhu, Yixiang Zhang

AI总结:

提出EGG框架,通过将核函数生成分解为算法结构设计与硬件特定调优两阶段,并采用阶段感知的多智能体协作机制,实现正确性与高性能,在KernelBench上平均加速比PyTorch达2.13倍。

摘要:

高性能GPU核函数对于降低大型语言模型(LLMs)指数级增长的计算成本至关重要,但其开发严重依赖领域专家的人工调优。尽管近期基于LLM的方法在自动化核函数生成方面显示出前景,但它们仍难以同时实现正确性和高性能。这一限制主要源于缺乏领域特定的优化指导,阻碍了对优化空间的有效探索。我们提出EGG,一种专家引导的核函数生成智能体框架,该框架融合专家优化原则以指导LLM的决策。受专家工作流程启发,我们将核函数生成分解为两个层次阶段:1)算法结构设计,建立高质量的计算结构基础;2)硬件特定调优,通过并行映射、张量分块和内存优化进行针对性调整。这种分阶段分解定义了明确的优化目标,结构化设计空间以实现渐进式细化。为此,我们设计了一种阶段感知的多智能体协作机制,用于阶段间和阶段内的上下文管理,确保稳定的优化轨迹。在KernelBench和实际工作负载上的实验表明,EGG相对于PyTorch实现了平均2.13倍的加速,优于现有的基于智能体和基于强化学习的方法。

英文摘要:

High-performance GPU kernels are critical for reducing the exponentially growing computational costs of large language models (LLMs), but their development heavily relies on manual tuning by domain experts. While recent advances in LLM-based approaches show promise for automating kernel generation, they still struggle to achieve both correctness and high performance. This limitation primarily arises from the lack of domain-specific optimization guidance, hindering effective exploration of the optimization space. We propose EGG, an Expert-Guided Agent Framework for Kernel Generation, which incorporates expert optimization principles to guide LLMs' decisions. Inspired by expert workflows, we decompose kernel generation into two hierarchical stages: 1) algorithmic structure design, which establishes a high-quality computational structure foundation; 2) hardware-specific tuning, which performs targeted adjustments through parallel mapping, tensor tiling, and memory optimization. This staged decomposition defines explicit optimization objectives, structuring the design space to achieve progressive refinement. To this end, a stage-aware multi-agent collaboration mechanism is designed for inter and intra-stage context management, ensuring stable optimization trajectories. Experiments on KernelBench and real-world workloads show that EGG achieves a 2.13x average speedup over PyTorch, outperforming existing agent-based and RL-based approaches.

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

↑