arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2309.04828cs.SE
收藏

FAIR:编译器中间表示的流类型感知预训练

FAIR: Flow Type-Aware Pre-Training of Compiler Intermediate Representations

Changan Niu, Chuanyi Li, Vincent Ng, David Lo, Bin Luo

AI总结:

针对现有编译器中间表示模型混淆节点、无法区分流类型及网络长依赖捕捉不足等问题,提出流类型感知的预训练模型FAIR,结合新输入表示、Graph Transformer和五个预训练任务,在四个代码相关下游任务上达到最优。

摘要:

尽管大多数现有的代码预训练模型学习源代码特征(如代码词元和抽象语法树),但也有一些工作专注于从编译器中间表示(IRs)中学习。现有的基于IR的模型通常利用指令、控制和数据流图(CDFGs)、调用图等IR特征。然而,这些方法混淆了CDFG中的变量节点和指令节点,未能区分不同类型的流,且其使用的神经网络无法捕捉长距离依赖,并存在过平滑和过挤压问题。为解决这些弱点,我们提出了FAIR,一种流类型感知的IR预训练模型,其包含(1)一种新颖的IR程序输入表示;(2)Graph Transformer以解决过平滑、过挤压和长依赖问题;以及(3)我们专门提出的五个预训练任务,使FAIR能够学习IR词元的语义、流类型信息及IR的整体表示。实验结果表明,FAIR在四个代码相关的下游任务上取得了最先进的结果。

英文摘要:

While the majority of existing pre-trained models from code learn source code features such as code tokens and abstract syntax trees, there are some other works that focus on learning from compiler intermediate representations (IRs). Existing IR-based models typically utilize IR features such as instructions, control and data flow graphs (CDFGs), call graphs, etc. However, these methods confuse variable nodes and instruction nodes in a CDFG and fail to distinguish different types of flows, and the neural networks they use fail to capture long-distance dependencies and have over-smoothing and over-squashing problems. To address these weaknesses, we propose FAIR, a Flow type-Aware pre-trained model for IR that involves employing (1) a novel input representation of IR programs; (2) Graph Transformer to address over-smoothing, over-squashing and long-dependencies problems; and (3) five pre-training tasks that we specifically propose to enable FAIR to learn the semantics of IR tokens, flow type information, and the overall representation of IR. Experimental results show that FAIR can achieve state-of-the-art results on four code-related downstream tasks.

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

↑