← Back to Pull requests

Support GPUCompiler 2 #3616

Closed
unknown closed this pull request without merging on Nov 04, 2026 23:01 UTC
View on GitHub
unknown unknown commented on Oct 28, 2026 18:41 UTC
Author

Supports GPUCompiler 2 next to GPUCompiler 1, so Reactant works with CUDA.jl 6.4.1. The LLVM.jl 10 part is in #3384, which waits for Enzyme (EnzymeAD/Enzyme.jl#3741).

Compat

| Package | Before | After |
|---|---|---|
| GPUCompiler | 1.17 | 1.17, 2.9 - 2.10 |
| CUDA | 5.11.3, 6.2 | 5.11.3, ~6.2, 6.4.1 |
| CompilerCaching (weak dep) | – | 0.5.3 |

GPUCompiler 2.11+ needs LLVM.jl 10. CompilerCaching is only a weak dependency: GPUCompiler 1 doesn't pull it in, so its compat only applies with GPUCompiler 2. CUDA.jl 6.3 and 6.4.0 lack the compile_and_launch method overlaid here.

Commits

  • Infer the target of Core.invoke with Reactant's interpreter. @invoke targets were inferred natively, without the overlays, and the optimizer could inline that native code into Reactant's (the LU failures in core/ops). GPUCompiler 1 hid this by always re-inferring.

  • Support GPUCompiler 2:
  • Reactant.GPUCOMPILER_2 selects the code for each version. Where only one version defines a function, the code checks for that function instead.

  • Relocations. GPUCompiler 2 returns relocation records instead of a gv_to_value map. Native compilation keeps them symbolic and reads the addresses from the records. The CUDA extension bakes them into the IR, since it links the IR into MLIR.

  • Cache owner. GPUCompiler 2 looks up code instances by the job's cache owner, so the native job reports Reactant's.

  • Dynamic calls. Reactant leaves calls it doesn't rewrite, such as those into overlay bodies, to dynamic dispatch so they run natively. Reactant opts out of CompilerCaching resolving them (resolve_dynamic_invokes, new in CompilerCaching 0.5.2, which also fixes native code instances being filled in with Reactant's code).

  • Native callees. Native code that Reactant's code calls directly is called through the runtime, as with GPUCompiler 1, instead of being compiled again with its whole call tree into every module (collect_foreign_callees, new in CompilerCaching 0.5.3). Without it, tracing sin produced 1.7 MB of IR including Base's printing code, which also broke linking ReactantCUDAExt on Windows (undefined symbol: jl_boxed_uint8_cache).

  • World age. GPUCompiler 2 formats the signature while generating code, so Reactant's generator now runs code generation in the caller's world, where show methods of later-loaded packages exist (test/integration/staticarrays.jl).

  • @cuda. CUDA.jl 6.4.1 compiles and launches behind compile_and_launch, which is now overlaid.
  • Apart from the Core.invoke fix, GPUCompiler 1 takes the same code paths as on main.

    Testing

    RTX 5080, Julia 1.12, on main from 2026-11-04:

  • GPUCompiler 2.10, CUDA.jl 6.4.1: core, nn and integration pass (7556 tests), except core/control_flow.jl:500 (-1.8e-15 ≈ 0.0 on the GPU), which fails the same way without this PR's changes.

  • GPUCompiler 1.23, CUDA.jl 6.2.2: core/array_ops, core/ops, core/map_reduction, nn and integration pass.
  • ---

    This PR is AI-assisted.

    Diff: 380 lines (+285 / -95) across 4 files Reviewer: maleadt Review duration: 10340m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.43) × (1 − Review Confidence (0.64)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 380 lines diff across 4 files
    0.43
    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: 70%
    64%
    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.356
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3616"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 64% 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: 42.9% (MEDIUM) · Higher = larger blast radius
    42.9%
    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: 64% · Lower = rushed or shallow review
    64%
    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: 15.5% · Safe to merge
    15.5%