Advertisement

Hybrid Optimizations: Which Optimization Algorithm to Use?

  • John Cavazos
  • J. Eliot B. Moss
  • Michael F. P. O’Boyle
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)

Abstract

We introduce a new class of compiler heuristics: hybrid optimizations. Hybrid optimizations choose dynamically at compile time which optimization algorithm to apply from a set of different algorithms that implement the same optimization. They use a heuristic to predict the most appropriate algorithm for each piece of code being optimized. Specifically, we construct a hybrid register allocator that chooses between linear scan and graph coloring register allocation. Linear scan is more efficient, but sometimes less effective; graph coloring is generally more expensive, but sometimes more effective. Our setting is Java JIT compilation, which makes optimization algorithm efficiency particularly important.

Our hybrid allocator decides, based on features of a method, which algorithm to apply to that method. We used supervised learning to induce the decision heuristic. We evalute our technique within Jikes RVM [1] and show on average it outperforms graph coloring by 9% and linear scan by 3% for a typical compilation scenario. To our knowledge, this is the first time anyone has used heuristics induced by machine learning to select between different optimization algorithms.

Keywords

Allocation Algorithm Graph Coloring Training Instance Heuristic Function Hybrid Optimization 
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. 1.
    Alpern, B., Attanasio, C.R., Barton, J.J., Burke, M.G., Cheng, P., Choi, J.-D., Cocchi, A., Fink, S.J., Grove, D., Hind, M., Hummel, S.F., Lieber, D., Litvinov, V., Mergen, M.F., Ngo, T., Russell, J.R., Sarkar, V., Serrano, M.J., Shepherd, J.C., Smith, S.E., Sreedhar, V.C., Srinivasan, H., Whaley, J.: The Jalapeño virtual machine. IBM Systems Journal 39(1), 211–238 (2000)CrossRefGoogle Scholar
  2. 2.
    Appel, A., George, L.: Optimal spilling for CISC machines with few registers. In: Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, Snowbird, Utah, June 2001, pp. 243–253. Association of Computing Machinery (2001)Google Scholar
  3. 3.
    Arnold, M., Fink, S., Grove, D., Hind, M., Sweeney, P.F.: Adaptive optimization in the Jalapeño JVM. In: ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), Minneapolis, MN, October 2000, pp. 47–65. ACM Press, New York (2000)CrossRefGoogle Scholar
  4. 4.
    Bernstein, D., Goldin, D.Q., Golumbic, M.C., Mansour, Y., Nahshon, I., Pinter, R.Y.: Spill code minimization techniques for optimizing compilers. In: SIGPLAN 1989 Conference on Programming Language Design and Implementation, Portland, Oregon, June 1989, pp. 258–263. ACM Press, New York (1989)CrossRefGoogle Scholar
  5. 5.
    Briggs, P., Cooper, K.D., Kennedy, K., Torczon, L.: Coloring heuristics for register allocation. In: Proceedings of the ACM SIGPLAN 1989 Conference on Programming language design and implementation, pp. 275–284. ACM Press, New York (1989)CrossRefGoogle Scholar
  6. 6.
    Briggs, P., Cooper, K.D., Torczon, L.: Improvements to graph coloring register allocation. ACM Transactions on Programming Languages and Systems (TOPLAS) 16(3), 428–455 (1994)CrossRefGoogle Scholar
  7. 7.
    Cavazos, J., Moss, J.E.B.: Inducing heuristics to decide whether to schedule. In: Proceedings of the ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation, Washington, D.C., June 2004, pp. 183–194. ACM Press, New York (2004)CrossRefGoogle Scholar
  8. 8.
    Chaitin, G.J.: Register allocation and spilling via graph coloring. In: Proceedings of the ACM SIGPLAN 1982 Conference on Programming Language Design and Implementation, Boston, Massachusetts, June 1982, pp. 98–101. ACM Press, New York (1982)Google Scholar
  9. 9.
    Cohen, W.W.: Fast effective rule induction. In: Proceedings of the Twelfth International Conference on Machine Learning, Lake Tahoe CA, November 1995, pp. 115–123. Morgan Kaufmann, San Francisco (1995)Google Scholar
  10. 10.
    George, L., Appel, A.W.: Iterated register coalescing. ACM Transactions on Programming Languages and Systems 18(3), 300–324 (1996)CrossRefGoogle Scholar
  11. 11.
    Lagoudakis, M.G., Littman, M.L.: Algorithm selection using reinforcement learning. In: Proceedings of the 17th International Conference on Machine Learning, Stanford CA, pp. 511–518. Morgan Kaufmann, San Francisco (2000)Google Scholar
  12. 12.
    Monsifrot, A., Bodin, F., Quiniou, R.: A machine learning approach to automatic production of compiler heuristics. In: Scott, D. (ed.) AIMSA 2002. LNCS, vol. 2443, pp. 41–50. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  13. 13.
    Poletto, M., Sarkar, V.: Linear scan register allocation. ACM Transactions on Programming Languages and Systems 21(5), 895–913 (1999)CrossRefGoogle Scholar
  14. 14.
    Standard Performance Evaluation Corporation (SPEC), Fairfax, VA. SPEC JVM 1998 Benchmarks (1998)Google Scholar
  15. 15.
    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, San Diego, Ca, June 2003, pp. 77–90. ACM Press, New York (2003)CrossRefGoogle Scholar
  16. 16.
    Traub, O., Holloway, G., Smith, M.D.: Quality and speed in linear-scan register allocation. In: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, Montreal, Canada, June 1998, pp. 142–151. ACM Press, New York (1998)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • John Cavazos
    • 1
  • J. Eliot B. Moss
    • 2
  • Michael F. P. O’Boyle
    • 1
  1. 1.Member of HiPEAC, Institute for Computing Systems Architecture (ICSA), School of InformaticsUniversity of EdinburghEdinburghUK
  2. 2.Department of Computer ScienceUniversity of MassachusettsAmherstUSA

Personalised recommendations