arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.18511cs.PLcs.AI
收藏

超越逐步优化:基于大语言模型的意图驱动的中间表示优化

Beyond Pass-by-Pass Optimization: Intent-Driven IR Optimization with Large Language Models

Lei Qiu, Zi Yang, Fang Lyu, Ming Zhong, Huimin Cui, Xiaobing Feng

AI总结:

IntOpt通过显式分离高层次优化意图与低层次转换,实现了更高效的中间表示优化,提升了正确性和性能。

摘要:

现代编译器通过一系列模块化的中间表示(IR)遍历来优化程序。虽然这种逐步范式提供了工程上的好处,但它面临着一个遍历协调问题:局部有益的转换可能会阻塞后续更盈利的优化。这种限制源于缺乏显式的优化意图概念,定义为协调多个转换以实现全局性能目标的整体策略。最近的基于LLM的方法将IR优化视为端到端生成任务,从而避免了传统的逐步结构。然而,优化意图仍然隐含在这些方法中,迫使模型联合推断优化策略并生成低级转换,这限制了正确性和性能。我们提出IntOpt,这是首个意图驱动的IR优化器,它显式地将高层次的优化意图与低层次的分析和转换分开。IntOpt将IR优化分为三个阶段:意图制定、意图细化和意图实现,从而实现全局协调的转换。实验表明,IntOpt在200个程序测试集上实现了90.5%的验证正确性,并在平均速度提升方面达到2.660倍,优于最先进的基于LLM的优化器在正确性和性能方面,并在37个基准测试中超过了现代编译器的-O3选项,最高速度提升达到272. bona fide。

英文摘要:

Modern compilers optimize programs through a sequence of modular passes over intermediate representations (IR). While this pass-by-pass paradigm offers engineering benefits, it suffers from a pass coordination problem: locally beneficial transformations may block more profitable optimizations in later stages. This limitation stems from the lack of an explicit notion of optimization intent, defined as a holistic strategy for coordinating multiple transformations toward a global performance objective. Recent LLM-based approaches formulate IR optimization as an end-to-end generation task, thereby avoiding the traditional pass-by-pass structure. However, optimization intent remains implicit in these methods, forcing models to jointly infer optimization strategy and generate low-level transformations, which limits both correctness and performance. We propose IntOpt, the first intent-driven IR optimizer that explicitly separates high-level optimization intent from low-level analysis and transformation. IntOpt organizes IR optimization into three stages: intent formulation, intent refinement, and intent realization, enabling globally coordinated transformations. Experiments show that IntOpt achieves 90.5% verified correctness and 2.660x average speedup on 200-program test set, outperforming state-of-the-art LLM-based optimizers in both correctness and performance, and surpassing modern compiler with the -O3 option on 37 benchmarks with speedups of up to 272.60x.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑