pad non-byte-multiple vectors instead of skipping - #27
Merged
Conversation
Out-of-range shift amounts are poison; the scalar reference's output for them varies by target and LLVM build (0 locally, amt % N on current CI), so diff/shl and diff/lshr flapped whenever apt.llvm.org updated. Mask amounts into [0, N-1] in-kernel so the reference is only evaluated on defined inputs, and fix the lowerShift comment that claimed the reference guarantees over-shift-to-0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements zero-padding support for vectors whose total bit width is not a multiple of 8 in the Nybbler lowering pass, replacing the previous behavior of skipping these cases. Now, such vectors are widened to the next byte boundary with zero lanes, processed on the padded carrier, and then narrowed back to their original size. The test suite and diff harness are updated to support and verify this new behavior.
Nybbler lowering and carrier pattern changes:
lib/Nybbler.cppis updated to pad non-byte-multiple vectors to the next byte boundary by appending zero lanes, bitcast the padded operands, and then narrow the result back to the original lane count after the operation. This ensures all vector shapes are handled, not just byte-multiples. [1] [2]CarrierOpstruct and related logic are updated to operate on padded types, ensuring correct handling and documentation of the new padded workflow.Test suite updates:
test/skip_nonbyte.ll(which asserted that non-byte-multiple vectors were skipped) is removed, and new tests are added intest/pad_nonbyte.llandtest/pad_diff.llto verify correct lowering and execution of padded vectors across all relevant operations. [1] [2] [3]Diff runner and harness improvements:
tools/diff_runner.py) is updated to support non-byte-multiple kernels: operands/results are now printed per-field when no legal byte bitcast exists, and enough trial bytes are generated to cover all fields. This ensures comprehensive coverage and correct output formatting for padded cases. [1] [2] [3] [4] [5]These changes ensure that all vector shapes, including those whose total bit width is not a multiple of 8, are now correctly handled and tested by Nybbler.
closes #8