Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Practical automatic loop specialization

Published: 16 March 2013 Publication History

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.
[2]
L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994.
[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.
[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.
[5]
A. Berlin and D. Weise. Compiling scientific code using partial evaluation. IEEE Computer, 23:25--37, December 1990.
[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.
[7]
Computer Language Benchmarks Game. http://shootout.alioth.debian.org/.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[15]
P. Kleinrubatscher, A. Kriegshaber, R. Zöchling, and R. Glück. FORTRAN program specialization. ACM SIGPLAN Notices, 30:61--70, April 1995.
[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.
[17]
Lua. http://www.lua.org/.
[18]
H. Makholm. Specializing C -- an introduction to the principles behind C-Mix/II. Technical report, University of Copenhagen, Department of Computer Science, 1999.
[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.
[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.
[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.
[22]
Perl. http://www.perl.org/.
[23]
Python. http://www.python.org/.
[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.
[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.
[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.
[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.
[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.
[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.

Cited By

View all
  • (2024)Optimistic and Scalable Global Function MergingProceedings of the 25th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems10.1145/3652032.3657575(46-57)Online publication date: 20-Jun-2024
  • (2019)Redundant loadsProceedings of the 41st International Conference on Software Engineering10.1109/ICSE.2019.00103(982-993)Online publication date: 25-May-2019
  • (2019)Language-Agnostic Optimization and Parallelization for Interpreted LanguagesLanguages and Compilers for Parallel Computing10.1007/978-3-030-35225-7_4(36-46)Online publication date: 15-Nov-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
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
Published in SIGARCH Volume 41, Issue 1

Check for updates

Author Tags

  1. loop specialization
  2. partial evaluation
  3. profile based optimization
  4. program specialization

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)5
  • Downloads (Last 6 weeks)0
Reflects downloads up to 03 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Optimistic and Scalable Global Function MergingProceedings of the 25th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems10.1145/3652032.3657575(46-57)Online publication date: 20-Jun-2024
  • (2019)Redundant loadsProceedings of the 41st International Conference on Software Engineering10.1109/ICSE.2019.00103(982-993)Online publication date: 25-May-2019
  • (2019)Language-Agnostic Optimization and Parallelization for Interpreted LanguagesLanguages and Compilers for Parallel Computing10.1007/978-3-030-35225-7_4(36-46)Online publication date: 15-Nov-2019
  • (2017)REDSPYACM SIGARCH Computer Architecture News10.1145/3093337.303772945:1(47-61)Online publication date: 4-Apr-2017
  • (2017)Typed ArchitecturesACM SIGARCH Computer Architecture News10.1145/3093337.303772645:1(77-90)Online publication date: 4-Apr-2017
  • (2017)REDSPYACM SIGPLAN Notices10.1145/3093336.303772952:4(47-61)Online publication date: 4-Apr-2017
  • (2017)Typed ArchitecturesACM SIGPLAN Notices10.1145/3093336.303772652:4(77-90)Online publication date: 4-Apr-2017
  • (2017)REDSPYACM SIGOPS Operating Systems Review10.1145/3093315.303772951:2(47-61)Online publication date: 4-Apr-2017
  • (2017)Typed ArchitecturesACM SIGOPS Operating Systems Review10.1145/3093315.303772651:2(77-90)Online publication date: 4-Apr-2017
  • (2017)REDSPYProceedings of the Twenty-Second International Conference on Architectural Support for Programming Languages and Operating Systems10.1145/3037697.3037729(47-61)Online publication date: 4-Apr-2017
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media