[论文解读] DeepDataFlow
PROGRAML 采用基于图的、与编译器无关的程序表示方法,利用有向带属性多图来捕捉 LLVM 和 XLA IR 中的控制、数据和调用依赖关系。通过将消息传递神经网络(MPNN)应用于这种结构化表示,该方法在核心编译器分析任务上实现了最先进性能——F1 得分为 94.0,且在异构设备映射和程序分类任务上优于先前方法。
This dataset contains 493k LLVM-IRs taken from a wide range of projects and source programming languages, and includes labels for several compiler data analyses. We also include the logs for the machine learning jobs which produced our published experimental results. The uncompressed dataset uses the following layout: <code>labels/</code> Directory containing machine learning features and labels for programs for compiler data flow analyses. <code>labels/<analysis>/<source>.<id>.<lang>.ProgramFeaturesList.pb</code> A ProgramFeaturesList protocol buffer containing a list of features resulting from running a data flow analysis on a program. <code>graphs/</code> Directory containing ProGraML representations of LLVM IRs. <code>graphs/<source>.<id>.<lang>.ProgramGraph.pb</code> A ProgramGraph protocol buffer of an LLVM IR in the ProGraML representation. <code>ll/</code> Directory containing LLVM-IR files. <code>ir/<source>.<id>.<lang>.ll</code> An LLVM IR in text format, as produced by <code>clang -emit-llvm -S</code> or equivalent. <code>test/</code> A directory containing symlinks to graphs in the <code>graphs/</code> directory, indicating which graphs should be used as part of the test set. <code>train/</code> A directory containing symlinks to graphs in the <code>graphs/</code> directory, indicating which graphs should be used as part of the training set. <code>val/</code> A directory containing symlinks to graphs in the <code>graphs/</code> directory, indicating which graphs should be used as part of the validation set. <code>vocab/</code> Directory containing vocabulary files. <code>vocab/<type>.csv</code> A vocabulary file, which lists unique node texts, their frequency in the dataset, and the cumulative proportion of total unique node texts that is covered. For further information please see our ProGraML repository.
研究动机与目标
- 为解决机器学习用于编译器时,序列化和启发式程序表示方法的局限性。
- 通过改进程序表示和模型表达能力,弥合最先进机器学习方法与最优优化启发式规则之间的性能差距。
- 实现端到端可学习模型,以执行复杂程序分析,如数据流和控制流推理。
- 为多种下游编译器任务(包括优化和跨源转换)提供可重用、通用的表示方法。
提出的方法
- PROGRAML 将程序表示为有向带属性多图,编码指令之间的控制、数据和调用依赖关系。
- 每个节点(指令)通过操作码、操作数类型、顺序和指令修饰符等特征进行嵌入。
- 消息传递神经网络(MPNN)在图中传播潜在表示,支持逐条指令和逐变量的分类。
- 模型通过单次前向传播处理整个程序,利用迭代消息传递捕捉长程依赖关系。
- 该方法与源语言和编译器无关,支持 LLVM 和 XLA IR。
- 训练使用真实性能数据端到端学习启发式规则,以数据驱动推理替代手工设计规则。
实验结果
研究问题
- RQ1基于图的程序表示是否能比基于序列或抽象语法树(AST)的方法更准确地捕捉程序语义?
- RQ2MPNN 是否能有效从结构化程序图中学习复杂编译器分析任务,如活跃性分析和支配关系?
- RQ3在标准编译器任务中,PROGRAML 的表达能力与先前基于图或序列的模型相比如何?
- RQ4该方法是否能在多种编程语言和编译器中间表示之间实现良好泛化?
- RQ5该模型是否在传统和高级编译器任务上均达到最先进性能?
主要发现
- PROGRAML 在涵盖六种编程语言的 25 万份 LLVM-IR 文件基准测试中,F1 得分为 94.0,显著优于最先进方法。
- 该模型在异构设备映射和程序分类任务上均创下新的最先进性能记录。
- 尽管图大小和消息传递步数呈线性增长,该方法的推理吞吐量相比基线提升了 76.6 倍。
- 通过编码操作数类型、顺序和修饰符,PROGRAML 捕获了 CDFG 基模型仅使用操作码时所丢失的语义差异。
- 该方法成功在无显式监督的情况下学习传统编译器分析任务,如支配树和数据依赖关系。
- 基于图的表示使长程依赖关系建模更加有效,克服了序列模型的局限性及梯度消失问题。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。