Load ReactantCUDAExt when CUDA alone is loaded #3496
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 254 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3496"
general
weight: 0.35
giordano
ReactantCUDAExtwas triggered by["CUDA", "Enzyme", "GPUCompiler", "KernelAbstractions", "LLVM", "Printf"]. Enzyme, GPUCompiler and LLVM are hard dependencies of Reactant, and KernelAbstractions and Printf are dependencies of CUDA (CUDACore on v6), sousing CUDAshould be all that's needed.The bug this fixes
On Julia 1.13.2, in an interactive REPL,
using Reactant, CUDA(or adding Enzyme and KernelAbstractions) does not loadReactantCUDAExt. CUDACore loads Printf, but Printf is never registered inBase.loaded_modules, so the extension's Printf trigger never fires. Raising a KernelAbstractions kernel then fails with:even though CUDA is loaded. The same code works with
julia -e/scripts, where Printf gets registered. LoadingPrintfexplicitly before compiling works around it.Changes
ReactantCUDAExtonCUDAonly.CUDACore.KernelAbstractionsinstead of making it a trigger. This works on CUDA 6 (CUDACoreimports it) and on CUDA 5.11.3+ (CUDAimports it; the extension already aliasesCUDACore = CUDAthere). Note that this relies on CUDA's non-public import of KernelAbstractions.Printf.@printf(..., "%p", ...)calls inshowbecomeprint(..., repr(UInt(pointer(a)))), which gives identical output (checked). Printf is removed from[weakdeps]and[compat], since nothing else uses it.Testing
On macOS, Julia 1.13.2, CUDA v6.2.2 (CPU backend), in a fresh interactive REPL:
using Reactant, CUDAnow loadsReactantCUDAExt, with Printf still not registered.Enzyme.autodiffwith@compile raise = true(previously failing with the error above) now compiles and runs.I have not run the full test suite locally.
🤖 Generated with Claude Code