Skip to content

pad non-byte-multiple vectors instead of skipping - #27

Merged
angelo-yap merged 2 commits into
mainfrom
u3a-non-byte-multiple-padding-path
Jul 19, 2026
Merged

pad non-byte-multiple vectors instead of skipping#27
angelo-yap merged 2 commits into
mainfrom
u3a-non-byte-multiple-padding-path

Conversation

@angelo-yap

Copy link
Copy Markdown
Owner

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:

  • The carrier pattern in lib/Nybbler.cpp is 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]
  • The CarrierOp struct and related logic are updated to operate on padded types, ensuring correct handling and documentation of the new padded workflow.

Test suite updates:

  • The old test test/skip_nonbyte.ll (which asserted that non-byte-multiple vectors were skipped) is removed, and new tests are added in test/pad_nonbyte.ll and test/pad_diff.ll to verify correct lowering and execution of padded vectors across all relevant operations. [1] [2] [3]

Diff runner and harness improvements:

  • The diff harness (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

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.
@angelo-yap
angelo-yap merged commit 8e171eb into main Jul 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[U3-A] Non-byte-multiple padding path

1 participant