Optimize DocValues using Panama API decoders for Byte Short and Int to Long instead of default scalar loop - #16517
Open
CH-Abhinav wants to merge 2 commits into
Open
Optimize DocValues using Panama API decoders for Byte Short and Int to Long instead of default scalar loop#16517CH-Abhinav wants to merge 2 commits into
CH-Abhinav wants to merge 2 commits into
Conversation
…o Long instead of default scalar loop
Contributor
Author
|
Any maintainer out there who can approve github actions ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is adding Panama Vector API decoders into
PanamaDocValuesBulkDecodeSupport.javainstead of using default scalar decoders. In this PR aim is to get optimized decoders forByteShortandInttoLongversions like how decoder forLongtoLongalready exists. Closes #16451 .Analysis
Using single LongVector to calculate
shapeconvert()is sub-optimal due to memory fetch bottlenecks. And standard JIT C2 compiler isn't auto-verctorzing scalar loops to reach Panama Vector's performance due to shape mismatches.so this PR introduces
decode8(Byte to Long),decode16(Short to Long) anddecode32(Int to Long). To maximize memory bandwidth while strictly avoiding L1 cache register spilling on AVX2 hardware (16-register limit), the loops are explicitly unrolled:decode8(Byte to Long) &decode16(Short to Long): Locked to a 4x expansion ratio (1 input vector unrolled to 4LongVectoroutputs). Limits active YMM registers to 5.decode32(Int to Long): Locked to a 2x expansion ratio (1 input vector unrolled to 2LongVectoroutputs). Limits active YMM registers to 3.Benchmark
The JMH benchmarks were executed on JDK 25.0.3
(Note: We tested 8 vectors to find the register spill threshold, which collapses performance below the scalar baseline as shown above. Additionally, on GraalVM, the JIT compiler auto-vectorizes the scalar loops effectively enough to match this manual vectorization).
Testing
added a test
TestDocValuesBulkDecodeSupport.javato test the decoders inPanamaDocValuesBulkDecodeSupport.java.