pan/nir: Use minimum-width constants instead of scalar

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40769>
This commit is contained in:
Faith Ekstrand 2026-04-02 10:25:43 -04:00
parent f138d13672
commit a88e724b6e
2 changed files with 5 additions and 7 deletions

View file

@ -5249,10 +5249,6 @@ bi_compile_variant_nir(nir_shader *nir,
NIR_PASS(progress, nir, nir_opt_dead_cf);
NIR_PASS(progress, nir, nir_opt_cse);
}
/* opt_cse can vectorize load_const, we need to lower this to scalar */
NIR_PASS(progress, nir, nir_lower_load_const_to_scalar);
NIR_PASS(progress, nir, nir_opt_dce);
}
/* If nothing is pushed, all UBOs need to be uploaded */

View file

@ -349,9 +349,6 @@ bi_optimize_nir(nir_shader *nir, uint64_t gpu_id,
NIR_PASS(_, nir, nir_opt_cse);
}
NIR_PASS(_, nir, nir_lower_load_const_to_scalar);
NIR_PASS(_, nir, nir_opt_dce);
/* Backend scheduler is purely local, so do some global optimizations
* to reduce register pressure. */
nir_move_options move_all = nir_move_const_undef | nir_move_load_ubo |
@ -1124,6 +1121,11 @@ bifrost_compile_shader_nir(nir_shader *nir,
bi_optimize_nir(nir, inputs->gpu_id, inputs->robust_modes);
/* Lower constants to scalar but then immediately fold so we get minimum-
* width vectors instead of scalars
*/
NIR_PASS(_, nir, nir_lower_load_const_to_scalar);
NIR_PASS(_, nir, nir_opt_constant_folding);
uint64_t gpu_id = inputs->gpu_id;
NIR_PASS(_, nir, nir_lower_phis_to_scalar, bi_vectorize_filter, &gpu_id);
NIR_PASS(_, nir, nir_opt_copy_prop);