Learning to Make Compiler Optimizations More Effective
Not on the map. Why?
Abstract (arXiv)
Because loops execute their body many times, compiler developers place much emphasis on their optimization. Nevertheless, in view of highly diverse source code and hardware, compilers still struggle to produce optimal target code. The sheer number of possible loop optimizations, including their combinations, exacerbates the problem further. Today's compilers use hard-coded heuristics to decide when, whether, and which of a limited set of optimizations to apply. Often, this leads to highly unstable behavior, making the success of compiler optimizations dependent on the precise way a loop has been written. This paper presents LoopLearner, which addresses the problem of compiler instability by predicting which way of writing a loop will lead to efficient compiled code. To this end, we train a neural network to find semantically invariant source-level transformations for loops that help the compiler generate more efficient code. Our model learns to extract useful features from the raw source code and predicts the speedup that a given transformation is likely to yield. We evaluate LoopLearner with 1,895 loops from various performance-relevant benchmarks. Applying the transformations that our model deems most favorable prior to compilation yields an average speedup of 1.14x. When trying the top-3 suggested transformations, the average speedup even increases to 1.29x. Comparing the approach with an exhaustive search through all available code transformations shows that LoopLearner helps to identify the most beneficial transformations in several orders of magnitude less time.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 21 of its 60 references that are in the map. First posted on arXiv 24 Feb 2021.
Builds on
21 of 60 references.
References · 21
- 2016Densely Connected Convolutional Networkscited by 6,691
- 2016Bag of Tricks for Efficient Text Classificationcited by 869
- 2016FastText.zip: Compressing text classification modelscited by 331
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
- 2017Learning to Represent Programs with Graphscited by 219
- 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 90
- 2017Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detectioncited by 65
- 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
- 2018Generative Code Modeling with Graphscited by 59
- 2018Neural Code Comprehension: A Learnable Representation of Code Semanticscited by 59
- 2018Automated software vulnerability detection with machine learningcited by 34
9 more
- 2018A General Path-Based Representation for Predicting Program Propertiescited by 28
- 2013Polyglot: Distributed Word Representations for Multilingual NLPcited by 19
- 2016Automated Correction for Syntax Errors in Programming Assignments using Recurrent Neural Networkscited by 13
- 2017Semantic Code Repair using Neuro-Symbolic Transformation Networkscited by 13
- 2018Learning to Repair Software Vulnerabilities with Generative Adversarial Networkscited by 11
- 2017End-to-End Prediction of Buffer Overruns from Raw Source Code via Neural Memory Networkscited by 10
- 2015Do Multi-Sense Embeddings Improve Natural Language Understanding?cited by 9
- 2018Path-Based Function Embedding and its Application to Specification Miningcited by 8
- 2018Code Vectors: Understanding Programs Through Embedded Abstracted Symbolic Tracescited by 7
Built on by
Citing papers per year: 2021: 1; 2022: 0; 2023: 3.
4 papers.
- 2023Learning Performance-Improving Code Editscited by 103
- 2021CompilerGym: Robust, Performant Compiler Optimization Environments for AI Researchcited by 41
- 2023Supersonic: Learning to Generate Source Code Optimizations in C/C++cited by 15
- 2023Learning Compiler Pass Orders using Coreset and Normalized Value Predictioncited by 11
- 2023Supersonic: Learning to Generate Source Code Optimizations in C/C++26 Sep 2023
- 2023Learning Performance-Improving Code Edits15 Feb 2023
- 2023Learning Compiler Pass Orders using Coreset and Normalized Value Prediction9 Jan 2023
- 2021CompilerGym: Robust, Performant Compiler Optimization Environments for AI Research17 Sep 2021