diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index b330d7b3f2e..9a15d94ac1c 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3692,8 +3692,7 @@ agx_preprocess_nir(nir_shader *nir, const nir_shader *libagx) /* Lower large arrays to scratch and small arrays to csel */ NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256, - glsl_get_natural_size_align_bytes, - glsl_get_natural_size_align_bytes); + glsl_get_natural_size_align_bytes, glsl_get_word_size_align_bytes); NIR_PASS(_, nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0); NIR_PASS(_, nir, nir_split_var_copies); NIR_PASS(_, nir, nir_lower_global_vars_to_local); @@ -3801,6 +3800,13 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, }; NIR_PASS(_, nir, nir_lower_mem_access_bit_sizes, &lower_mem_access_options); + /* Optimize scratch access */ + NIR_PASS(_, nir, nir_lower_scratch_to_var); + NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256, + glsl_get_natural_size_align_bytes, + glsl_get_natural_size_align_bytes); + NIR_PASS(_, nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0); + /* Cleanup 8-bit math before lowering */ bool progress; do {