Generating high-performance GPU kernels remains challenging due to the need for both correctness and hardware-aware optimization. While large language models (LLMs) show promise in code generation, they often fail to produce kernels that are both correct and efficient. We propose Kernel Foundry, a diagnosis-driven evolutionary framework for automatic GPU kernel optimization. Our method combines expert-guided, retrieval-augmented initialization with a multi-island evolutionary search, where candidate kernels are iteratively refined using structured diagnostic feedback. A centralized experience library accumulates reusable optimization knowledge to guide subsequent evolution, while explicit mechanisms prevent cheating behaviors that bypass kernel-level computation. Experiments on KernelBench show that our method consistently improves both correctness and performance over strong baselines, achieving up to 100% correctness on Level~2.
翻译:生成高性能GPU内核仍然具有挑战性,因为这既需要保证正确性,又需要硬件感知优化。尽管大型语言模型(LLM)在代码生成方面展现出潜力,但它们往往无法生成既正确又高效的内核。我们提出了内核铸造厂(Kernel Foundry),一种基于诊断的自动GPU内核优化演化框架。我们的方法将专家引导的检索增强初始化与多岛屿演化搜索相结合,其中候选内核通过结构化诊断反馈进行迭代优化。一个中央经验库不断积累可重用的优化知识,以指导后续演化,同时采用显式机制防止绕过内核级计算的作弊行为。在KernelBench上的实验表明,我们的方法在正确性和性能上均持续优于强基线,在Level~2上实现了高达100%的正确率。