Repository navigation
Map constant RowFn inputs directly - #9628
Conversation
Merging this PR will improve performance by 52.4%
|
08450db to
d979a9b
Compare
## Summary - Tracking Issue: #9128 Lets infallible RowFn output types collect directly from a validated row source. Boolean output uses `BitBuffer::collect_bool` instead of materializing an intermediate `Vec<bool>`. This is the first layer of the stack. Constant inputs follow in #9628. ## Changes Adds a default `OutputElement::build_from` implementation and a Boolean override that writes the packed bitmap. A dedicated `execute_owned_infallible` route uses it when all inputs have validated non-constant views. Constant and valid-only execution keep their existing `Vec` paths. Tests cover packed values and nullability, bitmap word boundaries, nullary input, and skipped invalid rows. A focused Divan benchmark covers `i32` and `i64` Boolean 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. The `develop` control 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 as `build`, and cannot introduce value-dependent errors or panics. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
d979a9b to
a254aaf
Compare
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
a254aaf to
52c4e85
Compare
## Summary - Tracking Issue: #9128 `RowFn` handles constant inputs so row kernels do not need separate execution paths for each input shape. #9628 adds an indexed source for infallible execution, but fallible `execute_owned` still uses a separate loop whenever any input is constant. That loop selects between row and constant values on every iteration, duplicating the traversal and hiding the fixed batch input shape from LLVM. Depends on #9628. ## Changes Extends the decoded indexed source to fallible `execute_owned` calls. Each source validates its decoded length and fixes its row-or-constant behavior before traversal, allowing every input shape to use `map_checked_into` without changing output initialization or deferred failure handling. This removes the separate `LaneZip` branch. Optimized x86 IR preserves the vector loop while reducing the focused deferred Boolean executor by 27% and the deferred `i64` executor by 19%, with the same bounds-panic sites. Tests cover a constant left-hand input, and the focused benchmark covers varying inputs and both partial-constant orientations. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Summary
#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 intermediateVec<bool>: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
ArgColumns. Each argument reads either rowindexor its single decoded constant, while the source still reports the logical batch length expected byOutputElement::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::viewmust produce the same row values asInputElement::getfor every addressable index.