Narrow index arithmetic with CUDA-owned specialization policy #3389
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.43) × (1 − Review Confidence (0.50)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 396 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 70%
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.358
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3389"
general
weight: 0.35
maleadt
Use GPUCompiler's shared narrowing pass and caller-supplied range facts to compute eligible index arithmetic in 32 bits. The compiler implementation is in JuliaGPU/GPUCompiler.jl#1045; this draft pins its tested commit through
[sources].CUDA owns the specialization policy. It classifies converted function and argument values into two bins: all selected index fields fit the chosen 32-bit bounds, or no additional facts. Dimensions, lengths, explicit indexing objects, and cached view offsets/strides participate; unrelated scalar
Intdata and array byte sizes do not. The selected bounds are ordinary immutable tuples passed asCompilerConfig(...; argument_ranges=...), with no range values encoded in type parameters.GPUCompiler caches and compiles those assertions. It has no specialization hook, runtime classifier, launch guard, or fallback policy. CUDA retains the exact facts with each compiled kernel, reclassifies later launches (including captured values), and caches an unbounded fallback in the original compilation world. KernelAbstractions type-only warmup supplies the bounded bin and uses the same launch guard.
@cuda specialize_indices=falsedisables automatic argument specialization; low-levelcufunctiondefaults to no additional facts.Array accessors retain their in-bounds assumptions. The duplicate CUDA pass and emitter are removed, and generic IR tests move to GPUCompiler. CUDA keeps policy, guard, fallback, and exhaustive integer-domain tests. The launch path reuses metadata from cached configurations, hashes range descriptions by their endpoints, and avoids boxing range tuples through dynamic keyword calls for type-valued arguments.
Validation on Julia 1.13.2 / RTX 5080:
@cudalaunch measurements added roughly 30–120 ns for one array and 47–69 ns with a type-valued argument, on baseline launches of about 1.8 and 2.3 μs respectively. Both variants had identical allocation counts. The isolated type-valued guard measured 20 ns median with zero allocations. These are launch microbenchmarks, not workload speedups.The original workload benchmarks have not been rerun. In-bounds assumptions can inhibit LLVM single-use optimizations, so the previously reported
reverse!/findallregressions still need investigation. Directcudacallbypasses the guarded kernel interface, and resource estimates for a bounded variant may differ from its fallback.The
[sources]pins and temporary root GPUCompiler dependency are for testing this draft; replace them with a release compatibility bound before merging. Julia 1.10 CI reads the same source pin explicitly.