David Leopoldseder, Lukas Stadler, Manuel Rigger, Thomas Würthinger, Hanspeter Mössenböck,
"A cost model for a graph-based intermediate-representation in a dynamic compiler"
: Proceeding VMIL 2018 Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages, ACM New York, NY, USA, Seite(n) 26-35, 2018, ISBN: 978-1-4503-6071-5
Original Titel:
A cost model for a graph-based intermediate-representation in a dynamic compiler
Sprache des Titels:
Englisch
Original Buchtitel:
Proceeding VMIL 2018 Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages
Original Kurzfassung:
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.