Repository navigation
Conversation
`ccall("llvm.name", llvmcall, rt, argtypes, args...)` calls the LLVM function
`name`, as native code does. GPU code uses it for its intrinsics, e.g. CUDA's
thread indices.
- The function is declared with `llvmcall`'s LLVM types (tuples of
`VecElement`s are vectors, other structs are structs), or reused if the
module declares it with the same type.
- Arguments and results whose LLVM type differs are reinterpreted.
- An intrinsic LLVM doesn't know is declared as well, for back ends and
GPUCompiler's validation to report.
These throw `Unsupported`: non-intrinsic names (native code compiles them to an
error), unmangled overloaded intrinsics (whose names native code mangles from
the signature), and variadic calls.
Assisted-by: Claude Code (Opus 5.5)
vchuravy
force-pushed
the
vc/jc-21-globals
branch
from
October 19, 2026 17:35
f8c04fc to
a9ab90b
Compare
vchuravy
force-pushed
the
vc/jc-22-llvmcall-cc
branch
from
October 19, 2026 17:35
2453ff9 to
7ae064c
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.
Stacked on #22. GPUCompiler's suite with
codegen=:juliacodegenfound this gap: GPU code calls its intrinsics withccall("llvm.nvvm…", llvmcall, …), and JuliaCodegen rejected thellvmcallconvention.emit_llvmcall_cccalls the LLVM functionname, as native code does:llvmcall's LLVM types (tuples ofVecElements become vectors, other structs stay structs), or reused if the module already declares it with the same type.llvm.nvvm.nonexistent) is declared too, so back ends and GPUCompiler's validation report it ("unknown intrinsic").These throw
Unsupported:Tests (
test/ccall.jl): differential runs ofllvm.sqrt.f64,llvm.ctpop.i64, the vectorllvm.fma.v4f32and the voidllvm.donothing; FileCheck of the call and of the unknown intrinsic's declaration; and a non-intrinsic name.The full suite passes locally on 1.12 and nightly (5950 and 5955 tests).
🤖 Generated with Claude Code