Repository navigation
Conversation
|
Before you submit for review:
If you did not complete any of these, then please explain below. |
There was a problem hiding this comment.
I'm finding it difficult to reproduce the results on my System. Here are the results I'm seeing right now:
This compares QPS vs recall for cohere-english-v3-1M with JDK 21 and JDK 25. In both cases there isn't too much difference between the two branches.
Details
main commit: 598ef09e8
fix-alloc commit: 3270244b7
BenchYAML config: config.yaml (PQ + NVQ)
Java heap: -Xmx40G
Machine: Intel GNR with 24 cores / 48 threads
metric: DOT_PRODUCT
Java flags:
"--add-modules=jdk.incubator.vector"
"-Djvector.experimental.enable_native_vectorization=false"
"-Djvector.parallel_writer=true"
"-ea"
I saw similar results using mpnet-1m. Is there something I'm missing here?
MarkWolters
left a comment
There was a problem hiding this comment.
My only concern is specified in the comment I left. Once that is cleared up for me I will approve.
|
Same problem for me, I am unable to reproduce the numbers with the flags specified here. I dont see anything different in microbenchmarks either for
For ada1m, on a x8i.8xlarge Intel GNR with 16 cores/32 threads: QPS for topk=10:
Am i missing something here? I am running with JDK 25 and with these flags: |
|
@ashkrisk On Cohere 1M with standard BenchYAML, the PR reduced query-window GC reclaimed from 27.57 to 1.42 GiB on JDK 23. On JDK 25, main already showed no sampled SIMD boxing: GC reclaimed changed only from 1.44 to 1.35 GiB, with modest QPS gains. The benefit therefore depends on the JDK and workload. This is what you are seeing. The audit also found that added type casts made some kernels too large to inline. I have validated a compact fix for PQ gathering and am addressing the remaining cases, including NVQ, while retaining the explicit SIMD types and allocation fixes. Validation continues on both JDKs. I still think it is worth pursuing since we have users that are not on JDK 25. PS - the impact on low overquery cases is more profound and of more practical importance. |
|
@r-devulap please see my response to @ashkrisk . |
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
8-thread queries
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.