dotProduct: handle slices exactly one vector wide without the non-inlined dotProductPreferred #816
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.43) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 365 lines diff across 4 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.353
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #816"
general
weight: 0.35
MarkWolters
Fixes #815.
What
PanamaVectorUtilSupport.dotProduct(v1, off1, v2, off2, length)now checks for a slice exactly one preferred vector wide first and callsdotPreferreddirectly. Previously it calleddotProductPreferred, a 421-byte method that C2 does not inline ("hot method too big" in-XX:+PrintInlining), and only checked the exact fit inside it.dotPreferredis the same function the old route reached, so results are bit-identical. Five lines.Results
JDK 26, macOS arm64 (Apple M4 Max), Panama provider, minimum over many rounds.
4-float
dotProductper call: 1.65 ns before, 0.61 ns after (squareDistance: 0.60 ns, unchanged).Per-query PQ table build (
precomputedScoreFunctionFor):| dimension / subspaces | metric |
main| this branch ||---|---|---|---|
| 1024 / 256 | COSINE | 281 us | 24 us |
| 1024 / 256 | DOT_PRODUCT | 167 us | 24 us |
| 1024 / 256 | EUCLIDEAN | 24.5 us | 24.8 us |
| 1536 / 384 | COSINE | 421 us | 31 us |
| 768 / 192 | COSINE | 212 us | 18 us |
| 128 / 32 | COSINE | 35.5 us | 2.8 us |
End to end, fused-PQ cosine search from disk (30,000 x 1024-d, single thread,
k=10,rerankK=100; two runs each, each building its own graph): 1,719 and 1,727 qps onmain, 2,653 and 2,609 here (about +52%); p50 0.568 and 0.568 ms before, 0.366 and 0.373 ms after. Recall@10 was 0.9950 and 0.9917 before and 0.9940 and 0.9890 after, which is build-to-build variation (the kernel result is bit-identical).x86 (Panama, AVX-512; Ice Lake and GNR; JDK 22 and 25): with 16-float subvectors the 1024-dim table build drops from 97 to 30 µs (Ice Lake, JDK 25), and single-thread PQ search on a 1M, 128-dim dataset gains about 12% with identical recall. Full-vector dot products (64 to 384 dims), 4- and 8-float subvector tables, and a full-precision graph build are unchanged within run-to-run noise, checked against an identical copy of
main.Tests
testDotProductOnShortSlicesWithOffsetscomparesdotProductwith the scalar provider for lengths 1 to 33 around the SIMD widths, at several offsets, including a slice exactly as wide as one preferred vector.testDotProductFastPathMatchesPreferredBitwisewas dropped: the new path anddotProductPreferredrun the samedotPreferred, so it could not fail, and comparing raw bits failed once on Windows JDK 20 over a NaN sign bit.Run on this branch, all passing:
TestVectorizationProvider,TestProductQuantizationand the PQ tests on JDK 22 and 25, with the native and Panama providers, at 512- and 256-bit vector widths.Known limits
dotProduct128branch and is unaffected. The native provider doesn't use this path.dotProductPreferredsmall enough to inline at every width, which makes this check redundant.