[llvm-dev] ORC - which example code?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] ORC - which example code?

Amara Emerson via llvm-dev
Trying to put together a simple test JIT compiler, using ORC which as I understand it will be the supported API going forward, I noticed that in the first chapter of the updated Kaleidoscope tutorial, there is sample code that starts like this:

ExecutionSession ES;
RTDyldObjectLinkingLayer ObjectLayer;
IRCompileLayer CompileLayer;

DataLayout DL;
MangleAndInterner Mangle;
ThreadSafeContext Ctx;

But in https://llvm.org/devmtg/2016-11/Slides/Hames-ORC.pdf there is sample code that looks like this:

ObjectLinkingLayer LinkLayer;
SimpleCompiler Compiler(TargetMachine());
IRCompileLayer<…> CompileLayer(LinkLayer, Compiler);

Related but significantly different.

Which version is now considered correct/preferred?

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] ORC - which example code?

Amara Emerson via llvm-dev
Hi Russell
As far as I know, the second is preferred. You can also look at the LLJIT && LLLazyJIT stack in the trunk which is off the shelf utility.
Thanks

On Fri, 10 May 2019 at 08:20, Russell Wallace via llvm-dev <[hidden email]> wrote:
Trying to put together a simple test JIT compiler, using ORC which as I understand it will be the supported API going forward, I noticed that in the first chapter of the updated Kaleidoscope tutorial, there is sample code that starts like this:

ExecutionSession ES;
RTDyldObjectLinkingLayer ObjectLayer;
IRCompileLayer CompileLayer;

DataLayout DL;
MangleAndInterner Mangle;
ThreadSafeContext Ctx;

But in https://llvm.org/devmtg/2016-11/Slides/Hames-ORC.pdf there is sample code that looks like this:

ObjectLinkingLayer LinkLayer;
SimpleCompiler Compiler(TargetMachine());
IRCompileLayer<…> CompileLayer(LinkLayer, Compiler);

Related but significantly different.

Which version is now considered correct/preferred?
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] ORC - which example code?

Amara Emerson via llvm-dev
It turns out that ObjectLinkingLayer doesn't exist; that identifier occurs in the source tree only in comments, never as an identifier.

Does that mean the second version of the API has been deleted and the first is now correct?

On Fri, May 10, 2019 at 6:18 AM Praveen Velliengiri <[hidden email]> wrote:
Hi Russell
As far as I know, the second is preferred. You can also look at the LLJIT && LLLazyJIT stack in the trunk which is off the shelf utility.
Thanks

On Fri, 10 May 2019 at 08:20, Russell Wallace via llvm-dev <[hidden email]> wrote:
Trying to put together a simple test JIT compiler, using ORC which as I understand it will be the supported API going forward, I noticed that in the first chapter of the updated Kaleidoscope tutorial, there is sample code that starts like this:

ExecutionSession ES;
RTDyldObjectLinkingLayer ObjectLayer;
IRCompileLayer CompileLayer;

DataLayout DL;
MangleAndInterner Mangle;
ThreadSafeContext Ctx;

But in https://llvm.org/devmtg/2016-11/Slides/Hames-ORC.pdf there is sample code that looks like this:

ObjectLinkingLayer LinkLayer;
SimpleCompiler Compiler(TargetMachine());
IRCompileLayer<…> CompileLayer(LinkLayer, Compiler);

Related but significantly different.

Which version is now considered correct/preferred?
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] ORC - which example code?

Amara Emerson via llvm-dev
Hey Russel

RTDyldObjectLinkingLayer is the regular one, which makes use of RuntimeDyld under the hood. This should be the default and work with both, OrcV1 and OrcV2.

ObjectLinkingLayer is the layer that Lang plans to use for JITLink. This was added very recently [1] with the ultimate goal to get rid of RuntimeDyld, which allows relaxed constraints on the used CodeModel, better supports concurrency and overcomes hacks like [2]. It's definitely not something you want to use in production at this point. It lacks a number of features compared to RuntimeDlyld, i.e. backends for all object formats except Mach-O and compatibility with JITEventListeners.

If you look for RTDyldObjectLinkingLayer examples in-tree, see how LLJIT does it [3] and how lli uses LLLazyJIT [4].
Out-of-tree you can have a look at my example project if you like: it shows how to build on LLJIT [5] and how to break free from it [6]. This is much more focused than the in-tree code.

Hope it helps.
Best, Stefan

--

[1] https://reviews.llvm.org/D58704
[2] https://github.com/llvm/llvm-project/blob/198611b0/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp#L1388
[3] https://github.com/llvm/llvm-project/blob/777cad2c/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp#L86
[4] https://github.com/llvm/llvm-project/blob/777cad2c/llvm/tools/lli/lli.cpp#L754
[5] https://github.com/weliveindetail/JitFromScratch/commit/a61a3a9
[6] https://github.com/weliveindetail/JitFromScratch/commit/b5bcb5e

On 5/13/19 12:15 PM, Russell Wallace via llvm-dev wrote:
It turns out that ObjectLinkingLayer doesn't exist; that identifier occurs in the source tree only in comments, never as an identifier.

Does that mean the second version of the API has been deleted and the first is now correct?

On Fri, May 10, 2019 at 6:18 AM Praveen Velliengiri <[hidden email]> wrote:
Hi Russell
As far as I know, the second is preferred. You can also look at the LLJIT && LLLazyJIT stack in the trunk which is off the shelf utility.
Thanks

On Fri, 10 May 2019 at 08:20, Russell Wallace via llvm-dev <[hidden email]> wrote:
Trying to put together a simple test JIT compiler, using ORC which as I understand it will be the supported API going forward, I noticed that in the first chapter of the updated Kaleidoscope tutorial, there is sample code that starts like this:

ExecutionSession ES;
RTDyldObjectLinkingLayer ObjectLayer;
IRCompileLayer CompileLayer;

DataLayout DL;
MangleAndInterner Mangle;
ThreadSafeContext Ctx;

But in https://llvm.org/devmtg/2016-11/Slides/Hames-ORC.pdf there is sample code that looks like this:

ObjectLinkingLayer LinkLayer;
SimpleCompiler Compiler(TargetMachine());
IRCompileLayer<…> CompileLayer(LinkLayer, Compiler);

Related but significantly different.

Which version is now considered correct/preferred?
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

signature.asc (499 bytes) Download Attachment