← Back to Pull requests

Load ReactantCUDAExt when CUDA alone is loaded #3496

Closed
unknown closed this pull request without merging on Oct 21, 2026 00:47 UTC
View on GitHub
unknown unknown commented on Oct 18, 2026 03:38 UTC
Author

ReactantCUDAExt was 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), so using CUDA should 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 load ReactantCUDAExt. CUDACore loads Printf, but Printf is never registered in Base.loaded_modules, so the extension's Printf trigger never fires. Raising a KernelAbstractions kernel then fails with:

MethodError: no method matching ka_with_reactant(...)
Attempted to raise a KernelAbstractions kernel with Reactant but CUDA.jl is not loaded.

even though CUDA is loaded. The same code works with julia -e/scripts, where Printf gets registered. Loading Printf explicitly before compiling works around it.

Changes

  • Trigger ReactantCUDAExt on CUDA only.

  • Take KernelAbstractions from CUDA via CUDACore.KernelAbstractions instead of making it a trigger. This works on CUDA 6 (CUDACore imports it) and on CUDA 5.11.3+ (CUDA imports it; the extension already aliases CUDACore = CUDA there). Note that this relies on CUDA's non-public import of KernelAbstractions.

  • Remove Printf: the two Printf.@printf(..., "%p", ...) calls in show become print(..., 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, CUDA now loads ReactantCUDAExt, with Printf still not registered.

  • A script that raises a KernelAbstractions kernel inside Enzyme.autodiff with @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

    Diff: 254 lines (+190 / -64) across 3 files Reviewer: giordano Review duration: 4148m
    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
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.1% (MEDIUM) · Higher = larger blast radius
    39.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%