arXiv:2606.20373 · 中英对照阅读
AutoPass:用于编译器性能调优的证据引导型大语言模型(LLM)智能体
AutoPass: Evidence-Guided LLM Agents for Compiler Performance Tuning
中文速览
编译器的默认优化方案不可能适合所有程序和硬件,而靠反复编译、运行来试错又很费时间,尤其程序跑得快慢还会受到复杂硬件影响、测量也有噪声。AutoPass让多个大语言模型代理查看程序结构、编译器的中间代码和优化提示,再提出或调整优化步骤,并根据实际运行时间反复修正。实验显示,在服务器级 x86-64 和嵌入式 ARM64 上,它相比 LLVM 默认的 -O3 平均分别提速约 4.3% 和 11.7%,也优于专家规则和传统自动调优方法。重要的是,它证明模型不必靠专门训练,也能在编译器信息和真实运行结果的帮助下,更有根据地寻找适合不同程序与硬件的优化方案。
摘要
大语言模型(LLM)在代码编译任务中展现出应用前景,但由于复杂的微体系结构效应和嘈杂的运行时测量数据,将其用于运行时性能调优颇具挑战。我们提出了 AutoPass,这是一种用于编译器性能调优的多智能体框架,它利用编译器和运行时证据指导大语言模型生成优化决策。不同于以往自动调优方案将编译器视为黑盒,AutoPass 向大语言模型开放编译器,使其能够查询编译器内部优化状态并分析中间表示,从而编排编译器选项。搜索过程通过测得的运行时反馈迭代优化配置,以诊断性能退化并指导降低延迟的修改。AutoPass 采用仅推理、无需训练的运行方式,不需要离线训练或针对特定任务进行微调,因此能够直接应用于新的基准测试和平台。我们基于 LLVM 编译器实现了 AutoPass,并在服务器级 x86-64 系统和嵌入式 ARM64 系统上对其进行了评估。AutoPass 的表现优于专家调优启发式方法和经典自动调优方法;与 LLVM -O3 相比,其在 x86-64 和 ARM64 上的几何平均加速比分别达到 1.043 $\times$ 和 1.117 $\times$。
Large Language Models (LLMs) show promise for code compilation tasks, but applying them to runtime performance tuning is difficult due to complex microarchitectural effects and noisy runtime measurements. We present AutoPass, a multi-agent framework for compiler performance tuning that uses compiler and runtime evidence to guide LLM-generated optimization decisions. Rather than treating the compiler as a black box like prior auto-tuning schemes, AutoPass opens up the compiler to the LLM, enabling it to query compiler-internal optimization states and analyze the intermediate representation to orchestrate compiler options. The search process iteratively refines optimization configurations using measured runtime feedback to diagnose regressions and guide latency-improving edits. AutoPass operates in an inference-only, training-free setting and requires no offline training or task-specific fine-tuning, making it readily applicable to new benchmarks and platforms. We implement AutoPass on the LLVM compiler and evaluate it on server-grade x86-64 and embedded ARM64 systems. AutoPass outperforms expert-tuned heuristics and classical autotuning methods, achieving geometric-mean speedups of 1.043 $\times$ and 1.117 $\times$ over LLVM -O3 on x86-64 and ARM64, respectively.
术语表
- Large Language Models (LLMs)
- 大语言模型(LLM)
- AutoPass
- AutoPass
- compiler performance tuning
- 编译器性能调优
- multi-agent framework
- 多智能体框架
- compiler-internal signals
- 编译器内部信号
- runtime feedback
- 运行时反馈
- intermediate representation (IR)
- 中间表示(IR)
- LLVM
- LLVM
- GCC
- GCC
- optimization pass
- 优化遍
- pass sequence
- 遍序列
- phase ordering problem
- 阶段排序问题
- loop unrolling
- 循环展开
- instruction scheduling
- 指令调度
- register allocation
- 寄存器分配
- vectorization
- 向量化
- autotuning
- 自动调优
- predictive modeling
- 预测建模
- profile-guided optimization (PGO)
- 基于剖析信息的优化(PGO)
- AutoFDO
- AutoFDO
- CSSPGO
- CSSPGO
- OpenTuner
- OpenTuner
- CompilerGym
- CompilerGym
- Autophase
- Autophase
- Compiler-R1
- Compiler-R1
- inference-only
- 仅推理
- x86-64
- x86-64
- ARM64
- ARM64