Module: Mesa
Branch: main
Commit: d6b8acbee9374801db92b8fbe92dc6305b7a5738
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6b8acbee9374801db92b8fbe92dc6305b7a5738

Author: Alyssa Rosenzweig <[email protected]>
Date:   Tue May 23 14:13:00 2023 -0400

agx: Use common combine_all_barriers callback

This contains a bugfix: execution scopes are now respected when combining
barriers. Otherwise control barriers can disappear during combining, which is
wrong.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Caio Oliveira <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23181>

---

 src/asahi/compiler/agx_compile.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index c0443955c86..c4aa240b882 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -1935,18 +1935,6 @@ agx_optimize_loop_nir(nir_shader *nir)
    } while (progress);
 }
 
-static bool
-combine_all_barriers(nir_intrinsic_instr *a, nir_intrinsic_instr *b, void *_)
-{
-   nir_intrinsic_set_memory_modes(
-      a, nir_intrinsic_memory_modes(a) | nir_intrinsic_memory_modes(b));
-   nir_intrinsic_set_memory_semantics(
-      a, nir_intrinsic_memory_semantics(a) | 
nir_intrinsic_memory_semantics(b));
-   nir_intrinsic_set_memory_scope(
-      a, MAX2(nir_intrinsic_memory_scope(a), nir_intrinsic_memory_scope(b)));
-   return true;
-}
-
 static void
 agx_optimize_nir(nir_shader *nir, unsigned *preamble_size)
 {
@@ -2010,7 +1998,7 @@ agx_optimize_nir(nir_shader *nir, unsigned *preamble_size)
     */
    NIR_PASS_V(nir, agx_nir_lower_algebraic_late);
    NIR_PASS_V(nir, nir_opt_constant_folding);
-   NIR_PASS_V(nir, nir_opt_combine_barriers, combine_all_barriers, NULL);
+   NIR_PASS_V(nir, nir_opt_combine_barriers, NULL, NULL);
 
    /* Must run after uses are fixed but before a last round of copyprop + DCE 
*/
    if (nir->info.stage == MESA_SHADER_FRAGMENT)

Reply via email to