Repository navigation
Build packed boolean output - #9620
Conversation
Merging this PR will improve performance by 25.25%
|
2b0ee2c to
7819753
Compare
7819753 to
4d60a08
Compare
Signed-off-by: Connor Tsui <[email protected]>
4d60a08 to
ccb755d
Compare
| const INPUT_SHAPES: &[InputShape] = &[ | ||
| InputShape::PerRowPerRow, | ||
| InputShape::PerRowConstant, | ||
| InputShape::ConstantPerRow, | ||
| ]; |
There was a problem hiding this comment.
can you explain these
There was a problem hiding this comment.
its just the args shape? I feel like its pretty clear...
joseph-isaacs
left a comment
There was a problem hiding this comment.
Do we really need 8 new benchmarks?
|
the benchmarks are specifically for the PRs stacked on top of this |
## Summary - Tracking Issue: #9128 #9620 lets Boolean output collect results directly into a packed bit buffer, but only when every input varies by row. A RowFn constant is stored as one decoded value instead of a `row_count`-element view, so one constant input still forces an intermediate `Vec<bool>`: ```text before: (column, column) -> BitBuffer (column, constant) -> Vec<bool> -> BitBuffer after: either input shape -> BitBuffer ``` This PR does not add constant handling. It makes the direct output collector usable with the constant handling RowFn already has. Depends on #9620. ## Changes Adds a private indexed source over decoded `ArgColumn`s. Each argument reads either row `index` or its single decoded constant, while the source still reports the logical batch length expected by `OutputElement::build_from`. The row-or-constant choice remains visible to the optimizer before traversal, which preserves direct packed Boolean stores. Tests cover both constant positions, all-constant input, and nullary execution. ## API Changes Clarifies that `InputElement::view` must produce the same row values as `InputElement::get` for every addressable index. Signed-off-by: Connor Tsui <[email protected]>
Summary
Lets infallible RowFn output types collect directly from a validated row source. Boolean output uses
BitBuffer::collect_boolinstead of materializing an intermediateVec<bool>.This is the first layer of the stack. Constant inputs follow in #9628.
Changes
Adds a default
OutputElement::build_fromimplementation and a Boolean override that writes the packed bitmap. A dedicatedexecute_owned_infallibleroute uses it when all inputs have validated non-constant views. Constant and valid-only execution keep their existingVecpaths.Tests cover packed values and nullability, bitmap word boundaries, nullary input, and skipped invalid rows. A focused Divan benchmark covers
i32andi64Boolean output with varying inputs and both constant orientations.With rustc 1.98.0 and LLVM 22.1.8 targeting x86-64 AVX2 with 16 CGUs and no LTO, the varying-input loop now emits vector compares,
vpmovmskb, and a direct packed-word store. Thedevelopcontrol writes unpacked Boolean bytes to a temporary vector before packing them.API Changes
Adds
OutputElement::build_from. Implementations must evaluate every source row exactly once in order, return the same values asbuild, and cannot introduce value-dependent errors or panics.