Repository navigation
Skip codegen of unreachable type dispatch arms - #10740
robert3005 wants to merge 1 commit into
Conversation
Three dispatches compiled kernels for type combinations that an invariant makes unreachable: - check_decimal_identical dispatched on lhs, rhs and their widest type, but the widest type is fixed by the two distinct inputs. - widened_buffer is called only for storage types narrower than W, and the narrowing branch of converted_buffer only for wider ones. - The bit-packed widening cast compiled every integer pair, but only widening pairs reach the kernel. A const condition now removes the other arms before codegen. Also, bit-packing rejects negative values, so the bit-packed cast now views signed sources as unsigned and reinterprets the result. Signed and unsigned casts of the same widths share one kernel. Release __text: vortex-array 14,023,548 -> 13,933,616 bytes (-90 KB), vortex-fastlanes 4,442,156 -> 4,331,764 bytes (-110 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 benchmark3 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
A const condition removes the unreachable arms before codegen in three places:
check_decimal_identicaldispatched on the lhs storage type, the rhs storage type and their widest type. The two distinct inputs fix the widest type, so only 30 of 216 arms can run.widened_buffer::<W>is only called for storage types narrower thanW(all callers pass the wider of two inputs), and the narrowing branch ofconverted_buffer::<W>only runs for storage types wider thanW. Only 15 of 36 arms of each can run.Bit-packing rejects negative values, so sign extension of a packed value is the same as zero extension. The bit-packed cast now views a signed source as unsigned (the packed buffer is shared and the patch values are reinterpreted) and reinterprets the result to the target type. Signed and unsigned casts of the same widths share one kernel, so the cast compiles 6 kernels instead of 18 reachable ones.
__text(macOS arm64)vortex-arrayvortex-fastlanes