Content area

Abstract

Peephole optimizations are a key component of optimizing compilers. The process of adding a new peephole optimization is manual and time-consuming. The focus of this dissertation is employing formal methods to aid developers in this process. This dissertation presents two techniques to improve the scalability of Souper, a superoptimizer for finding peephole optimizations for LLVM Intermediate Representation (IR). Finding optimization opportunities is merely a start—an optimization still needs to be generalized for it to be useful in a compiler. A superoptimizer does not help with this. The second part of this dissertation presents Hydra, a tool that uses synthesis to generalize peephole optimizations.

Souper’s core algorithm is a lazy enumerative search to find optimizations and it uses Alive2—a translation validation tool for LLVM—to verify the optimizations. This dissertation presents a technique to improve the scalability of Souper by using dataflow analysis to prune the search space. This technique reduces the number of solver calls by 65% and makes Souper 2.32x faster for optimizing standard benchmarks. 

Enumeration—even with pruning—is hard to scale. This dissertation presents Iago— a drop in replacement for Souper that uses a Large Language Model (LLM), and complements it with formal verification to mitigate the risk of incorrect optimizations. Moreover, LLM results are often almost-valid, and Iago uses sketching to fix these results. Iago avoids direct enumeration, and thus, finds larger and more complex optimizations consisting of two or more instructions.

The optimizations found manually, or with a superoptimizer, are often too specific to be implemented in a compiler. Hydra uses program synthesis techniques to generalize concrete constants to symbolic constants, find preconditions, and then ensure the optimization is independent of bitwidth whenever possible. Hydra was able to generalize 75% of the peephole optimizations posted to the LLVM project’s issue tracker.

Details

1010268
Business indexing term
Title
Peephole Optimizations: From Craft Towards Science
Number of pages
149
Publication year
2024
Degree date
2024
School code
0240
Source
DAI-B 86/7(E), Dissertation Abstracts International
ISBN
9798302165084
Advisor
Committee member
Gopalakrishnan, Ganesh; Rakamaric, Zvonimir; Panchekha, Pavel; Polikarpova, Nadia
University/institution
The University of Utah
Department
School of Computing
University location
United States -- Utah
Degree
Ph.D.
Source type
Dissertation or Thesis
Language
English
Document type
Dissertation/Thesis
Dissertation/thesis number
31483789
ProQuest document ID
3156041743
Document URL
https://www.proquest.com/dissertations-theses/peephole-optimizations-craft-towards-science/docview/3156041743/se-2?accountid=208611
Copyright
Database copyright ProQuest LLC; ProQuest does not claim copyright in the individual underlying works.
Database
ProQuest One Academic