Report llvmcall of unknown intrinsics at compile time - #958
Merged
Merged
Conversation
Julia's codegen replaces an `llvmcall` of an intrinsic it doesn't know with a run-time `jl_error`, which we then lower to an anonymous device exception. That made the removal of NVVM intrinsics in LLVM 21 (as used by Julia 1.14) show up as every kernel calling `sync_threads` throwing "a error" at run time. Detect the message and raise an InvalidIRError pointing at the offending call instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #958 +/- ##
==========================================
- Coverage 86.54% 85.48% -1.06%
==========================================
Files 29 29
Lines 5729 5830 +101
==========================================
+ Hits 4958 4984 +26
- Misses 771 846 +75 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Julia's codegen replaces an
llvmcallof an intrinsic it doesn't know (ccall("llvm.foo", llvmcall, ...)) with a run-timejl_error("llvmcall only supports intrinsic calls"). GPUCompiler then lowers that to an anonymous device-side exception. That's how LLVM 21 removingllvm.nvvm.barrier0and friends (which Julia 1.14 hits, being on LLVM 22) showed up in CUDA.jl: every kernel usingsync_threadsthrewERROR: a error was thrown during kernel execution.This detects that specific
jl_errorboth inlower_throw!(GPU targets) and incheck_ir(targets that keep runtime calls), and raises anInvalidIRErrorpointing at the offending call:Tested on native and PTX, on Julia 1.10 and nightly.