-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use llvm-dialects as specification layer for Julia LLVM IR #52945
base: master
Are you sure you want to change the base?
Conversation
So tblgen generates a couple |
The generated headers we could ship, the generated cpp get compiled with the rest of the code. We don't check them into the source tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs seem very sparse (https://github.com/GPUOpen-Drivers/llvm-dialects/blob/dev/docs/Constraints.md), but if it can equivalently encode our JuliaFunction descriptors, it seems useful enough to go with it
d8b41bb
to
d1f0801
Compare
The LLVM IR we emit in codegen uses pseudo-intrinsics to represent the additional language-specific
semantics needed for the correct optimization of Julia code. Since Julia uses a precise GC we need to
track values in the generated code. We could do so early, but that would clutter the code quite a bit
and thus we decided to take a late-lowering approach. We represent enough semantics with our own LLVM
dialect so that at the end of the optimization pipeline we can legalize/lower our Julia LLVM dialect
to the general LLVM dialect that the backends can emit code for.
We thus far have an informal specification of this Julia LLVM dialect scattered across both codegen
and optimizations, and other producers like Enzyme code-generator. The https://github.com/GPUOpen-Drivers/llvm-dialects
project provides tools for using an approach similar to MLIR to specify a custom dialect on the LLVM substracte.
This PR is mostly meant to open up the discussion if we want this, but my goal for it is to make it
easier for producers like Enzyme (and other GPUCompiler) to emit our dialect correctly, as well
as unifying the definition across codegen and optimization passes, and having one place to document and specify
the behaviour of our dialect operations.
(Side-comment we have technically at least two dialects one produced by codegen and lowered by late-lowering and then a second between late-lowering and final-lowering)