Orc JIT v1 Deprecation

Hi folks,

Rather by accident than on purpose I looked at the release notes and found the following:
http://releases.llvm.org/8.0.0/docs/ReleaseNotes.html#changes-to-the-jit-apis

TL;DR: Orc v1 is deprecated and will be removed in the next release.

I have several questions in this regard:

1. Is there a migration guide I can use to update my code to the new version?
2. Is there any development plan for this part of LLVM? So far I have feeling that it's a closed source development.
3. Is there some communication channels I am missing to follow? I follow dev&commits mailing lists and present on IRC once in a while, but I somehow missed the message about the Orc v1 removal.

Also, the release notes mention that Orc v2 is the recommended way for the new projects, but:

1. Is there a documentation?
2. How stable the APIs are?

Thank you,
Alex.

Hi Alex
Sorry for late reply

The New ORC APIs support concurrent compilation.

I’m not aware of any migration guide to ORC v2 from v1. But there is a in-tree classes called LLJIT and LLLazyJIT which is an example for using new ORC APIs.

You can also take a look at “Updating ORC for Concurrency” talk by lang hames, the talk explains about the new APIs. I hope discussions about JIT is generally available in LLVM-dev mailing lists.

For documentation kaleidoscope, I don’t think the updated version is available yet. And I personally hope APIs are stable enough, and also there is an effort to add speculation to JIT which modify the internals to support that but APIs will mostly be the same, but not sure there may be a some changes in future.

Also CC’ing Lang Hames for more insights

Thanks
Praveen

Hi Alex

Correction : Kaleidoscope chapter 1 & 2 are up-to-date. But chapter 3…5 are not.

I thought I would add a data point.

I implemented the Orc v1 API in Clasp - an implementation of Common Lisp that uses llvm as the backend.
Recently, I switched over to using the new API - works great! I’m very excited about the work Lang has been doing and I’m excited to hear that there is a fix for lldb debugging of jitted code coming (thanks Stefan!).

Orc v1 API Clasp: (https://github.com/clasp-developers/clasp/tree/dev)
New Orc API Clasp: (https://github.com/clasp-developers/clasp/tree/dev-llvmtot)

It’s a bit weird because Clasp is self-hosting and I expose the llvm API’s to Common Lisp and I use the llvm API’s in a combination of C++ code and Common Lisp code.

Yes, I completely agree! And I am sure everyone does. Without his work Orc wouldn’t exist and we wouldn’t be anywhere close to it.

Hi Alex,

  1. Is there a migration guide I can use to update my code to the new version?

There is no guide yet. It sounds like there is plenty of interest in creating one. I’m also going to try to post a draft of the ORCv2 design document we discussed later tonight.

For what it is worth, I expect migration to be fairly straightforward for most clients. Each of the legacy layers that is being deprecated has an ORCv2 counterpart that can be substituted in a fairly mechanical way (with the exception of the LazyEmittingLayer that provided MCJIT-style laziness, “don’t compile until first lookup”, which is the default behavior in ORCv2).

MCJIT clients, or clients with simple use cases may find LLJIT useful. This is an off the shelf ORC JIT class with functionality similar to MCJIT. Some utilities (e.g. EventListeners) have not been hooked up yet, but I think it would be reasonable to get these hooked up before 9.0 branches.

  1. Is there any development plan for this part of LLVM? So far I have feeling that it’s a closed source development.

It is definitely not closed source. There is no part of ORCv2 that has not been committed to the public tree, except for the small amount of code currently on my development branch.

I think it’s fair to say that the design has not been well documented or communicated (except in code and commit messages). Given the demand though (and exciting prospect of more contributors) it sounds like it’s time to put some documentation together. The ORCv2 design doc can serve as a starting point, and the tutorials that Praveen plans to update will be a huge help. Patches and support are most welcome. :slight_smile:

  1. Is there some communication channels I am missing to follow? I follow dev&commits mailing lists and present on IRC once in a while, but I somehow missed the message about the Orc v1 removal.

No — you are not missing anything. I think the plan to deprecate has been mentioned on list before but only in passing (and thinking about it, it may even have been on llvm-commits rather than llvm-dev). I plan to add deprecation attributes to the legacy classes on trunk so that clients who use 9.0 receive warnings. If we find that clients have trouble migrating (which I don’t think we will) then we can probably support the legacy layers for another release, but I would like to avoid this if possible.

Cheers,
Lang.

FYI the Orc v2 JIT is here:

Hello everyone,

Praveen,

You can also take a look at "Updating ORC for Concurrency" talk by lang hames, the talk explains about the new APIs.

It's a good reference, but it is not sufficient as communication channel, imho.

For documentation kaleidoscope, I don't think the updated version is available yet.

It is very often outdated, so I developed (not on purpose) a mental model of not relying on it.

Lang,

There is no guide yet. It sounds like there is plenty of interest in creating one. I’m also going to try to post a draft of the ORCv2 design document we discussed later tonight.

I'll try to migrate my code to the v2 API and describe the process, but please don't take my words as a promise :smiley:

It is definitely not closed source.

After re-reading my statement I realized that it was too harsh, sorry about that. I rather meant that I was only able to get information post factum, which reminded some of our hardware vendors :slight_smile:

I plan to add deprecation attributes to the legacy classes on trunk so that clients who use 9.0 receive warnings.

That's a very good idea. I think I understand your motivation to force everyone to use the new APIs, but I also think it makes sense to make the migration process a bit more smooth.

Stefan,

Thanks for the summary and for bringing more people into the discussion.

Thanks a lot for your contributions, folks!

Cheers,
Alex.

Hi Alex,

I’ll try to migrate my code to the v2 API and describe the process, but please don’t take my words as a promise :smiley:

No worries. Any help will be greatly appreciated!

After re-reading my statement I realized that it was too harsh, sorry about that. I rather meant that I was only able to get information post factum, which reminded some of our hardware vendors :slight_smile:

No worries. Getting concurrency into ORC (which is the main aim of ORCv2, vs ORCv1) has involved a lot of trial and error, and corresponding churn in the APIs, and that has made documentation challenging. This isn’t intended to be a permanent state of affairs though, and the more the APIs settle down, the easier and more rewarding documentation will be (both to write and to use).

I plan to add deprecation attributes to the legacy classes on trunk so that clients who use 9.0 receive warnings.
That’s a very good idea. I think I understand your motivation to force everyone to use the new APIs, but I also think it makes sense to make the migration process a bit more smooth.

I have filed http://llvm.org/PR41986 if anyone wants to jump on it. :slight_smile:

– Lang.

Hi Praveen

Correction : Kaleidoscope chapter 1 & 2 are up-to-date. But chapter
3..5 are not.

Where do you got the info from? Do you know what exactly is missing/broken?

Maybe we summarize in a ticket and try to get it done before the next
release.
Currently we only have: https://bugs.llvm.org/show_bug.cgi?id=41595

Cheers
Stefan

> Correction : Kaleidoscope chapter 1 & 2 are up-to-date. But chapter
> 3..5 are not.

Where do you got the info from? Do you know what exactly is
missing/broken?

It is mentioned on the tutorial page as a warning at the top:
http://llvm.org/docs/tutorial/BuildingAJIT1.html

Oh I see, thanks. Haven't been looking there as I considered it two
different tutorials. Ok, one builds on the other, so the distinction may
be artificial..

Kaleidoscope: http://llvm.org/docs/tutorial/LangImpl01.html -- all
up-to-date?
BuildingAJIT: http://llvm.org/docs/tutorial/BuildingAJIT1.html -- update
chapters 3-5 is todo?