Skip to main content

An Adaptive Strategy for Inline Substitution

  • Conference paper

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 4959)

Abstract

Inline substitution is an optimization that replaces a procedure call with the body of the procedure that it calls. Inlining has the immediate benefit of reducing the overhead associated with the call, including register saves and restores, parameter evaluation, and activation record setup and teardown. It has secondary benefits that arise from providing greater context for global optimizations. These benefits can be offset by the effects of increased code size, and by deleterious interactions with other optimizations, such as register allocation.

The difficult aspect of inline substitution is choosing which calls to inline. Previous work has focused on static, one-size-fits-all heuristics. This paper presents a feedback-driven adaptive scheme that derives a program-specific inlining heuristic. The key contributions of this work are: (1) a novel parameterization scheme for the inliner that makes it susceptible to fine-grained external control, (2) a scheme for discretizing large integer parameter spaces, and (3) effective search techniques for the resulting search space. This work provides a proof of concept that can provide insight into the design of adaptive controllers for other optimizations with complex decision heuristics. Our goal in this work is not to exhibit the world’s best inliner. Instead, we present evidence to suggest that a program-specific, adaptive scheme is needed to achieve the best results.

Keywords

  • Search Space
  • Parameter Scheme
  • Condition String
  • Adaptive Controller
  • Search Point

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. Allen, F., Carter, J., Fabri, J., Ferrante, J., Harrison, W., Loewner, P., Trevillyan, L.: The experimental compiling system. IBM Journal of Research and Development 24(6), 695–715 (1980)

    CrossRef  Google Scholar 

  2. Allen, F.E., Cocke, J.: A catalogue of optimizing transformations. In: Rustin, J. (ed.) Design and Optimization of a Compiler, pp. 1–30. Prentice-Hall, Englewood Cliffs (1972)

    Google Scholar 

  3. Almagor, L., Cooper, K.D., Grosul, A., Harvey, T.J., Reeves, S.W., Subramanian, D., Torczon, L., Waterman, T.: Finding effective compilation sequences. In: Proceedings of the 2004 ACM SIGPLAN/SIGBED Conference on Languages, Compilers and Tools for Embedded Systems, June 2004, pp. 231–239 (2004)

    Google Scholar 

  4. Ball, J.E.: Predicting the effects of optimization on a procedure body. In: Proceedings of the 1979 SIGPLAN Symposium on Compiler Construction, August 1979, pp. 214–220 (1979)

    Google Scholar 

  5. Cavazos, J., O’Boyle, M.F.P.: Automatic tuning of inlining heuristics. In: Proceedings of the 2005 ACM IEEE Conference on Supercomputing (SC 2005) (November 2005)

    Google Scholar 

  6. Chang, P.P., Mahlke, S.A., Hwu, W.W.: Using profile information to assist classic code optimizations. Software—Practice and Experience 21(12), 1301–1321 (1991)

    CrossRef  Google Scholar 

  7. Cooper, K.D., Hall, M.W., Torczon, L.: An experiment with inline substitution. Software—Practice and Experience 21(6), 581–601 (1991)

    CrossRef  Google Scholar 

  8. Cooper, K.D., Schielke, P.J., Subramanian, D.: Optimizing for reduced code space using genetic algorithms. In: Proceedings of the ACM SIGPLAN Workshop on Languages, Compilers, and Tools for Embedded Systems, May 1999, pp. 1–9 (1999)

    Google Scholar 

  9. Cooper, K.D., Waterman, T.: Investigating adaptive compilation using the MIPSpro compiler. In: Proceedings of the 2003 LACSI Symposium, October 2003, Los Alamos Computer Science Institute, Santa Fe, NM (2003)

    Google Scholar 

  10. Davidson, J.W., Holler, A.M.: A study of a C function inliner. Software—Practice and Experience 18(8), 775–790 (1988)

    CrossRef  Google Scholar 

  11. Davidson, J.W., Holler, A.M.: Subprogram inlining: A study of its effects on program execution time. IEEE Transactions on Software Engineering 18(2), 89–102 (1992)

    CrossRef  Google Scholar 

  12. Dean, J., Chambers, C.: Towards better inlining decisions using inlining trials. In: Proceedings of the 1994 ACM Conference on LISP and Functional Programming, June 1994, pp. 273–282 (1994)

    Google Scholar 

  13. Fisher, J.A.: Trace scheduling: A technique for global microcode compaction. IEEE Transactions on Computers C-30(7), 478–490 (1981)

    CrossRef  Google Scholar 

  14. Granston, E., Holler, A.: Automatic recommendation of compiler options. In: Proceedings of the 4th Feedback Directed Optimization Workshop (December 2001)

    Google Scholar 

  15. Grosul, A.: Adaptive Ordering of Code Transformations in an Optimizing Compiler. PhD thesis, Rice University (2005)

    Google Scholar 

  16. Harrison, W.: A new strategy for code generation - the general purpose optimizing compiler. In: Proceedings of the 4th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, January 1977, pp. 29–37 (1977)

    Google Scholar 

  17. Hecht, M.S.: Flow Analysis of Computer Programs. Elsevier North-Holland, New York (1977)

    MATH  Google Scholar 

  18. Hwu, W.W., Chang, P.P.: Inline function expansion for compiling C programs. In: Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation, June 1989, pp. 246–257 (1989)

    Google Scholar 

  19. Kisuki, T., Knijnenburg, P., O’Boyle, M.: Combined selection of tile sizes and unroll factors using iterative compilation. In: Proceedings of the 2000 International Conference on Parallel Architectures and Compilation Techniques, October 2000, pp. 237–248 (2000)

    Google Scholar 

  20. Knuth, D.E.: An empirical study of FORTRAN programs. Software—Practice and Experience 1(2), 105–133 (1971)

    MATH  CrossRef  Google Scholar 

  21. Kulkarni, P.A., Hines, S.R., Whalley, D.B., Hiser, J.D., Davidson, J.W., Jones, D.L.: Fast and efficient searches for effective optimization-phase sequences. ACM Trans. Archit. Code Optim. 2(2), 165–198 (2005)

    CrossRef  Google Scholar 

  22. Scheifler, R.W.: An analysis of inline substitution for a structured programming language. Communications of the ACM 20(9), 647–654 (1977)

    MATH  CrossRef  Google Scholar 

  23. Serrano, M.: Inline expansion: when and how? In: Serrano, M. (ed.) Proceedings of the Ninth International Symposium on Programming Languages, Implementations, Logics, and Programs, September 1997, pp. 143–147 (1997)

    Google Scholar 

  24. Stephenson, M., Amarasinghe, S., Martin, M., O’Reilly, U.-M.: Meta optimization: Improving compiler heuristics with machine learning. In: Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation (June 2003)

    Google Scholar 

  25. Triantafyllis, S., Vachharajani, M., Vachharajani, N., August, D.I.: Compiler optimization-space exploration. In: Proceedings of the International Symposium on Code Generation and Optimization: Feedback directed and runtime-optimization, March 2003, pp. 204–215 (2003)

    Google Scholar 

  26. Waterman, T.: Adaptive Compilation and Inlining. PhD thesis, Rice Univ.(2005)

    Google Scholar 

  27. Whaley, R.C., Petitet, A., Dongarra, J.J.: Automated empirical optimization of software and the ATLAS project. Parallel Computing 27(1–2), 3–25 (2001)

    MATH  CrossRef  Google Scholar 

  28. Zhao, M., Childers, B., Soffa, M.L.: Predicting the impact of optimizations for embedded systems. In: Proceedings of the 2003 ACM SIGPLAN Conference on Languages, Tools, and Compilers for Embedded Systems, June 2003, pp. 1–11 (2003)

    Google Scholar 

  29. Zhao, P., Amaral, J.N.: To inline or not to inline? enhanced inlining decisions. In: Proceedings of the 16th International Workshop on Languages and Compilers for Parallel Computing, October 2003, pp. 405–419 (2003)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2008 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Cooper, K.D., Harvey, T.J., Waterman, T. (2008). An Adaptive Strategy for Inline Substitution. In: Hendren, L. (eds) Compiler Construction. CC 2008. Lecture Notes in Computer Science, vol 4959. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-78791-4_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-78791-4_5

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-78790-7

  • Online ISBN: 978-3-540-78791-4

  • eBook Packages: Computer ScienceComputer Science (R0)