[llvm-dev] Reuse llvm::ExecutionEngine
Chris Bieneman via llvm-dev
llvm-dev at lists.llvm.org
Fri May 10 11:54:42 PDT 2019
I'm by no means an expert on the JIT layers, but ExecutionEngine is an abstract interface. In theory, each implementation of that interface should function similarly, but in practice YMMV. You're using MCJIT, which is the older JIT flow which is not getting a lot of attention these days. You might get further if you switch to using the OrcMCJITReplacement, or migrate to the Orc APIs more generally.
There are some very handy new interfaces in the Orc APIs, like the LLJIT classes which get things going pretty easy. I've been using LLJIT in my project, and it is really easy to setup, keep around and add multiple IR modules to.
-Chris
> On May 7, 2019, at 11:00 PM, Gaier, Bjoern via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Heyho,
>
> I can only provide you with a screenshot for the first problem I noticed:
> <image001.png>
>
> This code will crash when calling “eeBuilder.create”.
>
> But I also looked at what happens if I do reuse the llvm::ExecutionEngine. After the call to “finalizeObject” I use “removeModule” for the Module I used.
> If I know parse the same module again and pass it to that llvm::ExecutionEngine, it will notice the duplication and rename the symbols, like when it does when you add the same module two times.
> If I add a different module everything behaves as before – so overall it seems like you can’t reuse a llvm::ExecutionEngine…
>
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org <mailto:llvm-dev-bounces at lists.llvm.org>> On Behalf Of preejackie via llvm-dev
> Sent: Dienstag, 7. Mai 2019 15:28
> To: llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> Subject: Re: [llvm-dev] Reuse llvm::ExecutionEngine
>
> Hi Bjoern,
>
> Could you please give me a minimal code sample to produce this behavior?
>
> On 07/05/19 5:17 PM, Gaier, Bjoern via llvm-dev wrote:
> Dear LLVM-Mailing-List,
>
> I’m using the llvm::EngineBuilder to create an instance of the llvm::ExecutionEngine, I then JIT my code, take the addresses I need and delete the llvm::ExecutionEngine. But now I started to wonder, if I could reuse that instance for a new module again?
>
> I first tried calling llvm::EngineBuilder without setting a Module, I planned to add it later – but when I do this the “create” function will crash.
> What crash you get? By quickly looking through interface, EngineBuilder uses nullptr if no module are provided.
>
>
> Another test I ran was calling “removeModule” of the llvm::ExecutionEngine after the call to finalizeObject. Then I added the same module again and ran finalizeObject again. The result was weird, I suddenly became error messages about the relocation – I take this came because I applied a memory mapping in the first run.
>
> So to make it short: Is the llvm::ExecutionEngine designed for a reuse or is it better to create a new instance again?
>
> Kind greetings
> Björn
> Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
> --
> Have a great day!
> PreeJackie
> Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika_______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://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/20190510/40f81d11/attachment.html>
More information about the llvm-dev
mailing list