From 356d88457a578d879099fefd0a15c359e256e307 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Mon, 13 Apr 2026 15:49:57 -0700 Subject: [PATCH] anv: Lower any remaining globals when cmat_calls are inlined Fixes: 3debca7dc66 ("anv: Enable cooperativeMatrixPerElementOperations") Reviewed-by: Dave Airlie Part-of: --- src/intel/vulkan/anv_shader_compile.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/intel/vulkan/anv_shader_compile.c b/src/intel/vulkan/anv_shader_compile.c index 63e20dd901d..3bf6884a808 100644 --- a/src/intel/vulkan/anv_shader_compile.c +++ b/src/intel/vulkan/anv_shader_compile.c @@ -1472,7 +1472,16 @@ anv_shader_lower_nir(struct anv_device *device, NIR_PASS(_, nir, nir_opt_dce); NIR_PASS(inlined, nir, nir_inline_functions); nir_remove_non_entrypoints(nir); + if (inlined) { + /* Some shader_temp vars may have remained multi-function before + * cmat lowering/inlining. Now that everything was inlined, + * they may be lowered to locals. + */ + bool lowered_globals = false; + NIR_PASS(lowered_globals, nir, nir_lower_global_vars_to_local); + if (lowered_globals) + NIR_PASS(_, nir, nir_split_struct_vars, nir_var_function_temp); NIR_PASS(_, nir, nir_opt_copy_prop_vars); NIR_PASS(_, nir, nir_opt_copy_prop); }