Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1480881.1480915acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Equality saturation: a new approach to optimization

Published: 21 January 2009 Publication History

Abstract

Optimizations in a traditional compiler are applied sequentially, with each optimization destructively modifying the program to produce a transformed program that is then passed to the next optimization. We present a new approach for structuring the optimization phase of a compiler. In our approach, optimizations take the form of equality analyses that add equality information to a common intermediate representation. The optimizer works by repeatedly applying these analyses to infer equivalences between program fragments, thus saturating the intermediate representation with equalities. Once saturated, the intermediate representation encodes multiple optimized versions of the input program. At this point, a profitability heuristic picks the final optimized program from the various programs represented in the saturated representation. Our proposed way of structuring optimizers has a variety of benefits over previous approaches: our approach obviates the need to worry about optimization ordering, enables the use of a global optimization heuristic that selects among fully optimized programs, and can be used to perform translation validation, even on compilers other than our own. We present our approach, formalize it, and describe our choice of intermediate representation. We also present experimental results showing that our approach is practical in terms of time and space overhead, is effective at discovering intricate optimization opportunities, and is effective at performing translation validation for a realistic optimizer.

References

[1]
L. Almagor, K. D. Cooper, A. Grosul, T. J. Harvey, S. W. Reeves, D. Subramanian, L. Torczon, and T. Waterman. Finding effective compilation sequences. In LCTES, 2004.
[2]
B. Alpern, M.Wegman, and F. Zadeck. Detecting equality of variables in programs. In POPL, January 1988.
[3]
E. A. Ashcroft and W. W. Wadge. Lucid, a nonprocedural language with iteration. Communications of the ACM, 20(7):519--526, 1977.
[4]
S. Bansal and A. Aiken. Automatic generation of peephole superoptimizers. In ASPLOS, 2006.
[5]
R. Bird and P. Wadler. Introduction to Functional Programming. Prentice Hall, 1988.
[6]
James M. Boyle, Terence J. Harmer, and Victor L. Winter. The TAMPR program transformation system: simplifying the development of numerical software. Modern software tools for scientific computing, pages 353--372, 1997.
[7]
M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming, 72(1-2):52--70, 2008.
[8]
K. D. Cooper C. Click. Combining analyses, combining optimizations. Transactions on Programming Languages and Systems, 17(2):181--196, 1995.
[9]
C. Click. Global code motion/global value numbering. In PLDI, June 1995.
[10]
K. D. Cooper, P. J. Schielke, and Subramanian D. Optimizing for reduced code space using genetic algorithms. In LCTES, 1999.
[11]
R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and K. Zadeck. An efficient method for computing static single assignment form. In POPL, January 1989.
[12]
Jeffrey Dean and Craig Chambers. Towards better inlining decisions using inlining trials. In Conference on LISP and Functional Programming, 1994.
[13]
D. Detlefs, G. Nelson, and J. Saxe. Simplify: A theorem prover for program checking. Journal of the Association for Computing Machinery, 52(3):365--473, May 2005.
[14]
E. Dijkstra. Go to statement considered harmful. pages 27--33, 1979.
[15]
J. Ferrante, K. Ottenstein, and J. Warren. The program dependence graph and its use in optimization. Transactions on Programming Languages and Systems, 9(3):319--349, July 1987.
[16]
Christopher W. Fraser, Robert R. Henry, and Todd A. Proebsting. BURG: fast optimal instruction selection and tree parsing. SIGPLAN Notices, 27(4):68--76, April 1992.
[17]
J. Giarratano and G. Riley. Expert Systems -- Principles and Programming. PWS Publishing Company, 1993.
[18]
Torbjorn Granlund and Richard Kenner. Eliminating branches using a superoptimizer and the GNU C compiler. In PLDI, 1992.
[19]
P. Havlak. Construction of thinned gated single-assignment form. In Workshop on Languages and Compilers for Parallel Computing, 1993.
[20]
W. M. Johnston, J. R. P. Hanna, and R. J. Millar. Advances in dataflow programming languages. ACM Computing Surveys, 36(1):1--34, 2004.
[21]
R. Joshi, G. Nelson, and K. Randall. Denali: a goal-directed superoptimizer. In PLDI, June 2002.
[22]
L. Torczon K. D. Cooper, D. Subramanian. Adaptive optimizing compilers for the 21st century. The Journal of Supercomputing, pages 7--22, 2002.
[23]
S. Lerner, D. Grove, and C. Chambers. Composing dataflow analyses and transformations. In POPL, January 2002.
[24]
Henry Massalin. Superoptimizer: a look at the smallest program. In ASPLOS, 1987.
[25]
G. Necula. Translation validation for an optimizing compiler. In PLDI, June 2000.
[26]
G. Nelson and D. Oppen. Simpliflication by cooperating decision procedures. Transactions on Programming Languages and Systems, 1(2):245--257, October 1979.
[27]
G. Nelson and D. Oppen. Fast decision procedures based on congruence closure. Journal of the Association for Computing Machinery, 27(2):356--364, April 1980.
[28]
K. Ottenstein, R. Ballance, and A. MacCabe. The program dependence web: a representation supporting control-, data-, and demand-driven interpretation of imperative languages. In PLDI, June 1990.
[29]
K. Pengali, M. Beck, and R. Johson. Dependence Flow graphs: an algebraic approach to program dependencies. In POPL, January 1991.
[30]
A. Pnueli, M. Siegel, and E. Singerman. Translation validation. In TACAS, 1998.
[31]
H. Sheini and K. Sakallah. Pueblo: A hybrid pseudo-boolean SAT solver. Journal on Satisfiability, Boolean Modeling and Computation, 2:61--96, 2006.
[32]
B. Steffen, J. Knoop, and O. Ruthing. The value flow graph: A program representation for optimal program transformations. In European Symposium on Programming, 1990.
[33]
Ross Tate, Michael Stepp, Zachary Tatlock, and Sorin Lerner. Translating between PEGs and CFGs. Technical Report CS2008-0931, University of California, San Diego, November 2008.
[34]
P. Tu and D. Padua. Efficient building and placing of gating functions. In PLDI, June 1995.
[35]
R. Vallee-Rai, L. Hendren, V. Sundaresan, P. Lam, E. Gagnon, and P. Co. Soot -- a Java optimization framework. In CASCON, 1999.
[36]
M. G. J. van den Brand, J. Heering, P. Klint, and P. A. Olivier. Compiling language definitions: the ASF+SDF compiler. Transactions on Programming Languages and Systems, 24(4), 2002.
[37]
E. Visser, Z. Benaissa, and A Tolmach. Building program optimizers with rewriting strategies. In ICFP, 1998.
[38]
D. Weise, R. Crew, M. Ernst, and B. Steensgaard. Value dependence graphs: Representation without taxation. In POPL, 1994.
[39]
Debbie Whitfield and Mary Lou Soffa. An approach to ordering optimizing transformations. In PPOPP, 1990.
[40]
Deborah L. Whitfield and Mary Lou Soffa. An approach for exploring code improving transformations. Transactions on Programming Languages and Systems, 19(6):1053--1084, November 1997.
[41]
B. Xin, W. N. Sumner, and X. Zhang. Efficient program execution indexing. In PLDI, June 2008.
[42]
Lenore Zuck, Amir Pnueli, Yi Fang, and Benjamin Goldberg. VOC: A methodology for the translation validation of optimizing compilers. Journal of Universal Computer Science, 9(3):223--247, March 2003.

Cited By

View all
  • (2024)CCLemma: E-Graph Guided Lemma Discovery for Inductive Equational ProofsProceedings of the ACM on Programming Languages10.1145/36746538:ICFP(818-844)Online publication date: 15-Aug-2024
  • (2024)Equivalence by Canonicalization for Synthesis-Backed RefactoringProceedings of the ACM on Programming Languages10.1145/36564538:PLDI(1879-1904)Online publication date: 20-Jun-2024
  • (2024)Hydra: Generalizing Peephole Optimizations with Program SynthesisProceedings of the ACM on Programming Languages10.1145/36498378:OOPSLA1(725-753)Online publication date: 29-Apr-2024
  • Show More Cited By

Index Terms

  1. Equality saturation: a new approach to optimization

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
    January 2009
    464 pages
    ISBN:9781605583792
    DOI:10.1145/1480881
    • cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 44, Issue 1
      POPL '09
      January 2009
      453 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1594834
      Issue’s Table of Contents
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 21 January 2009

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. compiler optimization
    2. equality reasoning
    3. intermediate representation

    Qualifiers

    • Research-article

    Conference

    POPL09

    Acceptance Rates

    Overall Acceptance Rate 824 of 4,130 submissions, 20%

    Upcoming Conference

    POPL '25

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)340
    • Downloads (Last 6 weeks)28
    Reflects downloads up to 30 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)CCLemma: E-Graph Guided Lemma Discovery for Inductive Equational ProofsProceedings of the ACM on Programming Languages10.1145/36746538:ICFP(818-844)Online publication date: 15-Aug-2024
    • (2024)Equivalence by Canonicalization for Synthesis-Backed RefactoringProceedings of the ACM on Programming Languages10.1145/36564538:PLDI(1879-1904)Online publication date: 20-Jun-2024
    • (2024)Hydra: Generalizing Peephole Optimizations with Program SynthesisProceedings of the ACM on Programming Languages10.1145/36498378:OOPSLA1(725-753)Online publication date: 29-Apr-2024
    • (2024)Evaluating the Effectiveness of Deep Learning Models for Foundational Program Analysis TasksProceedings of the ACM on Programming Languages10.1145/36498298:OOPSLA1(500-528)Online publication date: 29-Apr-2024
    • (2024)Application-level Validation of Accelerator Designs Using a Formal Software/Hardware InterfaceACM Transactions on Design Automation of Electronic Systems10.1145/363905129:2(1-25)Online publication date: 14-Feb-2024
    • (2024)Guided Equality SaturationProceedings of the ACM on Programming Languages10.1145/36329008:POPL(1727-1758)Online publication date: 5-Jan-2024
    • (2024)Latent Idiom Recognition for a Minimalist Functional Array Language Using Equality Saturation2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO57630.2024.10444879(270-282)Online publication date: 2-Mar-2024
    • (2024)A Tensor Algebra Compiler for Sparse Differentiation2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO57630.2024.10444787(1-12)Online publication date: 2-Mar-2024
    • (2024) Wasm-MutateComputers and Security10.1016/j.cose.2024.103731139:COnline publication date: 16-May-2024
    • (2024)Transforming Optimization Problems into Disciplined Convex Programming FormIntelligent Computer Mathematics10.1007/978-3-031-66997-2_11(183-202)Online publication date: 29-Jul-2024
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media