From: Alyssa Rosenzweig Date: Sun, 19 Feb 2023 04:33:12 +0000 (-0500) Subject: agx: Fix subdivision coalescing X-Git-Tag: upstream/23.3.3~11807 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=706815488e19114437f3bf3c2c7672dc4fd7e6ad;p=platform%2Fupstream%2Fmesa.git agx: Fix subdivision coalescing As intended. We can't CSE with partial null destinations in the way, so we shouldn't eliminate dead destinations until after CSE has run. But we should still eliminate dead instructions to ensure CSE doesn't move things around needlessly, hurting register pressure. Noticed while debugging live range splitting. No GLES3.0 shader-db changes. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 06f6d3b..1e2711f 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2142,12 +2142,17 @@ agx_compile_function_nir(nir_shader *nir, nir_function_impl *impl, agx_validate(ctx, "IR translation"); if (likely(!(agx_compiler_debug & AGX_DBG_NOOPT))) { - /* Dead code eliminate before instruction combining so use counts are - * right */ - agx_dce(ctx, true); - agx_optimizer(ctx); + /* Eliminate dead instructions before CSE to avoid silly scheduling */ + agx_dce(ctx, false); + + /* CSE before eliminating dead destinations so that subdivision is + * optimized properly. + */ agx_opt_cse(ctx); + /* After DCE, use counts are right so we can run the optimizer. */ + agx_optimizer(ctx); + /* For correctness, lower uniform sources after copyprop (for correctness, * as copyprop creates uniform sources). To keep register pressure in * check, lower after CSE, since moves are cheaper than registers.