Repository navigation
Compile with GPUCompiler's do-block compile - #3627
Conversation
|
CI failure unrelated. |
emit_ptx now inspects the IR (the undefined functions that decide whether cudadevrt is needed, and the entry point's name) in a function passed to GPUCompiler.compile, which creates the context, keeps it active around the callback and frees the IR afterwards. With GPUCompiler's upcoming llvmgpu toolchain, the IR can belong to libLLVMGPU, a newer LLVM than Julia's. Reading it from a JuliaContext then calls Julia's libLLVM on libLLVMGPU values, which crashes; the do-block form activates the IR's own context, so this works with either toolchain. Requires GPUCompiler 2.24.
db36019 to
c4efe21
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3627 +/- ##
==========================================
- Coverage 89.54% 88.94% -0.60%
==========================================
Files 201 200 -1
Lines 22967 21646 -1321
==========================================
- Hits 20565 19254 -1311
+ Misses 2402 2392 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Benchmark resultsCompared with 61e93a6b0, the merge base.
All benchmarks
History: https://juliagpu.org/perf/?pkg=cuda |
emit_ptxnow passes its IR inspection (the undefined functions that decide whether cudadevrt is needed, and the entry point's name) as a callback to the newGPUCompiler.compile(f, :asm, job)from JuliaGPU/GPUCompiler.jl#1124, instead of creating aJuliaContextand disposing the module itself. GPUCompiler compat is raised to 2.24 in CUDACore and CUDATools.This prepares for the llvmgpu toolchain (JuliaGPU/GPUCompiler.jl#1122), where the IR returned by
compilebelongs to libLLVMGPU, a newer LLVM than Julia's. Reading it from aJuliaContext, asemit_ptxdid, calls Julia's libLLVM on libLLVMGPU values and segfaults (inLLVMGetValueName, already while precompiling CUDACore). The do-block form activates the IR's own context around the callback, so the same code works with either toolchain. CUDA's GPUCompiler hooks needed no change:finish_module!(the only one usingconvert(LLVMType, ...)) runs before the IR moves to libLLVMGPU.Validated on an RTX 5080 with Julia 1.12.7 and GPUCompiler 2.24 (the #1122 branch with the do-block form), running the
coreandtoolstest groups: 20069 passed, 22 broken under the default toolchain; 20051 passed, 22 broken under llvmgpu (with KernelAbstractions' precompile workload disabled, as its POCL back-end doesn't support llvmgpu yet).