From 9ec1bb01118f48ffe7c802c7ed7137df6e71a127 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Tue, 29 Jul 2025 14:32:07 +0000 Subject: [PATCH] pan/bi: Vectorize UBOs load/store We can benifit from it, let's allow it when we aren't forced to follow robustness2. Signed-off-by: Mary Guillemard Acked-by: Erik Faye-Lund Reviewed-by: Eric R. Smith Part-of: --- src/panfrost/compiler/bifrost_compile.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index bd6838a180c..6acca017842 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -5455,13 +5455,19 @@ bi_optimize_nir(nir_shader *nir, unsigned gpu_id, nir_variable_mode robust2_mode NIR_PASS(progress, nir, nir_opt_loop_unroll); } while (progress); - NIR_PASS( - progress, nir, nir_opt_load_store_vectorize, - &(const nir_load_store_vectorize_options){ - .modes = nir_var_mem_global | nir_var_mem_shared | nir_var_shader_temp, - .robust_modes = robust2_modes, - .callback = mem_vectorize_cb, - }); + nir_load_store_vectorize_options vectorize_opts = { + .modes = nir_var_mem_global | + nir_var_mem_shared | + nir_var_shader_temp, + .callback = mem_vectorize_cb, + .robust_modes = robust2_modes, + }; + + /* Only allow vectorization of UBOs when no robustness2 is configured */ + if (!(robust2_modes & nir_var_mem_ubo)) + vectorize_opts.modes |= nir_var_mem_ubo; + + NIR_PASS(progress, nir, nir_opt_load_store_vectorize, &vectorize_opts); NIR_PASS(progress, nir, nir_lower_pack); /* nir_lower_pack can generate split operations, execute algebraic again to