Julia Dialect tablegen - #62937
Open
vchuravy wants to merge 4 commits into
Open
Conversation
vchuravy
force-pushed
the
vc/llvm-dialects-tablegen
branch
from
August 31, 2026 15:08
e54fb3b to
bfe3956
Compare
vchuravy
commented
Aug 31, 2026
| let cppNamespace = "julia"; | ||
| } | ||
|
|
||
| def JuliaValue : DialectType<JuliaDialect, "jlvalue"> { |
Member
Author
There was a problem hiding this comment.
@gbaraldi this is already using the dialect type construct that we discussed today.
vchuravy
commented
Aug 31, 2026
vchuravy
commented
Aug 31, 2026
Comment on lines
+361
to
+372
| def Safepoint : JuliaOp<"safepoint", | ||
| [Memory<[(readwrite ArgMem), (readwrite InaccessibleMem)]>, | ||
| NoUnwind]> { | ||
| let results = (outs); | ||
| let arguments = (ins Ptr:$signal_page); | ||
|
|
||
| let summary = "GC safepoint: potential stop-the-world synchronization point"; | ||
| let description = [{ | ||
| Loads from the GC signal page so that stopping the world can be triggered | ||
| by protecting it. | ||
| }]; | ||
| } |
Member
Author
There was a problem hiding this comment.
That's not technically a post GC lowering op, we can have it introduced much earlier
vchuravy
force-pushed
the
vc/llvm-dialects-tablegen
branch
2 times, most recently
from
August 31, 2026 18:17
05f20c9 to
e3471e0
Compare
vchuravy
force-pushed
the
vc/llvm-dialects-tablegen
branch
from
August 31, 2026 18:48
e3471e0 to
0f974f9
Compare
Specify the Julia-specific pseudo-intrinsics in src/JuliaDialect.td as tblgen-generated op classes. The spec covers both dialect layers: the codegen-level ops (julia.get_pgcstack, julia.get_pgcstack_or_new, julia.gc_loaded) legal until LateLowerGCFrame, and the GC lowering ops (julia.new_gc_frame etc.) produced by LateLowerGCFrame and consumed by FinalLowerGC. The generated declarations carry the same function names, types, and attributes as the handwritten JuliaFunction definitions, so the emitted IR is unchanged. Assisted-by: Claude Code (Fable 5) Claude-Session: https://claude.ai/code/session_013iurq91jyFwfKN8EbrcjL2
Add julia.typeof, julia.blackbox, julia.write_barrier, julia.cancellation_point, julia.gcroot_flush, julia.pointer_from_objref, the julia.call trampoline family, and julia.gc_alloc_obj to JuliaDialect.td. Ops with variadic arguments (write_barrier, the call family) declare a fully-varargs function type. Not represented: llvm.julia.gc_preserve_begin/end (reserved llvm. prefix and token result type, which llvm-dialects cannot express) and jl_alloc_genericmemory_unchecked (a plain runtime call). Assisted-by: Claude Code (Fable 5) Claude-Session: https://claude.ai/code/session_013iurq91jyFwfKN8EbrcjL2
Use the AllocKind and AllocSize traits (GPUOpen-Drivers/llvm-dialects#145) to carry the allockind("alloc") and allocsize(1) attributes of julia.gc_alloc_obj and julia.gc_alloc_bytes in their dialect specification instead of patching them in by hand. Since their size argument type is target dependent (the datalayout's pointer-sized integer), the ops are argument-overloaded and opt into typedArgOverloadDeclaration so that their declarations keep fixed parameters, which allocsize requires. Assisted-by: Claude Code (Fable 5) Claude-Session: https://claude.ai/code/session_01C5vc8DuxsFWuP2UZGN4CCe
Add GCPreserveBegin/GCPreserveEnd op definitions using llvm-dialects' new useLlvmIntrinsicPrefix and TokenTy support: the ops keep their existing `llvm.julia.gc_preserve_*` names (LLVM's IR verifier only allows a token-returning function when it is an unknown intrinsic) and their exact signatures, so the emitted IR is unchanged while the pair gains generated op classes, builders and verifier coverage. Assisted-by: Claude Code (Fable 5) Claude-Session: https://claude.ai/code/session_01C5vc8DuxsFWuP2UZGN4CCe
vchuravy
force-pushed
the
vc/llvm-dialects-tablegen
branch
from
August 31, 2026 19:08
0f974f9 to
e617902
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the meat of the PR, specifying our pseudo-intrinsics as a tablegen file and formalizing attributes and so-forth.
Based on an old hand-written version of #52945 and then updated with Claude.
Assisted-by: Claude
TODO:
julia.xwhich is what llvm-dialects wants.Stack created with GitHub Stacks CLI • Give Feedback 💬