costin opened a new pull request, #16160:
URL: https://github.com/apache/lucene/pull/16160
CD- and delta-encoded dense `NumericDocValues` currently decode every value
inside `rangeIntoBitSet()`, even though the encoded packed values are already
available. This PR transforms the query bounds into the encoded domain once per
call, then delegates to the existing `DocValuesRangeSupport` path.
This keeps the implementation provider-neutral: the default scalar provider
still works, while the existing Panama Vector API provider can handle the
encoded values through the same optimized range-into-bitset path.
Overflow during bound transformation (ArithmeticException _ ) falls back to
the previous scalar decoded loop.
The scope is dense singleton numeric doc values.
`SortedNumericDocValuesField.newSlowRangeQuery` benefits for singleton fields
because Lucene unwraps them to `NumericDocValues` before using
`BatchDocValuesRangeIterator`. True multi-valued sorted numerics need a
separate value-level-to-doc-level bitset algorithm, but can reuse the same
bound transformation idea.
### Benchmarks
`GcdDeltaRangeIntoBitSetBenchmark`
Platform: JDK 25, 1M docs, 1 fork, 3 iters x 2s
default: scalar provider, no --add-modules jdk.incubator.vector panama: SIMD
via Panama Vector API
#### AMD EPYC (c5a.2xlarge, AVX2)
| encoding | selectivity | default (ops/s) | panama (ops/s) | panama vs
default |
|----------|-------------|----------------:|---------------:|------------------:|
| none | 0.01 | 171.9 | 306.4 | **1.78x** |
| none | 0.1 | 153.1 | 265.7 | **1.73x** |
| none | 0.5 | 161.7 | 340.0 | **2.10x** |
| delta_only | 0.01 | 171.7 | 305.2 | **1.78x** |
| delta_only | 0.1 | 156.8 | 265.0 | **1.69x** |
| delta_only | 0.5 | 166.6 | 338.6 | **2.03x** |
| gcd_1000 | 0.01 | 172.5 | 306.3 | **1.78x** |
| gcd_1000 | 0.1 | 155.5 | 265.3 | **1.71x** |
| gcd_1000 | 0.5 | 168.7 | 340.3 | **2.02x** |
| gcd_100_delta | 0.01 | 171.4 | 304.0 | **1.77x** |
| gcd_100_delta | 0.1 | 155.6 | 265.2 | **1.70x** |
| gcd_100_delta | 0.5 | 168.9 | 337.8 | **2.00x** |
#### Intel Ice Lake (c6i.2xlarge, AVX-512)
| encoding | selectivity | default (ops/s) | panama (ops/s) | panama vs
default |
|----------|-------------|----------------:|---------------:|------------------:|
| none | 0.01 | 177.1 | 539.4 | **3.05x** |
| none | 0.1 | 155.2 | 381.3 | **2.46x** |
| none | 0.5 | 163.9 | 526.9 | **3.22x** |
| delta_only | 0.01 | 173.0 | 537.0 | **3.10x** |
| delta_only | 0.1 | 156.9 | 376.4 | **2.40x** |
| delta_only | 0.5 | 160.5 | 530.0 | **3.30x** |
| gcd_1000 | 0.01 | 176.6 | 538.7 | **3.05x** |
| gcd_1000 | 0.1 | 156.2 | 379.7 | **2.43x** |
| gcd_1000 | 0.5 | 159.0 | 536.9 | **3.38x** |
| gcd_100_delta | 0.01 | 178.4 | 537.2 | **3.01x** |
| gcd_100_delta | 0.1 | 156.5 | 376.0 | **2.40x** |
| gcd_100_delta | 0.5 | 158.8 | 530.5 | **3.34x** |
Below a comparison on the gains AVX-512 from larger registers than AVX-2
#### AVX-512 vs AVX2, Panama provider
| encoding | selectivity | AMD (ops/s) | AVX-512 (ops/s) | AVX-512 vs AMD |
|----------|-------------|------------:|----------------:|---------------:|
| none | 0.01 | 306.4 | 539.4 | **1.76x** |
| none | 0.1 | 265.7 | 381.3 | **1.44x** |
| none | 0.5 | 340.0 | 526.9 | **1.55x** |
| delta_only | 0.01 | 305.2 | 537.0 | **1.76x** |
| delta_only | 0.1 | 265.0 | 376.4 | **1.42x** |
| delta_only | 0.5 | 338.6 | 530.0 | **1.57x** |
| gcd_1000 | 0.01 | 306.3 | 538.7 | **1.76x** |
| gcd_1000 | 0.1 | 265.3 | 379.7 | **1.43x** |
| gcd_1000 | 0.5 | 340.3 | 536.9 | **1.58x** |
| gcd_100_delta | 0.01 | 304.0 | 537.2 | **1.77x** |
| gcd_100_delta | 0.1 | 265.2 | 376.0 | **1.42x** |
| gcd_100_delta | 0.5 | 337.8 | 530.5 | **1.57x** |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]