skip to main content
research-article

Stochastic superoptimization

Published:16 March 2013Publication History
Skip Abstract Section

Abstract

We formulate the loop-free binary superoptimization task as a stochastic search problem. The competing constraints of transformation correctness and performance improvement are encoded as terms in a cost function, and a Markov Chain Monte Carlo sampler is used to rapidly explore the space of all possible programs to find one that is an optimization of a given target program. Although our method sacrifices completeness, the scope of programs we are able to consider, and the resulting quality of the programs that we produce, far exceed those of existing superoptimizers. Beginning from binaries compiled by llvm -O0 for 64-bit x86, our prototype implementation, STOKE, is able to produce programs which either match or outperform the code produced by gcc -O3, icc -O3, and in some cases, expert handwritten assembly.

References

  1. C. Andrieu, N. de Freitas, A. Doucet, and M. I. Jordan. An introduction to MCMC for machine learning. Machine Learning, 50(1-2):5--43, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  2. S. Bansal and A. Aiken. Automatic generation of peephole superoptimizers. In ASPLOS, pages 394--403, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. L. S. Blackford, J. Demmel, J. Dongarra, I. Duff, S. Hammarling, G. Henry, M. Heroux, L. Kaufman, A. Lumsdaine, A. Petitet, R. Pozo, K. Remington, and R. C. Whaley. An updated set of basic linear algebra subprograms (BLAS). ACM Transactions on Mathematical Software, 28:135--151, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. Cadar, D. Dunbar, and D. R. Engler. Klee: Unassisted and automatic generation of high-coverage tests for complex systems programs. In OSDI, pages 209--224, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Chenney and D. A. Forsyth. Sampling plausible solutions to multi-body constraint problems. In SIGGRAPH, pages 219--228, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. Diaconis. The markov chain monte carlo revolution. Bulletin of the American Mathematical Society, 46(2):179--205, Nov. 2008.Google ScholarGoogle ScholarCross RefCross Ref
  7. V. Ganesh and D. L. Dill. A decision procedure for bit-vectors and arrays. In CAV, pages 519--531, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. W. R. Gilks. Markov Chain Monte Carlo in Practice. Chapman and Hall/CRC, 1999.Google ScholarGoogle Scholar
  9. S. Gulwani, S. Jha, A. Tiwari, and R. Venkatesan. Synthesis of loop-free programs. In PLDI, pages 62--73, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. W. K. Hastings. Monte carlo sampling methods using markov chains and their applications. Biometrika, 57(1):97--109, Apr. 1970.Google ScholarGoogle ScholarCross RefCross Ref
  11. R. Joshi, G. Nelson, and K. H. Randall. Denali: A goal-directed superoptimizer. In PLDI, pages 304--314, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Liang, M. I. Jordan, and D. Klein. Learning programs: A hierarchical bayesian approach. In ICML, pages 639--646, 2010.Google ScholarGoogle Scholar
  13. C.-K. Luk, R. S. Cohn, R. Muth, H. Patil, A. Klauser, P. G. Lowney, S. Wallace, V. J. Reddi, and K. M. Hazelwood. Pin: Building customized program analysis tools with dynamic instrumentation. In PLDI, pages 190--200, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. H. Massalin. Superoptimizer - a look at the smallest program. In ASPLOS, pages 122--126, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, and E. Teller. Equation of state calculations by fast computing machines. The Journal of Chemical Physics, 21(6):1087--1092, 1953.Google ScholarGoogle ScholarCross RefCross Ref
  16. A. F. Neuwald, J. S. Liu, D. J. Lipman, and C. E. Lawrence. Extracting protein alignment models from the sequence database. Nucleic Acids Research, 25:1665--1677, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  17. A. Solar-Lezama, L. Tancau, R. Bodık, S. A. Seshia, and V. A. Saraswat. Combinatorial sketching for finite programs. In ASPLOS, pages 404--415, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. R. Tate, M. Stepp, Z. Tatlock, and S. Lerner. Equality saturation: a new approach to optimization. In POPL, pages 264--276, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. E. Veach and L. J. Guibas. Metropolis light transport. In SIGGRAPH, pages 65--76, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. H. S. Warren. Hacker's Delight. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Stochastic superoptimization

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGARCH Computer Architecture News
        ACM SIGARCH Computer Architecture News  Volume 41, Issue 1
        ASPLOS '13
        March 2013
        540 pages
        ISSN:0163-5964
        DOI:10.1145/2490301
        Issue’s Table of Contents
        • cover image ACM Conferences
          ASPLOS '13: Proceedings of the eighteenth international conference on Architectural support for programming languages and operating systems
          March 2013
          574 pages
          ISBN:9781450318709
          DOI:10.1145/2451116

        Copyright © 2013 ACM

        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]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 16 March 2013

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader