Select CUDA kernel specializations before packing launch arguments #461
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 250 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.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #461"
general
weight: 0.35
brandon-b-miller
A
float64launch after afloat32launch could silently run thefloat32kernel. In #459, both calls passed1.5, but the second stored0.0. The same bug affected extensions: two Numba types could select different device code even thoughprepare_argspacked both values as the integer0.This PR makes the Python dispatcher select the kernel while it still has the Numba argument types. The selected signature determines how to convert and pack the values, and the native launcher receives the executable explicitly.
Walkthrough
The first two commits fix #459. The last two reduce the work repeated on subsequent launches.
1. Select the overload. When compilation is enabled, reuse an exact signature or compile one. A frozen dispatcher can still select a compatible overload and convert the arguments to its signature.
2. Launch the selected kernel. Carry each argument’s Numba type through extension handling. Use the selected specialization for both argument packing and execution, so a native cache hit cannot substitute a kernel compiled for another type.
3. Cache the selection. Repeated calls with the same effective types and relevant launch configuration can skip overload resolution. Recompilation, new overloads, and changes in compilation policy invalidate affected choices.
4. Streamline scalar preparation. Reuse type information for scalar classes whose Numba type is fixed. Skip packing conversions when the values already match the selected signature. Python integers still need per-value inference because their signedness can depend on their magnitude.
Validation
Both published reproducers passed at commit 2, before either optimization. The scalar launches each stored
1.5, and the extension launches returned1and2. Regression tests also exercise record layouts, tuple element types, frozen conversions, and retained launchers after recompilation. Cache tests count calls to the resolver to verify warm hits and eviction.Fixes #459.