Stochastic Superoptimization
Eric Schkufza, Rahul Sharma, Alex Aiken

TL;DR
This paper introduces a stochastic approach to binary superoptimization using Markov Chain Monte Carlo, enabling the generation of highly optimized code that surpasses traditional compiler outputs and existing superoptimizers.
Contribution
It formulates superoptimization as a stochastic search problem and demonstrates a practical implementation that significantly improves code quality over prior methods.
Findings
STOKE can produce code matching or outperforming gcc with full optimizations.
The method can generate code comparable to expert handwritten assembly.
It explores a large program space efficiently despite sacrificing completeness.
Abstract
We formulate the loop-free, binary superoptimization task as a stochastic search problem. The competing constraints of transformation correctness and performance improvement are encoded as terms in a cost function, and a Markov Chain Monte Carlo sampler is used to rapidly explore the space of all possible programs to find one that is an optimization of a given target program. Although our method sacrifices com- pleteness, the scope of programs we are able to reason about, and the quality of the programs we produce, far exceed those of existing superoptimizers. Beginning from binaries com- piled by llvm -O0 for 64-bit X86, our prototype implemen- tation, STOKE, is able to produce programs which either match or outperform the code sequences produced by gcc with full optimizations enabled, and, in some cases, expert handwritten assembly.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsMachine Learning and Data Classification · Advanced Bandit Algorithms Research · Parallel Computing and Optimization Techniques
