nir/opt_vectorize_io: Fix allow_holes option

Only allow holes between the first and last used component.
Do not load unused components before the first used component.

This fixes test failures with a bunch of VK CTS tests
with allow_holes enabled on RADV:
dEQP-VK.tessellation.tess_io.max_in_out.with_f16.*

Fixes: 6286c1c66f
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
This commit is contained in:
Timur Kristóf 2025-12-21 17:04:03 -06:00
parent caf9c0ee3c
commit 1981b9836b

View file

@ -414,16 +414,18 @@ vectorize_slot(nir_intrinsic_instr *chan[8], unsigned mask, bool allow_holes)
scan_mask = mask & BITFIELD_RANGE(4, 4);
mask &= ~scan_mask;
if (is_load && allow_holes) {
if (is_load && allow_holes && scan_mask) {
unsigned num = util_last_bit(scan_mask);
scan_mask = BITFIELD_RANGE(4, num - 4);
unsigned start = ffs(scan_mask) - 1;
scan_mask = BITFIELD_RANGE(start, num - start);
}
} else {
scan_mask = mask;
if (is_load && allow_holes) {
if (is_load && allow_holes && scan_mask) {
unsigned num = util_last_bit(scan_mask);
scan_mask = BITFIELD_MASK(num);
unsigned start = ffs(scan_mask) - 1;
scan_mask = BITFIELD_RANGE(start, num - start);
}
}