Christian Schafmeister via llvm-dev
2017-Feb-20 17:44 UTC
[llvm-dev] Inlining with the ORC JIT
Is it possible to inline functions compiled from C++ code into generated code that is fed, Module by Module, into the ORC JIT? I'd like to add a Module compiled from C++ code into the JIT and then as I add later modules, functions from the first module are inlined in the later ones. I already do this for file compilation/linking in my Common Lisp compiler “Clasp” (github.com/drmeister/clasp <https://urldefense.proofpoint.com/v2/url?u=http-3A__github.com_drmeister_clasp&d=DwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=sSykZW5nIEBIoQEQoyEQF3iTvIwIffdEAf9FkbyVYz0&s=ao0EQZ_k7esDdMap8YjoO52BiKyMRHBv7PG4XJdrBOc&e=>). I have followed the new ORC Kaleidoscope demo and set up the ORC layers to do optimization and compilation but the examples are all for function optimization and do not describe inlining. Christian Schafmeister Professor, Chemistry Department Temple University meister at temple.edu <mailto:meister at temple.edu> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170220/2d252107/attachment.html>
As far as i know, optimizations can only be done on a module level. If you compile and pass modules to the object-linking-layer, you won't be able to perform any optimizations. Thus, what you could do is: - merge the generated modules into a big monolithic module - repeatedly perform optimization passes eg. inlining - copy new functions into a new module ( so you don't re-compile and re-link the same functions) - compile and link new module 2017-02-20 17:44 GMT+00:00 Christian Schafmeister via llvm-dev < llvm-dev at lists.llvm.org>:> Is it possible to inline functions compiled from C++ code into generated > code that is fed, Module by Module, into the ORC JIT? > > I'd like to add a Module compiled from C++ code into the JIT and then as I > add later modules, functions from the first module are inlined in the later > ones. > > I already do this for file compilation/linking in my Common Lisp compiler > “Clasp” (github.com/drmeister/clasp > <https://urldefense.proofpoint.com/v2/url?u=http-3A__github.com_drmeister_clasp&d=DwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=sSykZW5nIEBIoQEQoyEQF3iTvIwIffdEAf9FkbyVYz0&s=ao0EQZ_k7esDdMap8YjoO52BiKyMRHBv7PG4XJdrBOc&e=> > ). > > I have followed the new ORC Kaleidoscope demo and set up the ORC layers to > do optimization and compilation but the examples are all for function > optimization and do not describe inlining. > > Christian Schafmeister > Professor, Chemistry Department > Temple University > meister at temple.edu > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170220/1a5ffecf/attachment.html>
> On Feb 20, 2017, at 11:14 AM, Gaetano Checinski via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > As far as i know, optimizations can only be done on a module level. > If you compile and pass modules to the object-linking-layer, you won't be able to perform any optimizations. > Thus, what you could do is: > - merge the generated modules into a big monolithic module > - repeatedly perform optimization passes eg. inlining > - copy new functions into a new module ( so you don't re-compile and re-link the same functions) > - compile and link new moduleThis seems fragile to me: it could break with optimizations unless you mark everything such that the optimizer does not do any inter-procedural optimizations (other than inlining). — Mehdi> > > > > 2017-02-20 17:44 GMT+00:00 Christian Schafmeister via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>>: > Is it possible to inline functions compiled from C++ code into generated code that is fed, Module by Module, into the ORC JIT? > > I'd like to add a Module compiled from C++ code into the JIT and then as I add later modules, functions from the first module are inlined in the later ones. > > I already do this for file compilation/linking in my Common Lisp compiler “Clasp” (github.com/drmeister/clasp <https://urldefense.proofpoint.com/v2/url?u=http-3A__github.com_drmeister_clasp&d=DwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=sSykZW5nIEBIoQEQoyEQF3iTvIwIffdEAf9FkbyVYz0&s=ao0EQZ_k7esDdMap8YjoO52BiKyMRHBv7PG4XJdrBOc&e=>). > > I have followed the new ORC Kaleidoscope demo and set up the ORC layers to do optimization and compilation but the examples are all for function optimization and do not describe inlining. > > Christian Schafmeister > Professor, Chemistry Department > Temple University > meister at temple.edu <mailto:meister at temple.edu> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170220/ce46acfd/attachment.html>
Seemingly Similar Threads
- ORC JIT and multithreading
- [LLVMdev] What is on the LLVM horizon for truly relocatable JITted code?
- ORC JIT api, object files and stackmaps
- [LLVMdev] How to run LLVM3.6.1 on OS X (Yosemite, Xcode6.4) OR how to link bitcode generated by OS X clang with LLVM3.6.1
- ORC JIT api, object files and stackmaps