skip to main content
10.1145/3133850.3133856acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Unbounded superoptimization

Published: 25 October 2017 Publication History

Abstract

Our aim is to enable software to take full advantage of the capabilities of emerging microprocessor designs without modifying the compiler.
Towards this end, we propose a new approach to code generation and optimization. Our approach uses an SMT solver in a novel way to generate efficient code for modern architectures and guarantee that the generated code correctly implements the source code. The distinguishing characteristic of our approach is that the size of the constraints does not depend on the candidate sequence of instructions.
To study the feasibility of our approach, we implemented a preliminary prototype, which takes as input LLVM IR code and uses Z3 SMT solver to generate ARMv7-A assembly. The prototype handles arbitrary loop-free code (not only basic blocks) as input and output. We applied it to small but tricky examples used as standard benchmarks for other superoptimization and synthesis tools. We are encouraged to see that Z3 successfully solved complex constraints that arise from our approach.
This work paves the way to employing recent advances in SMT solvers and has a potential to advance SMT solvers further by providing a new category of challenging benchmarks that come from an industrial application domain.

References

[1]
ARM. 2017. ISA specification for ARMv8-A. (2017). https://developer. arm.com/products/architecture/a-profile/exploration-tools, released in April 2017.
[2]
Sorav Bansal and Alex Aiken. 2006. Automatic generation of peephole superoptimizers. In Int. Conf. on Architectural Support for Programming Languages and Operating Systems (ASPLOS). 394–403.
[3]
Clark Barrett, Christopher L. Conway, Morgan Deters, Liana Hadarean, Dejan Jovanovic, Tim King, Andrew Reynolds, and Cesare Tinelli. 2011. CVC4. In Int. Conf. on Computer Aided Verification (CAV). 171–177. http://cvc4.cs.nyu.edu/web/ .
[4]
Clark W. Barrett, Yi Fang, Benjamin Goldberg, Ying Hu, Amir Pnueli, and Lenore D. Zuck. 2005. TVOC: A Translation Validator for Optimizing Compilers. In Int. Conf. on Computer Aided Verification (CAV). 291–295.
[5]
Nikolaj Bjørner and Mikolás Janota. 2015. Playing with Quantified Satisfaction (short paper). In Int. Conf. on Logic for Programming, Artificial Intelligence and Reasoning (LPAR). 15–27.
[6]
Nikolaj Bjørner and Nina Narodytska. 2015. Maximum Satisfiability Using Cores and Correction Sets. In Int. Joint Conf. on Artificial Intelligence (IJCAI). 246–252.
[7]
Nikolaj Bjørner, Anh-Dung Phan, and Lars Fleckenstein. 2015. ν Z -An Optimizing SMT Solver. In Int. Conf. on Tools and Algorithms for the Construction and Analysis of Systems (TACAS). 194–199.
[8]
Martin Brain, Tom Crick, Marina De Vos, and John P. Fitch. 2006. TOAST: Applying Answer Set Programming to Superoptimisation. In Int. Conf. on Logic Programming (ICLP). 270–284.
[9]
Derek L. Bruening. 2004. Efficient, Transparent and Comprehensive Runtime Code Manipulation. Ph.D. Dissertation.
[10]
Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. K Zadeck. 1988. An Efficient Method of Computing Static Single Assignment Form. Technical Report. Providence, RI, USA.
[11]
Bjorner N. de Maura L. 2008. Z3: An efficient SMT solver. In Int. Conf. on Tools and Algorithms for the Construction and Analysis of Systems (TACAS).
[12]
Leonardo de Moura and Nikolaj Bjørner. 2007. Efficient E-Matching for SMT Solvers. In Conference on Automated Deduction (CADE). 183–198.
[13]
Leonardo Mendonça de Moura and Grant Olney Passmore. 2013. The Strategy Challenge in SMT Solving. In Automated Reasoning and Mathematics - Essays in Memory of William W. McCune. 15–44.
[14]
Shaked Flur, Kathryn E Gray, Christopher Pulte, Susmit Sarkar, Ali Sezgin, Luc Maranget, Will Deacon, and Peter Sewell. 2016. Modelling the ARMv8 architecture, operationally: concurrency and ISA. In ACM Symp. on Principles of Programming Languages (POPL). 608–621.
[15]
Anthony Fox. 2012. Directions in ISA Specification. Interactive Theorem Proving.
[16]
Andreas Fröhlich, Armin Biere, Christoph M Wintersteiger, and Youssef Hamadi. 2015. Stochastic Local Search for Satisfiability Modulo Theories. In Proc. of Association for the Advancement of Artificial Intelligence (AAAI). 1136–1143.
[17]
Grigori Fursin, Yuriy Kashnikov, Abdul Wahid Memon, Zbigniew Chamski, Olivier Temam, Mircea Namolaru, Elad Yom-Tov, Bilha Mendelson, Ayal Zaks, Eric Courtois, François Bodin, Phil Barnard, Elton Ashton, Edwin V. Bonilla, John Thomson, Christopher K. I. Williams, and Michael F. P. O’Boyle. 2011. Milepost GCC: Machine Learning Enabled Self-tuning Compiler. International Journal of Parallel Programming 39, 3 (2011), 296–327.
[18]
Shilpi Goel, Warren A. Hunt Jr., Matt Kaufmann, and Soumava Ghosh. 2014. Simulation and formal verification of x86 machine-code programs that make system calls. In Formal Methods in Computer-Aided Design (FMCAD). 91–98.
[19]
Sumit Gulwani, Susmit Jha, Ashish Tiwari, and Ramarathnam Venkatesan. 2011. Synthesis of Loop-free Programs. In SIGPLAN Conf. on Prog. Lang. Design and Impl. (PLDI). 62–73.
[20]
Shachar Itzhaky, Sumit Gulwani, Neil Immerman, and Mooly Sagiv. 2010. A Simple Inductive Synthesis Methodology and Its Applications. In Int. Conf. on Object Oriented Programming Systems Languages and Applications (OOPSLA). 36–46.
[21]
Rajeev Joshi, Greg Nelson, and Keith Randall. 2002. Denali: A Goaldirected Superoptimizer. In SIGPLAN Conf. on Prog. Lang. Design and Impl. (PLDI). 304–314.
[22]
Shuvendu K. Lahiri, Chris Hawblitzel, Ming Kawaguchi, and Henrique Rebêlo. 2012. SYMDIFF: A Language-Agnostic Semantic Diff Tool for Imperative Programs. In Int. Conf. on Computer Aided Verification (CAV). 712–717.
[23]
Shuvendu K. Lahiri, Kenneth L. McMillan, Rahul Sharma, and Chris Hawblitzel. 2013. Differential assertion checking. In Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (FSE). 345–355.
[24]
Monica S. Lam (Ed.). 2000. SIGPLAN Conf. on Prog. Lang. Design and Impl. (PLDI). ACM.
[25]
Xavier Leroy. 2006. Formal certification of a compiler back-end, or: programming a compiler with a proof assistant. In ACM Symp. on Principles of Programming Languages (POPL). ACM Press, 42–54. http: //gallium.inria.fr/~xleroy/publi/compiler-certif.pdf
[26]
Junghee Lim, Akash Lal, and Thomas W. Reps. 2011. Symbolic analysis via semantic reinterpretation. Int. Journal on Software Tools for Technology Transfer (STTT) 13, 1 (2011), 61–87.
[27]
Junghee Lim and Thomas W. Reps. 2013. TSL: A System for Generating Abstract Interpreters and its Application to Machine-Code Analysis. Trans. on Prog. Lang. and Syst. (TOPLAS) 35, 1, Article 4 (2013).
[28]
Nuno P. Lopes, David Menendez, Santosh Nagarakatte, and John Regehr. 2015. Provably Correct Peephole Optimizations with Alive. In SIGPLAN Conf. on Prog. Lang. Design and Impl. (PLDI). http: //web.ist.utl.pt/nuno.lopes/pubs.php?id=alive-pldi15 .
[29]
Henry Massalin. 1987. Superoptimizer: A look at the smallest program. In Int. Conf. on Architectural Support for Programming Languages and Operating Systems (ASPLOS).
[30]
Aleksandar Milicevic and Hillel Kugler. 2011. Model Checking Using SMT and Theory of Lists. In Nasa Formal Methods Symposium, Vol. 6617. Springer Verlag, 282–297.
[31]
George C. Necula. 2000. Translation validation for an optimizing compiler. In PLDI. 83–94.
[32]
Phitchaya Mangpo Phothilimthana, Aditya Thakur, Rastislav Bodik, and Dinakar Dhurjati. 2016. Scaling Up Superoptimization. In Int. Conf. on Architectural Support for Programming Languages and Operating Systems (ASPLOS). 297–310.
[33]
Alastair Reid. 2016. Trustworthy Specifications of ARM v8-A and v8-M System Level Architecture. In Formal Methods in Computer-Aided Design (FMCAD).
[34]
Andrew Reynolds, Morgan Deters, Viktor Kuncak, Cesare Tinelli, and Clark W. Barrett. 2015. Counterexample-Guided Quantifier Instantiation for Synthesis in SMT. In Int. Conf. on Computer Aided Verification (CAV). 198–216.
[35]
Eric Schkufza, Rahul Sharma, and Alex Aiken. 2013. Stochastic Superoptimization. In Int. Conf. on Architectural Support for Programming Languages and Operating Systems (ASPLOS). 305–316.
[36]
Eric Schkufza, Rahul Sharma, and Alex Aiken. 2014. Stochastic Optimization of Floating-point Programs with Tunable Precision. In SIG-PLAN Conf. on Prog. Lang. Design and Impl. (PLDI). 53–64.
[37]
Rahul Sharma, Eric Schkufza, Berkeley Churchill, and Alex Aiken. 2013. Data-driven Equivalence Checking. In Int. Conf. on Object Oriented Programming Systems Languages and Applications (OOPSLA). 391–406.
[38]
Rahul Sharma, Eric Schkufza, Berkeley Churchill, and Alex Aiken. 2015. Conditionally Correct Superoptimization. In Int. Conf. on Object Oriented Programming Systems Languages and Applications (OOPSLA). 147–162.
[39]
Xujie Si, Xin Zhang, Radu Grigore, and Mayur Naik. 2017. Maximum Satisfiability in Software Analysis: Applications and Techniques. In Computer Aided Verification - 29th International Conference, CAV 2017, Heidelberg, Germany, July 24-28, 2017, Proceedings, Part I. 68–94.
[40]
Armando Solar-Lezama, Liviu Tancau, Rastislav Bodik, Sanjit Seshia, and Vijay Saraswat. 2006. Combinatorial Sketching for Finite Programs. In Int. Conf. on Architectural Support for Programming Languages and Operating Systems (ASPLOS). 404–415.
[41]
Alex Aiken Sorav Bansal. 2008. Binary Translation Using Peephole Superoptimizers. In USENIX Symposium on Operating Systems Design and Implementation (OSDI).
[42]
Venkatesh Srinivasan and Thomas Reps. 2015. Synthesis of machine code from semantics. In SIGPLAN Conf. on Prog. Lang. Design and Impl. (PLDI). http://research.cs.wisc.edu/wpis/papers/pldi15.pdf .
[43]
Michael Stepp, Ross Tate, and Sorin Lerner. 2011. Equality-Based Translation Validator for LLVM. In Int. Conf. on Computer Aided Verification (CAV). 737–742.
[44]
Yong Kiam Tan, Magnus O. Myreen, Ramana Kumar, Anthony C. J. Fox, Scott Owens, and Michael Norrish. 2016. A new verified compiler backend for CakeML. In Int. Conf. on Functional Programming (ICFP). 60–73.
[45]
Ross Tate, Michael Stepp, Zachary Tatlock, and Sorin Lerner. 2009. Equality Saturation: a New Approach to Optimization. In ACM Symp. on Principles of Programming Languages (POPL). 264–276.
[46]
David Ung and Cristina Cifuentes. 2000. Machine-adaptable Dynamic Binary Translation. In Proceedings of the ACM SIGPLAN Workshop on Dynamic and Adaptive Compilation and Optimization (DYNAMO ’00). 41–51.
[47]
H. S. Warren. 2002. Hacker’s Delight. Addison-Wesley.
[48]
Aleksandar Zeljic, Christoph M. Wintersteiger, and Philipp Rümmer. 2014. Approximations for Model Construction. In Int. Joint Conf. on Automated Reasoning (IJCAR). 344–359.
[49]
Aleksandar Zeljic, Christoph M. Wintersteiger, and Philipp Rümmer. 2016. Deciding Bit-Vector Formulas with mcSAT. In Theory and Applications of Satisfiability Testing (SAT). 249–266.
[50]
Jianzhou Zhao, Santosh Nagarakatte, Milo M. K. Martin, and Steve Zdancewic. 2012. Formalizing the LLVM intermediate representation for verified program transformations. In ACM Symp. on Principles of Programming Languages (POPL). 427–440.

Cited By

View all
  • (2024)SuperStack: Superoptimization of Stack-Bytecode via Greedy, Constraint-Based, and SAT TechniquesProceedings of the ACM on Programming Languages10.1145/36564358:PLDI(1437-1462)Online publication date: 20-Jun-2024
  • (2022)Super-optimization of Smart ContractsACM Transactions on Software Engineering and Methodology10.1145/350680031:4(1-29)Online publication date: 12-Jul-2022
  • (2022)A Max-SMT Superoptimizer for EVM handling Memory and StorageTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-030-99524-9_11(201-219)Online publication date: 30-Mar-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
Onward! 2017: Proceedings of the 2017 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software
October 2017
261 pages
ISBN:9781450355308
DOI:10.1145/3133850
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

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 October 2017

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. SMT solver
  2. code generation and optimization
  3. constraint solvers
  4. first order logic
  5. instruction set architecture
  6. software synthesis
  7. superoptimization

Qualifiers

  • Research-article

Conference

SPLASH '17
Sponsor:

Acceptance Rates

Overall Acceptance Rate 40 of 105 submissions, 38%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)31
  • Downloads (Last 6 weeks)1
Reflects downloads up to 04 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2024)SuperStack: Superoptimization of Stack-Bytecode via Greedy, Constraint-Based, and SAT TechniquesProceedings of the ACM on Programming Languages10.1145/36564358:PLDI(1437-1462)Online publication date: 20-Jun-2024
  • (2022)Super-optimization of Smart ContractsACM Transactions on Software Engineering and Methodology10.1145/350680031:4(1-29)Online publication date: 12-Jul-2022
  • (2022)A Max-SMT Superoptimizer for EVM handling Memory and StorageTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-030-99524-9_11(201-219)Online publication date: 30-Mar-2022
  • (2021)A formal approach to finding inconsistencies in a metamodelSoftware and Systems Modeling10.1007/s10270-020-00849-8Online publication date: 29-Jan-2021
  • (2020)Synthesis of Super-Optimized Smart Contracts Using Max-SMTComputer Aided Verification10.1007/978-3-030-53288-8_10(177-200)Online publication date: 14-Jul-2020

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