From 621f334a4c827716cb5689430aca21d617e450d1 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Thu, 17 Jul 2025 13:57:42 +0000 Subject: [PATCH] panvk: Wire robustness2 buffer info down to pan/bi Signed-off-by: Mary Guillemard Reviewed-by: Christoph Pillmayer Part-of: --- src/panfrost/compiler/bifrost_compile.c | 5 +++-- src/panfrost/util/pan_ir.h | 2 ++ src/panfrost/vulkan/panvk_vX_shader.c | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index fc8503d72ec..6974d8c516f 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -5437,7 +5437,7 @@ mem_vectorize_cb(unsigned align_mul, unsigned align_offset, unsigned bit_size, } static void -bi_optimize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend) +bi_optimize_nir(nir_shader *nir, unsigned gpu_id, nir_variable_mode robust2_modes) { NIR_PASS(_, nir, nir_opt_shrink_stores, true); @@ -5474,6 +5474,7 @@ bi_optimize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend) 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_PASS(progress, nir, nir_lower_pack); @@ -6472,7 +6473,7 @@ bifrost_compile_shader_nir(nir_shader *nir, NIR_PASS(_, nir, bifrost_nir_lower_shader_output); } - bi_optimize_nir(nir, inputs->gpu_id, inputs->is_blend); + bi_optimize_nir(nir, inputs->gpu_id, inputs->robust2_modes); info->tls_size = nir->scratch_size; diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index c44fadb620d..6522a129156 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -105,6 +105,8 @@ struct pan_compile_inputs { bool no_idvs; uint32_t view_mask; + nir_variable_mode robust2_modes; + /* Mask of UBOs that may be moved to push constants */ uint32_t pushable_ubos; diff --git a/src/panfrost/vulkan/panvk_vX_shader.c b/src/panfrost/vulkan/panvk_vX_shader.c index 74c88023886..55dd33cb341 100644 --- a/src/panfrost/vulkan/panvk_vX_shader.c +++ b/src/panfrost/vulkan/panvk_vX_shader.c @@ -1281,9 +1281,17 @@ panvk_compile_shader(struct panvk_device *dev, return panvk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY); shader->own_bin = true; + + nir_variable_mode robust2_modes = 0; + if (info->robustness->uniform_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT) + robust2_modes |= nir_var_mem_ubo; + if (info->robustness->storage_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT) + robust2_modes |= nir_var_mem_ssbo; + struct pan_compile_inputs inputs = { .gpu_id = phys_dev->kmod.props.gpu_id, .view_mask = (state && state->rp) ? state->rp->view_mask : 0, + .robust2_modes = robust2_modes, }; if (info->stage == MESA_SHADER_FRAGMENT && state != NULL &&