论文标题

学习在LLVM编译器中结合说明

Learning to Combine Instructions in LLVM Compiler

论文作者

Mannarswamy, Sandya, Das, Dibyendu

论文摘要

指令组合程序(IC)是一个关键的编译器优化通行证,它在基本块级别上用等效且优化的指令序列代替了一系列指令。可以有成千上万的指令组合模式,需要经常更新,因为新的编码成语/应用程序和新颖的硬件随着时间的推移而发展。这会导致经常更新IC优化,从而产生了大量人力努力和高软件维护成本。为了缓解与传统IC相关的这些挑战,我们设计和实施神经教学组合(NIC),并通过将其集成到标准LLVM编译器优化管道中来证明其可行性。 NIC利用神经序列到序列(SEQ2SEQ)模型从未优化的编码IR序列中生成优化的编码IR序列。据我们所知,我们的作品是第一批展示内置在成熟的编译器管道中的神经教学组合的可行性。考虑到这项任务的新颖性,我们建立了一个新数据集,用于培训我们的NIC神经模型。我们表明,与传统的IC和神经机器翻译度量度量计量精度分数为0.94相比,NIC可获得优化序列的72%的确切匹配结果百分比为0.94,这表明其在生产编译器管道中的可行性。

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.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源