Autophase V2: Towards Function Level Phase Ordering OptimizationDownload PDF

Published: 11 Jun 2022, Last Modified: 05 May 2023MLArchSys 2022Readers: Everyone
Keywords: Deep Reinforcement Learning, Phase Ordering Problem, Compiler Optimizations, Code Optimizations, Function Level Phase Ordering
TL;DR: This paper investigates the effect of applying different optimization sequences on functions
Abstract: Compilers are equipped with optimization passes that can be applied to improve the quality of a program. The selection and ordering of these passes is a classic NP-hard problem known as the phase ordering problem. Traditionally, compilers use expert-picked sequences to optimize for performance (e.g. -O2, -O3), or code size (e.g. -Os, -Oz). However, not all programs respond positively to all optimizations, and prior work has shown that these expert-picked phase orders can be outperformed by tailoring the phase order decisions to individual programs. In this work, we propose further specializing the phase ordering for each function. We investigate the impact of various function and module passes and show that function-specific phase ordering provides an extra 2.3% improvement in code size reduction compared to program-specific phase ordering using a cheap search budget. Compared to using the Oz flag, the deep reinforcement learning method achieves up to 9% more code size reduction in the same dataset, and up to 6% improvement when transferring to new unseen data. Our exhaustive search experiment shows that searching on different levels of abstraction will be beneficial for solving the phase ordering problem. However, we note several limitations with our reinforcement learning approach, the observation features are not sufficient to give better generalization, the reward has high variance and the datasets are not well representative for all programs.
4 Replies

Loading