arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2202.12379cs.LGcs.AIcs.CL
收藏

学习在LLVM混合器中组合指令

Learning to Combine Instructions in LLVM Compiler

Intel India(英特尔印度公司)

Sandya Mannarswamy, Dibyendu Das

摘要:

指令组合器是编译器的一个关键优化通道,它在基本块级用一个等价的优化指令序列替换一个指令序列。随着新的编码习惯用法/应用程序和新的硬件的不断发展,可能会有数千种需要频繁更新的预防组合模式。这导致对IC优化通道的频繁更新,从而导致相当大的人力和高的软件维护成本。为了缓解这些与传统IC相关的挑战,我们设计并实现了一个神经指令组合器(NIC),并通过将其集成到标准LLVM编译器优化管道中来证明其可行性。NIC利用神经序列到序列(Seq 2Seq)模型从未优化的编码IR序列生成优化的编码IR序列。据我们所知,我们的工作是第一个证明神经指令组合器内置到一个成熟的编译器管道的可行性。鉴于这项任务的新颖性,我们构建了一个新的数据集来训练我们的NIC神经模型。我们表明,与传统的IC和神经机器翻译度量Bleu精度分数0.94相比,NIC实现了优化序列的72%的精确匹配结果百分比,证明了其在生产编译器管道中的可行性。

英文摘要:

Instruction combiner (IC) is a critical compiler optimization pass, which replaces a sequence of instructions with an equivalent and optimized instruction sequence at basic block level. There can be thousands of instruction-combining patterns which need to be frequently updated as new coding idioms/applications and novel hardware evolve over time. This results in frequent updates to the IC optimization pass thereby incurring considerable human effort and high software maintenance costs. To mitigate these challenges associated with the traditional IC, we design and implement a Neural Instruction Combiner (NIC) and demonstrate its feasibility by integrating it into the standard LLVM compiler optimization pipeline. NIC leverages neural sequence-to-sequence (Seq2Seq) models for generating optimized encoded IR sequence from the unoptimized encoded IR sequence. To the best of our knowledge, ours is the first work demonstrating the feasibility of a neural instruction combiner built into a full-fledged compiler pipeline. Given the novelty of this task, we built a new dataset for training our NIC neural model. We show that NIC achieves exact match results percentage of 72% for optimized sequences as compared to traditional IC and neural machine translation metric Bleu precision score of 0.94, demonstrating its feasibility in a production compiler pipeline.

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

↑