In plain words: A neural network learns to rewrite real low-level assembly code into faster versions by imitating its own best attempts, not the usual trial-and-error training. It beat gcc's most aggressive setting on 5.9% of test functions, over five times the standard training approach's rate.
Abstract · Learning to Superoptimize Real-world Programs
Program optimization is the process of modifying software to execute more efficiently. Superoptimizers attempt to find the optimal program by employing significantly more expensive search and constraint solving techniques. Generally, these methods do not scale well to programs in real development scenarios, and as a result, superoptimization has largely been confined to small-scale, domain-specific, and/or synthetic program benchmarks. In this paper, we propose a framework to learn to superoptimize real-world programs by using neural sequence-to-sequence models. We created a dataset consisting of over 25K real-world x86-64 assembly functions mined from open-source projects and propose an approach, Self Imitation Learning for Optimization (SILO) that is easy to implement and outperforms a standard policy gradient learning approach on our dataset. Our method, SILO, superoptimizes 5.9% of our test set when compared with the gcc version 10.3 compiler's aggressive optimization level -O3. We also report that SILO's rate of superoptimization on our test set is over five times that of a standard policy gradient approach and a model pre-trained on compiler optimization demonstration.
Alex Shypula, Pengcheng Yin, Jeremy Lacomis, Claire Le Goues, Edward Schwartz, Graham Neubig
arXiv:2109.13498 · cs.LG, cs.AI, cs.PL, cs.SE · submitted Sep 28, 2021 · updated Apr 4, 2022
abstract · pdf · html · Best Paper, ICLR 2022 Deep Learning for Code workshop
Does that mean that the runtime is only 6.2% of the runtime after gcc optimization, or that there was a 6.2% reduction in runtime compared to gcc optimization?