Modern compilers rely on hand-crafted heuristics to guide optimization passes. These human-designed rules often struggle to adapt to the complexity of modern software and hardware and lead to high maintenance burden. To address this challenge, we present Magellan, an agentic framework that evolves the compiler pass itself by synthesizing executable C++ decision logic. Magellan couples an LLM coding agent with evolutionary search and autotuning in a closed loop of generation, evaluation on user-provided macro-benchmarks, and refinement, producing compact heuristics that integrate directly into existing compilers. Across several production optimization tasks, Magellan discovers policies that match or surpass expert baselines. In LLVM function inlining, Magellan synthesizes new heuristics that outperform decades of manual engineering for both binary-size reduction and end-to-end performance. In register allocation, it learns a concise priority rule for live-range processing that matches intricate human-designed policies on a large-scale workload. We also report preliminary results on XLA problems, demonstrating portability beyond LLVM with reduced engineering effort.


翻译:现代编译器依赖手工设计的启发式规则来指导优化过程。这些人为设计的规则往往难以适应现代软硬件的复杂性,并导致高昂的维护负担。为应对这一挑战,我们提出麦哲伦——一个通过合成可执行的C++决策逻辑来进化编译器过程本身的智能体框架。麦哲伦将LLM代码生成智能体与进化搜索及自动调优相结合,形成生成、在用户提供的宏观基准测试上评估、优化的闭环流程,从而产生可直接集成到现有编译器中的紧凑启发式规则。在多项实际优化任务中,麦哲伦发现的策略均达到或超越了专家基线水平。在LLVM函数内联优化中,麦哲伦合成的新启发式规则在二进制大小缩减和端到端性能方面均优于数十年人工工程积累的成果。在寄存器分配任务中,它学习到一条简洁的活跃区间处理优先级规则,在大规模工作负载上达到了复杂人工设计策略的同等效果。我们还报告了在XLA问题上的初步实验结果,展示了该框架在LLVM之外的可移植性及较低的工程开销。

0
下载
关闭预览

相关内容

编译器(Compiler),是一种计算机程序,它会将用某种编程语言写成的源代码(原始语言),转换成另一种编程语言(目标语言)。
【新书】AI智能体与应用:基于 LangChain、LangGraph 与 MCP
专知会员服务
62+阅读 · 2025年9月12日
AI智能体编程:技术、挑战与机遇综述
专知会员服务
41+阅读 · 2025年8月18日
基于大语言模型的智能体优化研究综述
专知会员服务
59+阅读 · 2025年3月25日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 1月29日
VIP会员
相关基金
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员