Fix bugs in the cuStateVec and cuTensorNet wrappers #3517
All Vouch review confidence checks passed
Residual risk 0.16 = 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 · 269 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.335
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3517"
general
weight: 0.35
kshyatt
Follow-up to #3514, fixing bugs in the cuStateVec and cuTensorNet wrappers that its tests didn't catch, and a few older ones in cuStateVec found while reviewing it. Every fix comes with a test that fails without it.
cuStateVec:
expectationsOnPauliBasisreturned wrong values for every operator but the first: the basis bit counts were passed asInt64where the library readsuint32_t(⟨X₁⟩ on |00⟩ came out as 1).version()decoded 1.15.0 as 11.5.0.migrate!rejected host memory, which is what the migrator is for.applyGeneralizedPermutationMatrix!read 32-bit permutations as 64-bit indices, and rejected host diagonals.swapIndexBitsMultiDevice!passed the global and local bit counts the wrong way around, and Julia objects instead of library handles and device pointers. It's now tested with all sub state vectors on one device.mathMode!changed pooled handles, leaking the setting into other tasks. The math mode now followsCUDACore.math_mode(), as with cuBLAS: fast math with:BFloat16x9precision allows BF16x9 emulation, pedantic math disallows it.cuTensorNet:
insert_tensor!defaulted the orthogonality center to a region that's only valid for one-site environments.Left for later: preparations aren't invalidated when the state changes (e.g. applying an operator after creating an accessor), and
configure!/attribute!pass values as is, so integer attributes need an explicitInt32.