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

Verifying Term Graph Optimizations using Isabelle/HOL

Published: 11 January 2023 Publication History

Abstract

Our objective is to formally verify the correctness of the hundreds of expression optimization rules used within the GraalVM compiler. When defining the semantics of a programming language, expressions naturally form abstract syntax trees, or, terms. However, in order to facilitate sharing of common subexpressions, modern compilers represent expressions as term graphs. Defining the semantics of term graphs is more complicated than defining the semantics of their equivalent term representations. More significantly, defining optimizations directly on term graphs and proving semantics preservation is considerably more complicated than on the equivalent term representations. On terms, optimizations can be expressed as conditional term rewriting rules, and proofs that the rewrites are semantics preserving are relatively straightforward. In this paper, we explore an approach to using term rewrites to verify term graph transformations of optimizations within the GraalVM compiler. This approach significantly reduces the overall verification effort and allows for simpler encoding of optimization rules.

References

[1]
Alfred V. Aho and Jeffrey D. Ullman. 1970. Transformations on Straight Line Programs—Preliminary Version. In Proceedings of the 2nd Annual ACM Symposium on Theory of Computing. ACM, New York, NY, USA. 136–148. https://doi.org/10.1145/800161.805159
[2]
Alfred V. Aho and Jeffrey D. Ullman. 1972. Optimization of Straight Line Programs. SIAM J. Comput., 1, 1 (1972), March, 1–19. https://doi.org/10.1137/0201002
[3]
Andrew W. Appel. 1998. SSA is Functional Programming. SIGPLAN Not., 33, 4 (1998), April, 17–20. issn:0362-1340 https://doi.org/10.1145/278283.278285
[4]
Franz Baader and Tobias Nipkow. 1998. Term Rewriting and All That. Cambridge University Press, Cambridge, UK. https://doi.org/10.1017/CBO9781139172752
[5]
Henk Barendregt, Marko van Eekelen, John Glauert, Richard Kennaway, Rinus Plasmeijer, and Ronan Sleep. 1987. Term graph rewriting. In Proceedings of Parallel Architectures and Languages Europe, Jacobus W. de Bakker (Ed.) (Lecture Notes in Computer Science, Vol. 259). Springer-Verlag, Berlin, Heidelberg. 141–158. https://doi.org/10.1007/3-540-17945-3_8
[6]
Manuel Clavel, Francisco Durán, Steven Eker, Patrick Lincoln, Narciso Martí-Oliet, José Meseguer, and Carolyn Talcott. 2007. All about Maude - a High-Performance Logical Framework: How to Specify, Program and Verify Systems in Rewriting Logic. Springer-Verlag, Berlin, Heidelberg. isbn:3540719407
[7]
Cliff Click and Michael Paleczny. 1995. A Simple Graph-Based Intermediate Representation. SIGPLAN Not., 30, 3 (1995), March, 35–49. issn:0362-1340 https://doi.org/10.1145/202530.202534
[8]
Ronald Gary Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. 1989. An Efficient Method of Computing Static Single Assignment Form. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’89). ACM, New York, NY, USA. 25–35. isbn:0897912942 https://doi.org/10.1145/75277.75280
[9]
Delphine Demange, Yon Fernández de Retana, and David Pichardie. 2018. Semantic Reasoning about the Sea of Nodes. In Proceedings of the 27th International Conference on Compiler Construction (CC 2018). ACM, New York, NY. 163–173. isbn:9781450356442 https://doi.org/10.1145/3178372.3179503
[10]
Gilles Duboscq, Thomas Würthinger, Lukas Stadler, Christian Wimmer, Doug Simon, and Hanspeter Mössenböck. 2013. An Intermediate Representation for Speculative Optimizations in a Dynamic Compiler. In Proceedings of the 7th ACM Workshop on Virtual Machines and Intermediate Languages (VMIL ’13). ACM, New York, NY, USA. 1–10. isbn:9781450326018 https://doi.org/10.1145/2542142.2542143
[11]
Hartmut Ehrig. 1979. Introduction to the algebraic theory of graph grammars (a survey). In Graph-Grammars and Their Application to Computer Science and Biology, Volker Claus, Hartmut Ehrig, and Grzegorz Rozenberg (Eds.). Springer, Berlin, Heidelberg. 1–69. isbn:978-3-540-35091-0 https://doi.org/10.1007/BFb0025714
[12]
Ramana Kumar, Magnus O. Myreen, Michael Norrish, and Scott Owens. 2014. CakeML: A Verified Implementation of ML. In Principles of Programming Languages (POPL ’14). ACM, New York, NY, USA. 179–191. https://doi.org/10.1145/2535838.2535841
[13]
Chris Lattner and Vikram Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the International Symposium on Code Generation and Optimization (CGO ’04). IEEE, New York, NY, USA. 75–86. isbn:0769521029 https://doi.org/10.1109/CGO.2004.1281665
[14]
Juneyoung Lee, Chung-Kil Hur, and Nuno P. Lopes. 2019. AliveInLean: A Verified LLVM Peephole Optimization Verifier. In Computer Aided Verification, Isil Dillig and Serdar Tasiran (Eds.). Springer International Publishing, Cham. 445–455. isbn:978-3-030-25543-5 https://doi.org/10.1007/978-3-030-25543-5_25
[15]
Xavier Leroy, Sandrine Blazy, Daniel Kästner, Bernhard Schommer, Markus Pister, and Christian Ferdinand. 2016. CompCert - A Formally Verified Optimizing Compiler. In Embedded Real Time Software and Systems, 8th European Congress (ERTS ’16). SEE, Toulouse, France. 8 pages. https://hal.inria.fr/hal-01238879
[16]
Andreas Lochbihler. 2018. Fast Machine Words in Isabelle/HOL. In Interactive Theorem Proving 2018, Jeremy Avigad and Assia Mahboubi (Eds.) (Lecture Notes in Computer Science, Vol. 10895). Springer, Cham. 388–410. isbn:978-3-319-94821-8 https://doi.org/10.1007/978-3-319-94821-8_23
[17]
Nuno P. Lopes, David Menendez, Santosh Nagarakatte, and John Regehr. 2018. Practical Verification of Peephole Optimizations with Alive. Commun. ACM, 61, 2 (2018), Jan., 84–91. issn:0001-0782 https://doi.org/10.1145/3166064
[18]
William Mansky and Elsa Gunter. 2010. A Framework for Formal Verification of Compiler Optimizations. In Interactive Theorem Proving 2010, Matt Kaufmann and Lawrence C. Paulson (Eds.) (Lecture Notes in Computer Science, Vol. 6172). Springer, Berlin, Heidelberg. 371–386. isbn:978-3-642-14052-5 https://doi.org/10.1007/978-3-642-14052-5_26
[19]
Daniel Matichuk, Toby Murray, and Makarius Wenzel. 2016. Eisbach: A Proof Method Language for Isabelle. Journal of Automated Reasoning, 56, 3 (2016), March, 261–282. issn:1573-0670 https://doi.org/10.1007/s10817-015-9360-2
[20]
José Meseguer. 2012. Twenty years of rewriting logic. The Journal of Logic and Algebraic Programming, 81, 7 (2012), Oct., 721–781. issn:1567-8326 https://doi.org/10.1016/j.jlap.2012.06.003 Rewriting Logic and its Applications.
[21]
Eric Mullen, Daryl Zuniga, Zachary Tatlock, and Dan Grossman. 2016. Verified Peephole Optimizations for CompCert. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). Association for Computing Machinery, New York, NY, USA. 448–461. isbn:9781450342612 https://doi.org/10.1145/2908080.2908109
[22]
Tobias Nipkow, Markus Wenzel, and Lawrence C. Paulson. 2002. Isabelle/HOL: A Proof Assistant for Higher-Order Logic (Lecture Notes in Computer Science, Vol. 2283). Springer, Berlin, Heidelberg. isbn:3-540-43376-7 issn:0302-9743 https://doi.org/10.1007/3-540-45949-9
[23]
Oracle. 2020. GraalVM: Run Programs Faster Anywhere. https://github.com/oracle/graal
[24]
Detlef Plump. 2002. Essentials of Term Graph Rewriting. Electronic Notes in Theoretical Computer Science, 51 (2002), May, 277–289. issn:1571-0661 https://doi.org/10.1016/S1571-0661(04)80210-X
[25]
Thomas A. Standish, D. C. Harriman, Dennis F. Kibler, and James M. Neighbors. 1976. The Irvine Program Transformation Catalogue: A Stock of Ideas for Improving Programs Using Source-to-Source Transformations. Department of Information and Computer Science, University of California at Irvine. Version 0.2.
[26]
John Staples. 1980. Speeding up subtree replacement systems. Theoretical Computer Science, 11, 1 (1980), May, 39–47. issn:0304-3975 https://doi.org/10.1016/0304-3975(80)90033-X
[27]
Martin Strecker. 2008. Modeling and Verifying Graph Transformations in Proof Assistants. Electronic Notes in Theoretical Computer Science, 203, 1 (2008), 135–148. issn:1571-0661 https://doi.org/10.1016/j.entcs.2008.03.039 Proceedings of the Fourth International Workshop on Computing with Terms and Graphs (TERMGRAPH 2007).
[28]
Mark Utting, Brae J. Webb, and Ian J. Hayes. 2022. Differential Testing of a Verification Framework for Compiler Optimizations (Experience Paper). https://doi.org/10.48550/ARXIV.2212.01748
[29]
Eelco Visser, Zine-el-Abidine Benaissa, and Andrew Tolmach. 1999. Building Program Optimizers with Rewriting Strategies. ACM SIGPLAN Notices, 34 (1999), May, https://doi.org/10.1145/289423.289425
[30]
Brae J. Webb, Mark Utting, and Ian J. Hayes. 2021. A Formal Semantics of the GraalVM Intermediate Representation. In Automated Technology for Verification and Analysis, Zhe Hou and Vijay Ganesh (Eds.) (Lecture Notes in Computer Science, Vol. 12971). Springer International Publishing, Cham. 111–126. isbn:978-3-030-88885-5 issn:0302-9743 https://doi.org/10.1007/978-3-030-88885-5_8
[31]
Makarius Wenzel. 2022. The Isabelle/Isar Reference Manual. Theorem Proving Group at TUM, Munich, Germany.
[32]
Jianzhou Zhao, Santosh Nagarakatte, Milo M.K. Martin, and Steve Zdancewic. 2012. Formalizing the LLVM Intermediate Representation for Verified Program Transformations. In POPL ’12. ACM, New York, NY. 427–440. isbn:9781450310833 https://doi.org/10.1145/2103656.2103709

Cited By

View all
  • (2023)Differential Testing of a Verification Framework for Compiler Optimizations (Case Study)2023 IEEE/ACM 11th International Conference on Formal Methods in Software Engineering (FormaliSE)10.1109/FormaliSE58978.2023.00015(66-75)Online publication date: May-2023

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
CPP 2023: Proceedings of the 12th ACM SIGPLAN International Conference on Certified Programs and Proofs
January 2023
347 pages
ISBN:9798400700262
DOI:10.1145/3573105
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 the author(s) 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: 11 January 2023

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. GraalVM compiler
  2. Isabelle/HOL
  3. sea-of-nodes intermediate representation
  4. verified code optimizer

Qualifiers

  • Research-article

Conference

CPP '23
Sponsor:

Acceptance Rates

Overall Acceptance Rate 18 of 26 submissions, 69%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)16
  • Downloads (Last 6 weeks)0
Reflects downloads up to 01 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Differential Testing of a Verification Framework for Compiler Optimizations (Case Study)2023 IEEE/ACM 11th International Conference on Formal Methods in Software Engineering (FormaliSE)10.1109/FormaliSE58978.2023.00015(66-75)Online publication date: May-2023

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