动态编译器中基于图的中间表示的成本模型

David Leopoldseder, Lukas Stadler, Manuel Rigger, Thomas Würthinger, H. Mössenböck
{"title":"动态编译器中基于图的中间表示的成本模型","authors":"David Leopoldseder, Lukas Stadler, Manuel Rigger, Thomas Würthinger, H. Mössenböck","doi":"10.1145/3281287.3281290","DOIUrl":null,"url":null,"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.","PeriodicalId":155574,"journal":{"name":"Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages","volume":"4 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2018-11-04","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"8","resultStr":"{\"title\":\"A cost model for a graph-based intermediate-representation in a dynamic compiler\",\"authors\":\"David Leopoldseder, Lukas Stadler, Manuel Rigger, Thomas Würthinger, H. Mössenböck\",\"doi\":\"10.1145/3281287.3281290\",\"DOIUrl\":null,\"url\":null,\"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.\",\"PeriodicalId\":155574,\"journal\":{\"name\":\"Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages\",\"volume\":\"4 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2018-11-04\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"8\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3281287.3281290\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3281287.3281290","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 8

摘要

编译器提供了许多与体系结构无关的高级优化,以牺牲代码大小的峰值性能为代价。高级优化通常不能精确地推断它们的影响,因为它们是在确定生成的机器码的最终形状之前应用的。然而,他们仍然需要一种方法来评估转换对编译单元性能的影响。因此,编译器通常将这些估计建模为启发式地指导优化决策的权衡函数。像Graal这样的编译器实现了许多这样手工制作的启发式权衡函数,这些函数针对一个特定的高级优化进行了调优。启发式权衡函数将其推理建立在对编译单元有限的知识基础上,通常会导致严重增加代码大小甚至降低性能的转换。为了解决这个问题,我们为Graal的高级中间表示提出了一个成本模型,该模型对相对的操作延迟和操作大小进行建模,以便在编译器优化的权衡函数中使用。我们在Graal中实现了成本模型,并在两个基于代码重复的优化中使用了它。这使我们能够在现有的编译器优化中执行更细粒度的代码大小权衡,与在这些优化中不使用建议的成本模型相比,在不牺牲性能的情况下,将优化的代码大小增加减少了多达50%。我们的评估表明,成本模型允许优化执行细粒度代码大小和性能权衡,优于硬编码启发式。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
A cost model for a graph-based intermediate-representation in a dynamic compiler
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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信