Prevent temporary SIMD allocations in Panama vector kernels #755
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.60) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 514 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.374
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #755"
general
weight: 0.35
tlwillke
Make SIMD species explicit throughout Panama kernels, including intermediate arithmetic results, so the JIT can eliminate temporary vector objects and backing arrays without relying on caller inlining. Resolve heap arrays once outside arithmetic loops where applicable. This problem seems specific to JDKs prior to 24/25.
Covers PQ/NVQ encoding and scoring, dot product, L2, cosine, arithmetic, reductions and Hamming distance. Preserves arithmetic and reduction order, APIs, provider selection, the on-disk format and the
VectorAccesscallback.Validation includes scalar-oracle and bitwise regression tests, offsets/tails, aliasing, special values, concurrency, and fresh Ada002, MPNet, Cohere and OpenAI 3072 1M builds and queries.
Across the four 1M datasets, cumulative GC-reclaimed heap during query passes fell 54–84% with one thread. With eight threads, it fell 61–83% for MPNet, Ada002 and OpenAI3072, while Cohere remained essentially unchanged.
Panama query throughput improves 22.7–38.2% with one thread and 8.7–103.7% with eight threads across the reported recall@10 settings. The fix keeps concrete SIMD types visible to HotSpot so temporary vector objects and backing arrays can be eliminated, including on the resident
VectorAccessencoding path.Matched benchmark configuration
Tested main
201dd576versus allocation armcb0f5fb5. Native disabled; Panama, JDK 23, preferred 512-bit species,-Xmx128g, resident inputs, DOT_PRODUCT, FusedPQ enabled, PQ subspace width 8/K=256/no centering/unweighted, NVQ two subvectors, V6, degree 32/efConstruction 100/overflow 1.2, hierarchy and refinement enabled, pruning disabled. Builds use 48 insertion, cleanup and writer workers; queries use CPU 0 or CPUs 0–7. All 10,000 queries are evaluated for MPNet/Ada002/Cohere and all 1,000 for OpenAI3072.Reproduce: Compare current main with this branch using JDK 23 and the configuration above. In both arms, use
--add-modules=jdk.incubator.vector,-Djvector.experimental.enable_native_vectorization=false, and-Djvector.parallel_writer=true. Measure cached queries with dedicated 1/8-worker passes; collect memory/GC separately from clean QPS passes.Every table cell below is main → this PR. Each arm trains a fresh independent codebook and builds its own graph.
1-thread queries
| Dataset | QPS, 10@1× | QPS, 10@2× | Recall@10, 1× (%) | Recall@10, 2× (%) | GC reclaimed (GiB) |
| --- | ---: | ---: | ---: | ---: | ---: |
| MPNet 1M | 6,302 → 8,711 | 5,574 → 7,244 | 62.501 → 62.950 | 79.711 → 79.907 | 29.18 → 4.64 |
| Ada002 1M | 3,455 → 4,691 | 3,097 → 4,041 | 53.291 → 54.004 | 73.591 → 74.551 | 24.23 → 7.72 |
| Cohere 1M | 5,247 → 6,889 | 4,618 → 5,738 | 58.912 → 58.718 | 78.200 → 78.077 | 14.87 → 5.83 |
| OpenAI3072 1M | 1,883 → 2,311 | 1,761 → 2,212 | 62.690 → 63.950 | 78.990 → 79.940 | 26.52 → 12.10 |
8-thread queries
| Dataset | QPS, 10@1× | QPS, 10@2× | Recall@10, 1× (%) | Recall@10, 2× (%) | GC reclaimed (GiB) |
| --- | ---: | ---: | ---: | ---: | ---: |
| MPNet 1M | 54,918 → 59,700 | 43,993 → 53,205 | 62.501 → 62.950 | 79.711 → 79.907 | 25.84 → 4.48 |
| Ada002 1M | 28,870 → 35,733 | 24,621 → 30,324 | 53.291 → 54.004 | 73.591 → 74.551 | 27.53 → 6.49 |
| Cohere 1M | 37,011 → 49,910 | 31,300 → 42,844 | 58.912 → 58.718 | 78.200 → 78.077 | 4.87 → 4.88 |
| OpenAI3072 1M | 10,380 → 18,114 | 8,349 → 17,010 | 62.690 → 63.950 | 78.990 → 79.940 | 27.00 → 10.48 |
GC is cumulative reclaimed Java heap from separate fixed-workload memory passes covering all five standard search settings; it is not resident memory or allocated bytes. QPS comes from clean throughput passes.
Recall and visited counts match exactly between one and eight threads within every arm. Independent codebooks and concurrent graph construction can change recall between runs. Controlled checks found identical recall/visited on the same 1M indexes with either kernel implementation and byte-identical 100k graphs with a shared codebook, codes and serial insertion order. Scalar-oracle and bitwise kernel tests also passed.