skip to main content
research-article

Practical automatic loop specialization

Published:16 March 2013Publication History
Skip Abstract Section

Abstract

Program specialization optimizes a program with respect to program invariants, including known, fixed inputs. These invariants can be used to enable optimizations that are otherwise unsound. In many applications, a program input induces predictable patterns of values across loop iterations, yet existing specializers cannot fully capitalize on this opportunity. To address this limitation, we present Invariant-induced Pattern based Loop Specialization (IPLS), the first fully-automatic specialization technique designed for everyday use on real applications. Using dynamic information-flow tracking, IPLS profiles the values of instructions that depend solely on invariants and recognizes repeating patterns across multiple iterations of hot loops. IPLS then specializes these loops, using those patterns to predict values across a large window of loop iterations. This enables aggressive optimization of the loop; conceptually, this optimization reconstructs recurring patterns induced by the input as concrete loops in the specialized binary. IPLS specializes real-world programs that prior techniques fail to specialize without requiring hints from the user. Experiments demonstrate a geomean speedup of 14.1% with a maximum speedup of 138% over the original codes when evaluated on three script interpreters and eleven scripts each.

References

  1. R. Allen and K. Kennedy. Optimizing compilers for modern architectures: a dependence-based approach. Morgan Kaufmann Publishers Inc., 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994.Google ScholarGoogle Scholar
  3. V. Bala, E. Duesterwald, and S. Banerjia. Dynamo: A transparent dynamic optimization system. In Proceedings of the ACM SIGPLAN '00 Conference on Programming Language Design and Implementation, pages 1--12, June 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. Berlin. Partial evaluation applied to numerical computation. In Proceedings of the 1990 ACM conference on LISP and functional programming, pages 139--150, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. Berlin and D. Weise. Compiling scientific code using partial evaluation. IEEE Computer, 23:25--37, December 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 18--25, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Computer Language Benchmarks Game. http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  8. C. Consel, L. Hornof, F. Noel, J. Noyé, and N. Volansche. A uniform approach for compile-time and run-time specialization. In Selected Papers from the International Seminar on Partial Evaluation, pages 54--72, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. Consel, J. L. Lawall, and A.-F. Le Meur. A tour of Tempo: a program specializer for the C language. Science of Computer Programming, 52:341--370, August 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. C. Consel and F. Noel. A general approach for run-time specialization and its application to C. In Proceedings of the ACM Symposium on Principles of Programming Languages, pages 145--156, January 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the 2009 ACM SIGPLAN conference on Programming language design and implementation, pages 465--478, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. Grant, M. Mock, M. Philipose, C. Chambers, and S. Eggers. Annotation-directed run-time specialization in C. In Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation\ (PEPM), pages 163--178, June 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. B. Grant, M. Philipose, M. Mock, C. Chambers, and S. Eggers. An evaluation of staged run-time optimizations in DyC. In Proceedings of the ACM SIGPLAN Symposium on Programming Language Design and Implementation, pages 293--304, May 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. N. D. Jones, P. Sestoft, and H. Søndergaard. An experiment in partial evaluation: the generation of a compiler generator. ACM SIGPLAN Notices, 20:82--87, August 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. P. Kleinrubatscher, A. Kriegshaber, R. Zöchling, and R. Glück. FORTRAN program specialization. ACM SIGPLAN Notices, 30:61--70, April 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO '04: Proceedings of the International Symposium on Code Generation and Optimization, page 75, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Lua. http://www.lua.org/.Google ScholarGoogle Scholar
  18. H. Makholm. Specializing C -- an introduction to the principles behind C-Mix/II. Technical report, University of Copenhagen, Department of Computer Science, 1999.Google ScholarGoogle Scholar
  19. H. Masuhara and A. Yonezawa. Run-time bytecode specialization. In Proceedings of the Second Symposium on Programs as Data Objects, pages 138--154, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Mock, M. Berryman, C. Chambers, and S. Eggers. Calpa: A tool for automating dynamic compilation. In Proceedings of the Second Workshop on Feedback-Directed Optimization, pages 100--109, November 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. F. Noel, L. Hornof, C. Consel, and J. L. Lawall. Automatic, template-based run-time specialization: Implementation and experimental study. In Proceedings of the 1998 International Conference on Computer Languages, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Perl. http://www.perl.org/.Google ScholarGoogle Scholar
  23. Python. http://www.python.org/.Google ScholarGoogle Scholar
  24. U. P. Schultz, J. L. Lawall, and C. Consel. Automatic program specialization for Java. ACM Transactions on Programming Languages and Systems, 25:452--499, July 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. A. Shankar, S. S. Sastry, R. Bodık, and J. E. Smith. Runtime specialization with optimistic heap analysis. In Proceedings of the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 327--343, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. G. E. Suh, J. W. Lee, D. Zhang, and S. Devadas. Secure program execution via dynamic information flow tracking. In Proceedings of the 11th international conference on Architectural support for programming languages and operating systems, pages 85--96, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Q. Wu, A. Pyatakov, A. N. Spiridonov, E. Raman, D. W. Clark, and D. I. August. Exposing memory access regularities using object-relative memory profiling. In Proceedings of the International Symposium on Code Generation and Optimization, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Yermolovich, C. Wimmer, and M. Franz. Optimization of dynamic languages using hierarchical layering of virtual machines. In Proceedings of the 5th symposium on Dynamic languages, pages 79--88, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. M. Zaleski, A. D. Brown, and K. Stoodley. YETI: a graduallY extensible trace interpreter. In Proceedings of the 3rd international conference on Virtual execution environments, pages 83--93, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Practical automatic loop specialization

    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 SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 48, Issue 4
      ASPLOS '13
      April 2013
      540 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2499368
      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