In search of near-optimal optimization phase orderings

Phase ordering is a long standing challenge for traditional optimizing compilers. Varying the order of applying optimization phases to a program can produce different code, with potentially significant performance variation amongst them. A key insight to addressing the phase ordering problem is that many different optimization sequences produce the same code. In an earlier study, we used this observation to restate the phase ordering problem to concentrate on finding all distinct function instances that can be produced due to different phase orderings, instead of attempting to generate code for all possible optimization sequences. Using a novel search algorithm we were able to show that it is possible to exhaustively enumerate the set of all possible function instances that can be produced by different phase orderings in our compiler for most of the functions in our benchmark suite [1]. Finding the optimal function instance within this set for almost any dynamic measure of performance still appears impractical since that would involve execution/simulation of all generated function instances. To find the dynamically optimal function instance we exploit the observation that the enumeration space for a function typically contains a very small number of distinct control flow paths. We simulate only one function instance from each group of function instances having the identical control flow, and use that information to estimate the dynamic performance of the remaining functions in that group. We further show that the estimated dynamic frequency counts obtained by using our method correlate extremely well to simulated processor cycle counts. Thus, by using our measure of dynamic frequencies to identify a small number of the best performing function instances we can often find the optimal phase ordering for a function within a reasonable amount of time. Finally, we perform a case study to evaluate how adept our genetic algorithm is for finding optimal phase orderings within our compiler, and demonstrate how the algorithm can be improved.

[1]  Todd M. Austin,et al.  The SimpleScalar tool set, version 2.0 , 1997, CARN.

[2]  Michael F. P. O'Boyle,et al.  The effect of cache models on iterative compilation for combined tiling and unrolling , 2004, Concurr. Comput. Pract. Exp..

[3]  Michael F. P. O'Boyle,et al.  A Feasibility Study in Iterative Compilation , 1999, ISHPC.

[4]  Keith D. Cooper,et al.  Optimizing for reduced code space using genetic algorithms , 1999, LCTES '99.

[5]  Keith D. Cooper,et al.  ACME: adaptive compilation made efficient , 2005, LCTES '05.

[6]  Douglas L. Jones,et al.  Fast searches for effective optimization phase sequences , 2004, PLDI '04.

[7]  Gary S. Tyson,et al.  Exhaustive optimization phase order space exploration , 2006, International Symposium on Code Generation and Optimization (CGO'06).

[8]  David I. August,et al.  Compiler optimization-space exploration , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[9]  Peter M. W. Knijnenburg,et al.  Generating new general compiler optimization settings , 2005, ICS '05.

[10]  W. W. Peterson,et al.  Cyclic Codes for Error Detection , 1961, Proceedings of the IRE.

[11]  Michael A. Harrison,et al.  Accurate static estimators for program optimization , 1994, PLDI '94.

[12]  Douglas L. Jones,et al.  Fast and efficient searches for effective optimization-phase sequences , 2005, TACO.

[13]  Yunheung Paek,et al.  Finding effective optimization phase sequences , 2003 .

[14]  L. Almagor,et al.  Finding effective compilation sequences , 2004, LCTES '04.

[15]  A WagnerTim,et al.  Accurate static estimators for program optimization , 1994 .

[16]  Peter M. W. Knijnenburg,et al.  Cache Models for Iterative Compilation , 2001, Euro-Par.

[17]  Peter M. W. Knijnenburg,et al.  Iterative compilation in a non-linear optimisation space , 1998 .

[18]  Mary Lou Soffa,et al.  An approach for exploring code improving transformations , 1997, TOPL.

[19]  Mary Lou Soffa,et al.  An approach to ordering optimizing transformations , 1990, PPOPP '90.

[20]  Mary Lou Soffa,et al.  A model-based framework: an approach for profit-driven optimization , 2005, International Symposium on Code Generation and Optimization.

[21]  Trevor Mudge,et al.  MiBench: A free, commercially representative embedded benchmark suite , 2001 .

[22]  Michael F. P. O'Boyle,et al.  Combined Selection of Tile Sizes and Unroll Factors Using Iterative Compilation , 2000, Proceedings 2000 International Conference on Parallel Architectures and Compilation Techniques (Cat. No.PR00622).

[23]  Manuel E. Benitez,et al.  A portable global optimizer and linker , 1988, PLDI '88.

[24]  Steven R. Vegdahl Phase coupling and constant generation in an optimizing microcode compiler , 1982, MICRO 15.

[25]  David Whalley,et al.  A Design Environment for Addressing Architecutre and Compiler Interactions , 1993 .