IRTools and Core.Compiler

I noticed IRTools.jl doesn’t work any longer on the latest Julia (1.8.x or the master branch). And from long ago, there exists a module named Core.Compiler, but I failed to find any document about this module.

I have a few questions about these two PKGs/Modules:

  • Will IRTools.jl be deprecated? I saw it had been untouched(source and issues on github) for a long time.
  • Can Core.Compiler be used in the places where IRTool.jl was used? and is there any document to show how to use it?

Thanks.

2 Likes

It’s the basis for Zygote, which is still widely used, so we still hope to support it in the near future. There aren’t many people maintaining it right now unfortunately, so issues might not always get fixed right away. Also note that 1.8 is still far from an official release (1.7 isn’t even officially out yet), so it’s expected that packages relying heavily on internals might not work yet. I will try to look into the issue though when I have some time.

There might be some confusion here. Core.Compiler is Julia’s own compiler, which does type inference for example and other Julia-specific optimization passes. It is true that it works with a data structure called IRCode, which inspired the way IRTools works, but IRTools tries to be more user-friendly by making it harder to write invalid IR that will lead to segfaults.

There is a way for packages to hook into the compiler using the AbstractInterpreter interface which is already used by packages such as GPUCompiler, Cthulhu and JET, but this is still quite manual and low-level and doesn’t compose. The eventual goal is to replace Cassette and IRTools with something using AbstractInterpreter, which you can already try as Mixtape. It should be mentioned that this is still very much work in progress though.

4 Likes