Large Language Models for Compiler Optimization

Chris Cummins, Volker Seeker, Dejan Grubisic, Mostafa Elhoushi, Youwei Liang +6 more
9/11/2023
cs.PLcs.AIcs.CL

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

We explore the novel application of Large Language Models to code optimization. We present a 7B-parameter transformer model trained from scratch to optimize LLVM assembly for code size. The model takes as input unoptimized assembly and outputs a list of compiler options to best optimize the program. Crucially, during training, we ask the model to predict the instruction counts before and after optimization, and the optimized code itself. These auxiliary learning tasks significantly improve the optimization performance of the model and improve the model's depth of understanding. We evaluate on a large suite of test programs. Our approach achieves a 3.0% improvement in reducing instruction counts over the compiler, outperforming two state-of-the-art baselines that require thousands of compilations. Furthermore, the model shows surprisingly strong code reasoning abilities, generating compilable code 91% of the time and perfectly emulating the output of the compiler 70% of the time.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{cummins2023large,
  title  = {Large Language Models for Compiler Optimization},
  author = {Chris Cummins and Volker Seeker and Dejan Grubisic and Mostafa Elhoushi and Youwei Liang and Baptiste Roziere and Jonas Gehring and Fabian Gloeckle and Kim Hazelwood and Gabriel Synnaeve and Hugh Leather},
  year   = {2023},
  eprint = {2309.07062},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2309.07062v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2309.07062.svg)](https://codeofpaper.com/paper/2309.07062)

Discussion