Skip to content

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

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 OpenCL.jl's and SPIRVIntrinsics' IR-generating functions to the interface added in JuliaLLVM/LLVM.jl#596: local memory, unsafe_invariant_load, the constant tables used by randn, @printf, and the additional kernel arguments for the RNG state. emit_printf needs the Julia types of its varargs, so it stays a @generated function that uses generate_llvmcall.

This requires LLVM.jl 9.14, which hasn't been released yet, so it stays a draft until then. It also bumps SPIRVIntrinsics' LLVM compat, so that package needs a new release as well.

Tested locally on PoCL with LLVM.jl's tb/llvmgenerated branch: the test suite passes, with both the SPIR-V and OpenCL C back-ends.

Local memory, invariant loads, the constant tables for randn, printf and
the additional kernel arguments 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. printf needs the Julia types of its varargs, so it stays
a @generated function that uses generate_llvmcall.
@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 #525, which includes this commit and ports OpenCL.jl to the released LLVM.jl 10.

@maleadt maleadt closed this Oct 3, 2026
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