Learning to Combine Instructions in LLVM Compiler

02/22/2022
by   Sandya Mannarswamy, et al.
10

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 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.

READ FULL TEXT
research
10/24/2020

Modularity Improves Out-of-Domain Instruction Following

We propose a modular architecture for following natural language instruc...
research
02/07/2019

Revec: Program Rejuvenation through Revectorization

Modern microprocessors are equipped with Single Instruction Multiple Dat...
research
07/31/2020

BasicBlocker: Redesigning ISAs to Eliminate Speculative-Execution Attacks

Recent research has revealed an ever-growing class of microarchitectural...
research
09/11/2023

Large Language Models for Compiler Optimization

We explore the novel application of Large Language Models to code optimi...
research
01/16/2019

Realize special instructions on clustering VLIW DSP: multiplication-accumulation instruction

BWDSP is a 32bit static scalar digital signal processor with VLIW and SI...
research
01/03/2023

Boosting Neural Networks to Decompile Optimized Binaries

Decompilation aims to transform a low-level program language (LPL) (eg.,...
research
07/20/2020

Program algebra for random access machine programs

This paper presents an algebraic theory of instruction sequences with in...

Please sign up or login with your details

Forgot password? Click here to reset