paperbot · PL 论文追踪

全部论文 待读 收藏

P1 LOOPRAG: Enhancing Loop Transformation Optimization with Retrieval-Augmented Large Language Models

LOOPRAG:用检索增强大语言模型增强循环变换优化
ASPLOS Proceedings of the 31st ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 22026匹配度 5/10 · 论文将检索增强 LLM 用于循环变换优化,属于 LLM 与程序语言/编译优化的交叉,与用户关注的 AI→PL 方向部分相关;但其核心是编译器循环优化而非静态分析/形式化验证,也不涉及浮点或贝叶斯程序分析。引用 3 inbox
Yijie Zhi, Yayu Cao, Jianhua Dai, Xiaoyang Han, Jingwen Pu, Qinran Wu, Sheng Cheng, Ming Cai
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出检索增强LLM框架LOOPRAG,通过参数化示例生成、循环感知检索与反馈迭代提升循环变换优化。

循环变换是编译器中重要的语义保持优化,但最优变换组合的选取受依赖分析和代价建模复杂性制约。现有大语言模型在循环变换优化上常产生错误或次优结果。为此,本文提出LOOPRAG,一个面向静态控制部分(SCoP)的检索增强生成框架。该方法用参数驱动方式刻画循环属性并触发多种循环变换,生成多样且合法的示例代码作为演示源;提出基于循环特征的检索算法,在相似性与多样性间取得平衡;并引入编译、测试与性能反馈的迭代机制,引导LLM生成正确且高效的代码。生成的优化代码还经过变异、覆盖率和差分测试进行等价性检查。在PolyBench、TSVC和LORE基准上,与GCC-Graphite、Clang-Polly、Perspective、ICX及DeepSeek、GPT-4等对比,相对编译器最高加速分别为11.20×、14.34×和9.29×,相对基础LLM最高加速分别为11.97×、5.61×和11.59×。

问题
循环变换的最优组合难以确定,依赖分析与面向优化目标的代价建模带来固有复杂性;LLM直接进行循环优化时容易出错或错过显著性能提升。
方法
提出LOOPRAG检索增强生成框架,面向SCoP用参数化循环属性生成合法示例,以循环感知检索算法获取兼顾相似性与多样性的演示,并通过编译/测试/性能反馈迭代生成代码,同时用变异、覆盖率和差分测试做等价性检查。
评估
在PolyBench、TSVC和LORE基准上,与GCC-Graphite、Clang-Polly、Perspective、ICX等编译器及DeepSeek、GPT-4等LLM比较,报告最高达11.20×/14.34×/9.29×的编译器加速和11.97×/5.61×/11.59×的LLM加速。
原文摘要(Abstract)

Loop transformations are semantics-preserving optimization techniques applied at the source level, widely used in compilers to maximize objectives such as vectorization and parallelism. Despite decades of research, applying the optimal composition of loop transformations remains challenging due to inherent complexities, including dependency analysis and cost modeling for optimization objectives. Recent studies have explored the potential of Large Language Models (LLMs) for code optimization. However, our key observation is that LLMs often struggle with effective loop transformation optimization, frequently leading to errors or suboptimal optimization, thereby missing significant opportunities for performance improvements. To bridge this gap, we propose LOOPRAG, a novel retrieval-augmented generation framework designed to guide LLMs in performing effective loop optimization on Static Control Part (SCoP). We introduce a parameter-driven method to harness loop properties, which trigger various loop transformations, and generate diverse yet legal example codes serving as a demonstration source. To effectively obtain the most informative demonstrations, we propose a loop-aware algorithm based on loop features, which balances similarity and diversity for code retrieval. To enhance correct and efficient code generation, we introduce a feedback-based iterative mechanism that incorporates compilation, testing and performance results as feedback to guide LLMs. Each optimized code generated by LOOPRAG undergoes mutation, coverage and differential testing to perform equivalence checking. We evaluate LOOPRAG on PolyBench, TSVC and LORE benchmark suites, and compare it against compilers (GCC-Graphite, Clang-Polly, Perspective and ICX) and representative LLMs (DeepSeek and GPT-4). The results demonstrate average speedups over compilers of up to 11.20×, 14.34×, and 9.29× for PolyBench, TSVC, and LORE, respectively, and speedups over base LLMs of up to 11.97×, 5.61×, and 11.59×.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2512-15766,
  title = {LOOPRAG: Enhancing Loop Transformation Optimization with Retrieval-Augmented Large Language Models},
  author = {Yijie Zhi and Yayu Cao and Jianhua Dai and Xiaoyang Han and Jingwen Pu and Qinran Wu and Sheng Cheng and Ming Cai},
  booktitle = {ASPLOS},
  year = {2026},
  doi = {10.1145/3779212.3790183}
}