Skip to content

Generate IR with LLVM.jl's @llvmgenerated and generate_llvmcall - #3305

Closed
maleadt wants to merge 1 commit into
mainfrom
tb/llvmgenerated
Closed

maleadt wants to merge 1 commit into
mainfrom
tb/llvmgenerated

Conversation

@maleadt

@maleadt maleadt commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Ports CUDACore's IR-generating intrinsics to the interface added in JuliaLLVM/LLVM.jl#596: indexing, static and dynamic shared memory, malloc, atomic RMW and CAS, @cuassert, @cuprintf, pointerref_ldg, @strptr, and the constant tables used by randn. Julia code that has to run before the IR, like check_atomic_scope or the index adjustment in pointerref_ldg, moves to a wrapper that calls the @llvmgenerated function.

This requires LLVM.jl 9.14, which hasn't been released yet, so it stays a draft until then.

Tested locally on an RTX 5080 (sm_120) with Julia 1.13, using LLVM.jl's tb/llvmgenerated branch: the full test suite passes.

The indexing, shared memory, malloc, atomics, assertion, printf, ldg and
string pointer intrinsics, and the constant tables for randn, all built
their IR with create_function/call_function around a lot of context and
builder boilerplate. LLVM.jl 9.14's @llvmgenerated and generate_llvmcall
derive the LLVM signature from the Julia one and verify the generated
IR, so use those instead. Julia code that ran before the IR, like
checking the atomic scope or adjusting the index for ldg, moves to a
wrapper that calls the @llvmgenerated function.
@maleadt maleadt changed the title Generate IR with LLVM.jl's @llvmgenerated and llvmcall_expr Generate IR with LLVM.jl's @llvmgenerated and generate_llvmcall Sep 28, 2026
@maleadt maleadt mentioned this pull request Oct 3, 2026
@maleadt

maleadt commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

Superseded by #3323, which includes this commit and ports CUDA.jl to the released LLVM.jl 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant