A cost model for a graph-based intermediate-representation in a dynamic compiler

David Leopoldseder, Lukas Stadler, Manuel Rigger, Thomas Würthinger, Hanspeter Mössenböck

Research output: Chapter in Book/Report/Conference proceedingConference proceedingspeer-review

Abstract

Compilers provide many architecture-agnostic, high-level optimizations trading off peak performance for code size. High-level optimizations typically cannot precisely reason about their impact, as they are applied before the final shape of the generated machine code can be determined. However, they still need a way to estimate their transformation’s impact on the performance of a compilation unit. Therefore, compilers typically resort to modelling these estimations as trade-off functions that heuristically guide optimization decisions. Compilers such as Graal implement many such handcrafted heuristic trade-off functions, which are tuned for one particular high-level optimization. Heuristic trade-off functions base their reasoning on limited knowledge of the compilation unit, often causing transformations that heavily increase code size or even decrease performance. To address this problem, we propose a cost model for Graal’s high-level intermediate representation that models relative operation latencies and operation sizes in order to be used in trade-off functions of compiler optimizations. We implemented the cost model in Graal and used it in two code-duplication-based optimizations. This allowed us to perform a more fine-grained code size trade-off in existing compiler optimizations, reducing the code size increase of our optimizations by up to 50% compared to not using the proposed cost model in these optimizations, without sacrificing performance. Our evaluation demonstrates that the cost model allows optimizations to perform fine-grained code size and performance trade-offs outperforming hard-coded heuristics.
Original languageEnglish
Title of host publicationProceeding VMIL 2018 Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages
PublisherACM New York, NY, USA
Pages26-35
Number of pages10
ISBN (Print)978-1-4503-6071-5
DOIs
Publication statusPublished - 2018

Fields of science

  • 102 Computer Sciences
  • 102009 Computer simulation
  • 102011 Formal languages
  • 102013 Human-computer interaction
  • 102022 Software development
  • 102024 Usability research
  • 102029 Practical computer science

JKU Focus areas

  • Computation in Informatics and Mathematics
  • Engineering and Natural Sciences (in general)

Cite this