在Modelica编译器中引入即时编译

John Tinnerholm, Martin Sjölund, A. Pop
{"title":"在Modelica编译器中引入即时编译","authors":"John Tinnerholm, Martin Sjölund, A. Pop","doi":"10.1145/3365984.3365990","DOIUrl":null,"url":null,"abstract":"We are investigating ways of introducing just-in-time compilation in a standard-compliant Modelica compiler, the Open-Modelica compiler (OMC). The main motivations are enabling extensions to support dynamically varying model structure, faster compilation, and faster recompilation of models after changes. We are investigating two approaches. The first approach is to adapt the low-level OpenModelica intermediate representation (IR) before code generation to be compatible with LLVM. In that way we can avoid generating intermediate C-code and instead generate LLVM IR in memory for just-in-time compilation (JIT). The second approach is to translate OMC itself written in MetaModelica to Julia, and thereby gain access to the JIT capabilities of LLVM. Another benefit of the second approach is the access to the Julia ecosystem, including a rich set of libraries for numerical computing. We have done a preliminary investigation of both approaches, with measurements on a selected sample of algorithms, and discovered that compilation-time of generated Julia code is slower compared to generating LLVM IR directly. We conclude that providing a standard-compliant Modelica compiler which supports a dynamically varying model structure is feasible and possible, and we believe that such a compiler can be provided by using Julia or MetaModelica.","PeriodicalId":394627,"journal":{"name":"Proceedings of the 9th International Workshop on Equation-based Object-oriented Modeling Languages and Tools","volume":"69 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2019-11-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"4","resultStr":"{\"title\":\"Towards introducing just-in-time compilation in a Modelica compiler\",\"authors\":\"John Tinnerholm, Martin Sjölund, A. Pop\",\"doi\":\"10.1145/3365984.3365990\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"We are investigating ways of introducing just-in-time compilation in a standard-compliant Modelica compiler, the Open-Modelica compiler (OMC). The main motivations are enabling extensions to support dynamically varying model structure, faster compilation, and faster recompilation of models after changes. We are investigating two approaches. The first approach is to adapt the low-level OpenModelica intermediate representation (IR) before code generation to be compatible with LLVM. In that way we can avoid generating intermediate C-code and instead generate LLVM IR in memory for just-in-time compilation (JIT). The second approach is to translate OMC itself written in MetaModelica to Julia, and thereby gain access to the JIT capabilities of LLVM. Another benefit of the second approach is the access to the Julia ecosystem, including a rich set of libraries for numerical computing. We have done a preliminary investigation of both approaches, with measurements on a selected sample of algorithms, and discovered that compilation-time of generated Julia code is slower compared to generating LLVM IR directly. We conclude that providing a standard-compliant Modelica compiler which supports a dynamically varying model structure is feasible and possible, and we believe that such a compiler can be provided by using Julia or MetaModelica.\",\"PeriodicalId\":394627,\"journal\":{\"name\":\"Proceedings of the 9th International Workshop on Equation-based Object-oriented Modeling Languages and Tools\",\"volume\":\"69 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2019-11-05\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"4\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the 9th International Workshop on Equation-based Object-oriented Modeling Languages and Tools\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3365984.3365990\",\"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 9th International Workshop on Equation-based Object-oriented Modeling Languages and Tools","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3365984.3365990","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 4

摘要

我们正在研究在符合标准的Modelica编译器Open-Modelica编译器(OMC)中引入即时编译的方法。其主要动机是使扩展能够支持动态变化的模型结构、更快的编译,以及在更改后更快地重新编译模型。我们正在研究两种方法。第一种方法是在代码生成之前调整底层OpenModelica中间表示(IR),使其与LLVM兼容。通过这种方式,我们可以避免生成中间的c代码,而是在内存中生成LLVM IR以进行即时编译(JIT)。第二种方法是将用MetaModelica编写的OMC本身转换为Julia,从而获得对LLVM的JIT功能的访问。第二种方法的另一个好处是可以访问Julia生态系统,包括一组丰富的用于数值计算的库。我们对这两种方法进行了初步调查,并对选定的算法样本进行了测量,发现生成Julia代码的编译时间比直接生成LLVM IR要慢。我们的结论是,提供一个支持动态变化模型结构的符合标准的Modelica编译器是可行和可能的,并且我们相信可以通过使用Julia或MetaModelica来提供这样的编译器。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Towards introducing just-in-time compilation in a Modelica compiler
We are investigating ways of introducing just-in-time compilation in a standard-compliant Modelica compiler, the Open-Modelica compiler (OMC). The main motivations are enabling extensions to support dynamically varying model structure, faster compilation, and faster recompilation of models after changes. We are investigating two approaches. The first approach is to adapt the low-level OpenModelica intermediate representation (IR) before code generation to be compatible with LLVM. In that way we can avoid generating intermediate C-code and instead generate LLVM IR in memory for just-in-time compilation (JIT). The second approach is to translate OMC itself written in MetaModelica to Julia, and thereby gain access to the JIT capabilities of LLVM. Another benefit of the second approach is the access to the Julia ecosystem, including a rich set of libraries for numerical computing. We have done a preliminary investigation of both approaches, with measurements on a selected sample of algorithms, and discovered that compilation-time of generated Julia code is slower compared to generating LLVM IR directly. We conclude that providing a standard-compliant Modelica compiler which supports a dynamically varying model structure is feasible and possible, and we believe that such a compiler can be provided by using Julia or MetaModelica.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
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学术文献互助群
群 号:481959085
Book学术官方微信