nir/opt_vectorize_io: fix a failure when vectorizing different bit sizes

Fixes: 2514999c9c - nir: add nir_opt_vectorize_io, vectorizing lowered IO
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13085

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34897>
(cherry picked from commit dbef8f1791)
This commit is contained in:
Marek Olšák 2025-05-09 10:47:05 -04:00 committed by Eric Engestrom
parent ed0d06d796
commit 2da50834fe
2 changed files with 14 additions and 1 deletions

View file

@ -1474,7 +1474,7 @@
"description": "nir/opt_vectorize_io: fix a failure when vectorizing different bit sizes",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "2514999c9c5d4b64b007304e46f0a41d50e71cc9",
"notes": null

View file

@ -76,6 +76,19 @@ compare_is_not_vectorizable(nir_intrinsic_instr *a, nir_intrinsic_instr *b)
sem0.high_16bits != sem1.high_16bits)
return sem0.high_16bits > sem1.high_16bits ? 1 : -1;
/* TODO: vectorize (f32, f32, f16vec2, f16vec2) -> vec4
* For now, different bit sizes are not vectorized together.
*/
if (nir_intrinsic_has_src_type(a)) {
/* Stores. */
if (a->src[0].ssa->bit_size != b->src[0].ssa->bit_size)
return a->src[0].ssa->bit_size > b->src[0].ssa->bit_size ? 1 : -1;
} else {
/* Loads. */
if (a->def.bit_size != b->def.bit_size)
return a->def.bit_size > b->def.bit_size ? 1 : -1;
}
nir_shader *shader =
nir_cf_node_get_function(&a->instr.block->cf_node)->function->shader;