diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index f83840819a1..a0e4a4be62c 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3154,7 +3154,16 @@ agx_optimize_nir(nir_shader *nir, bool soft_fault, uint16_t *preamble_size, } while (progress); } + /* Reassociate before forming preambles because it makes preambles more + * effective. Clean up after. + */ for (unsigned i = 0; i < 4; ++i) { + nir_reassociate_options opts = nir_reassociate_scalar_math; + if (i < 2) + opts |= nir_reassociate_cse_heuristic; + + NIR_PASS(_, nir, nir_opt_reassociate, opts); + do { progress = false;