Repository navigation
Commit f94594d
committed
[improvement](be) Compact selected row indices with mask lookups
### What problem does this PR solve?
Issue Number: None
Problem Summary: Partially selected SIMD masks are expanded one bit at a time,
creating a serial dependency for every selected row. Use a constexpr eight-row
lookup table and vector stores for x86 masks with more than two selected rows.
Keep the original ctz loop for sparse masks and other architectures. Preserve
zero/full-mask shortcuts, tails, row order, and downstream materialization.
The selector already has one slot per input row, so fixed-width stores fit in
that allocation even when only the returned prefix is valid.
On a Xeon Platinum 8457C, 4096-row batches and random 50% selection, the actual
helper reduces standalone compaction from 0.693280 to 0.119248 ns/input row
(5.81x, Clang 20 native). Including one int32 predicate comparison and an 8-byte
payload copy improves from 1.170464 to 0.643518 ns/input row (1.82x).
Tradeoff: the Clang 16 AVX2 random 1% compaction-only case changes from 0.104319
to 0.119946 ns/input row (15% slower); the Clang 20 native 1% case is unchanged.
These measurements do not establish complete SQL query speedups.
### Release note
None
### Check List (For Author)
- Test: Manual test: native and AVX2 standalone benchmark; ASan+UBSan exhaustive
mask, tail, row-order, output-bounds and payload verification; clang-format 16;
repository build-hygiene and focused clang-tidy checks.
Add SelectionTest cases for masks, large row bases and consecutive appends.
Standard BE UT and full ASAN BE build were attempted with -j 48, but failed
in the unrelated existing local ColumnVector span-iterator/PODArray copy constructor at
column_vector.h:95 before the new GTest cases could execute. No SQL test run.
- Behavior changed: No
- Does this need documentation: No1 parent 76011df commit f94594d
4 files changed
Lines changed: 872 additions & 5 deletions
File tree
- be
- benchmark
- src
- storage/segment
- util/simd
- test/util/simd
0 commit comments