arXiv:2601.21096cs.AIcs.LG2026-01中稿 · C4ML@CGO'26被引 5

用AI自动发现编译器优化新规则,效果超越人工多年经验。

Magellan: Autonomous Discovery of Novel Compiler Optimization Heuristics with AlphaEvolve

  • 用大模型生成代码,结合进化搜索和调优,自动演化编译器优化逻辑。
  • 在函数内联和寄存器分配任务中,性能超过人工设计的专家策略。
  • 可直接集成到现有编译器,适用于LLVM之外的XLA等场景。

现代编译器依赖人工设计的启发式规则来指导优化过程,这些规则难以适应现代软硬件复杂性,且维护成本高。为此,我们提出Magellan——一个自主演化的智能框架,通过合成可执行的C++决策逻辑,直接演化编译器优化流程。Magellan将大模型编码代理与进化搜索、自动调优相结合,在生成、用户提供的宏基准测试评估、以及迭代优化的闭环中运行,生成可直接嵌入现有编译器的紧凑启发式规则。在多个生产级优化任务中,Magellan发现的策略达到或优于专家基线。在LLVM函数内联任务中,其生成的新启发式规则在二进制体积缩减和端到端性能上均超越数十年的人工工程成果;在寄存器分配中,学习出的简洁优先级规则在大规模工作负载下媲美复杂的手工设计策略。初步实验还展示了其在XLA问题上的可行性,证明了其超越LLVM的可移植性与低工程投入优势。

原文摘要 · Abstract (English)

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.

编译器优化AI编程自动化LLVM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。