Repository navigation
Share FastLanes compare kernels between operators and signedness - #10739
robert3005 wants to merge 2 commits into
Conversation
The fused bit-packed compare compiled the unpack_cmp kernel for each of the six compare operators, for every bit width and value type. NotEq, Gte and Lte are the inverse of Eq, Lt and Gt, so each pair now uses one kernel. The fused kernel inverts each 1024-bit output block while the block is still in cache when the operator is a negation. That adds 16 word NOTs for each 1024 values. The compare sweep tests now check all six operators. vortex-fastlanes release __text: 4,441,900 -> 3,279,340 bytes (-1.16 MB). Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e21bda4 to
ae5c54f
Compare
| if negate { | ||
| out.iter_mut().for_each(|word| *word = !*word); | ||
| } |
There was a problem hiding this comment.
this is the added work of this pr
Bit-packing rejects negative integers, so packed values of a signed type are never negative. A negative constant compares the same against every packed value as against zero, and is handled before the fused kernel. Otherwise both sides are non-negative, and the unsigned physical values compare the same as the signed values. The fused kernel now takes function items of the physical type, so signed and unsigned arrays of one width share one set of unpack_cmp kernels. vortex-fastlanes release __text: 3,279,596 -> 2,846,252 bytes (-433 KB). Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging this PR will regress 1 benchmark4 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Negated operators share kernels.
NotEq,GteandLteare the inverse ofEq,LtandGt, so each pair now uses one set of kernels. When the operator is a negation,stream_compare_fusedinverts each 1024-bit output block right after the transpose, while the block is still in cache. This adds 16 word NOTs for each 1024 values.betweenpassesnegate = false.Signed types use the unsigned kernels. Bit-packing rejects negative integers (
ensure_non_negative_integers), so packed values of a signed type are never negative.<T as PhysicalPType>::Physical::is_ltand so on), so signed and unsigned arrays of one width share one set of kernels.Patches and width 0 still use the exact predicate on the logical type.
vortex-fastlanesrelease__text(macOS arm64)