Peephole optimizations are a core component of modern optimizing compilers. It rewrites specific instruction into semantically equivalent but more efficient forms. In practice, creating a new peephole optimization often starts from a concrete optimization instance and requires lifting it into a more general rewrite rule that matches a wider range of instruction patterns. This generalization step is critical to optimization effectiveness, but it is also difficult: producing rules that are both correct and sufficiently general typically demands substantial manual effort and domain expertise. Existing approaches such as Hydra attempt to automate this task with program synthesis, but their generalization capability is often limited by search-space explosion, under-generalization, and restricted support for diverse instruction domains. We present LPG, large language model aided peephole optimization generalization, a framework that uses large language models (LLMs) to generalize peephole optimizations. The design of LPG is motivated by the observation that LLMs are effective at semantic abstraction and exploratory reasoning, while formal analyses are necessary to ensure that generated rules are sound and profitable. Based on this observation, LPG adopts a closed-loop workflow that integrates LLM-driven symbolic constant generalization, structural generalization, constraint relaxation, and bitwidth/precision generalization with feedback from syntactic validation, semantic verification, and profitability checking. We evaluate LPG on real-world peephole optimization issues drawn from the LLVM ecosystem. Overall, LPG successfully generalizes 90 out of 102 optimizations. On the integer-focused subset that is directly comparable to Hydra, LPG generalizes 74 out of 81 optimizations, whereas Hydra generalizes 35.


翻译:窥孔优化是现代优化编译器的核心组成部分。它将特定指令重写为语义等价但更高效的形式。实践中,创建新的窥孔优化常始于具体优化实例,需要将其提升为能匹配更广泛指令模式的通用重写规则。这一泛化步骤对优化效果至关重要,但同样具有挑战性:生成既正确又足够通用的规则通常需要大量人工投入和领域专业知识。现有方法(如Hydra)尝试通过程序合成自动化此任务,但其泛化能力常受限于搜索空间爆炸、欠泛化以及对多样化指令域支持不足。我们提出LPG(大型语言模型辅助的窥孔优化泛化),一个利用大型语言模型(LLMs)泛化窥孔优化的框架。LPG的设计基于以下观察:LLMs在语义抽象和探索性推理方面表现出色,而形式化分析则对确保生成规则的合理性和收益性不可或缺。基于此,LPG采用闭环工作流程,集成LLM驱动的符号常量泛化、结构泛化、约束松弛及位宽/精度泛化,并结合语法验证、语义验证和收益性检查的反馈。我们在LLVM生态系统的真实窥孔优化问题上评估LPG。总体而言,LPG成功泛化102个优化中的90个。在与Hydra直接可比的整数聚焦子集上,LPG泛化81个优化中的74个,而Hydra泛化35个。

0
下载
关闭预览

相关内容

深度学习中泛化的量化、理解与改进
专知会员服务
17+阅读 · 2025年9月13日
《大型语言模型指令调优》综述
专知会员服务
74+阅读 · 2023年8月27日
稀疏大模型简述:从MoE、Sparse Attention到GLaM
夕小瑶的卖萌屋
14+阅读 · 2022年3月22日
以BERT为例,如何优化机器学习模型性能?
专知
10+阅读 · 2019年10月3日
入门 | 深度学习模型的简单优化技巧
机器之心
10+阅读 · 2018年6月10日
从浅层模型到深度模型:概览机器学习优化算法
机器之心
27+阅读 · 2017年7月9日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Instruction Tuning for Large Language Models: A Survey
Arxiv
15+阅读 · 2023年8月21日
VIP会员
相关主题
最新内容
《无人机对海面作战影响评估》
专知会员服务
1+阅读 · 4分钟前
印度精确打击与指挥架构的断层
专知会员服务
4+阅读 · 7月20日
美空军AI完成F-16战斗机自主空战历史性试飞
专知会员服务
6+阅读 · 7月20日
深入Project Maven:为何人工智能在战场上依然失灵
锻造未来士兵:外骨骼、基因工程与赛博格
专知会员服务
7+阅读 · 7月19日
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员