agx: gate scratch opt on internal shaders

fixes a bunch of OpenCL CTS including test_basic vload_private due to failing
to relower the derefs but also lol.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Backport-to: 25.1
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36631>
This commit is contained in:
Alyssa Rosenzweig
2025-08-07 07:22:52 -04:00
committed by Marge Bot
parent 45c28a20a4
commit 8b96f66da6
+8 -6
View File
@@ -3909,12 +3909,14 @@ 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);
/* Optimize scratch access for silly internal CL shaders */
if (nir->info.internal) {
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;