From 7d7f5013f854090fe27cb52b9a63ff146fbbea1a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 5 Oct 2023 17:44:54 -0400 Subject: [PATCH] agx: Cleanup 8-bit math before lowering Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index c82d1e424a8..afa915e9cf3 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2897,6 +2897,17 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, .callback = mem_access_size_align_cb, }; NIR_PASS_V(nir, nir_lower_mem_access_bit_sizes, &lower_mem_access_options); + + /* Cleanup 8-bit math before lowering */ + bool progress; + do { + progress = false; + + NIR_PASS(progress, nir, nir_opt_algebraic); + NIR_PASS(progress, nir, nir_opt_constant_folding); + NIR_PASS(progress, nir, nir_opt_dce); + } while (progress); + NIR_PASS_V(nir, nir_lower_bit_size, lower_bit_size_callback, NULL); /* Late blend lowering creates vectors */