学习何时优化:来自专家GPU内核谱系的验证优化技能
KLineage: Recovering the Missing When of Kernel Optimization by Deoptimizing Experts
AI总结:
提出KLineage方法,通过反向遍历专家GPU内核实现并提取可重用的优化技能,学习优化的适用条件,从而提升LLM代理生成内核的优化质量与效率。
摘要:
基于LLM的代理越来越多地被用于生成GPU内核,但它们通常知道尝试哪些优化,却不知道这些优化何时是合理的。我们引入了KLineage,它从专家内核中学习这种缺失的“何时”知识:KLineage不是依赖前向展开,而是通过验证门控简化反向遍历专家实现,并将每个接受的步骤逆转为可重用的优化技能。每个技能不仅记录了优化意图,还记录了它在代码中的适用位置、使其有效的条件、产生的效果以及其假设避免了哪些失败。下游LLM在相同的编译/正确性/性能分析门控下,将这些技能应用到新的代码表面上。在两个NVIDIA架构上的五个专家工作负载中,这些谱系衍生的技能作为有效的优化课程,在相同的固定预算下,在最终内核质量和优化效率方面均超过了近期基于内存的LLM内核基线。此外,我们使用一个单独的22实例保留检查作为对源案例记忆的合理性测试。
英文摘要:
LLM-based agents are increasingly used to generate GPU kernels, but they often struggle to determine when an optimization is sound because its required code state and dependencies are implicit in expert implementations. We introduce KLineage, which learns this missing "when" knowledge from expert kernels: instead of relying on forward rollouts, KLineage walks expert implementations backward through validation-gated simplifications and reverses each accepted step into a reusable optimization skill. Each skill records not only the optimization intent, but also when to apply the optimization technique, including where it applies in code, what conditions made it valid, what effect it has, and what failures its assumptions avoid. A downstream LLM materializes these skills on new code surfaces under the same compile/correctness/profile gate. This guidance on when to apply each optimization can help downstream models to generate higher-performance kernels. On five expert workloads across two NVIDIA architectures, these lineage-derived skills serve as an effective optimization curriculum, exceeding recent memory-based LLM-kernel baselines in both final kernel quality and optimization efficiency under the same fixed budget. We also demonstrate that the KLineage framework extends beyond NVIDIA GPUs to Ascend NPUs. Our code is publicly available at https://github.com/ict-agent/klineage.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。