nir: Add missing nir_var_mem_global to various passes
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 11 Jan 2020 07:52:30 +0000 (23:52 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 14 Jan 2020 22:42:12 +0000 (14:42 -0800)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3322>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3322>

src/compiler/nir/nir_opt_access.c
src/compiler/nir/nir_opt_combine_stores.c
src/compiler/nir/nir_opt_copy_prop_vars.c
src/compiler/nir/nir_opt_dead_write_vars.c

index 731b129ad9789ceb976d490d620973b5893966c2..e2a6b8f274775fc12090d076c51223fffe34d6a4 100644 (file)
@@ -138,7 +138,8 @@ gather_intrinsic(struct access_state *state, nir_intrinsic_instr *instr)
       /* TODO: Could be more granular if we had nir_var_mem_image. */
       if (nir_intrinsic_memory_modes(instr) & (nir_var_mem_ubo |
                                                nir_var_mem_ssbo |
-                                               nir_var_uniform)) {
+                                               nir_var_uniform |
+                                               nir_var_mem_global)) {
          state->buffer_barriers = true;
          state->image_barriers = true;
       }
index 285a2564a95513328e5ea20326d769b2d1875ca1..106b3e5f851f94e898f4a31863d3e359affaae6c 100644 (file)
@@ -287,10 +287,11 @@ combine_stores_block(struct combine_stores_state *state, nir_block *block)
    nir_foreach_instr_safe(instr, block) {
       if (instr->type == nir_instr_type_call) {
          combine_stores_with_modes(state, nir_var_shader_out |
-                                              nir_var_shader_temp |
-                                              nir_var_function_temp |
-                                              nir_var_mem_ssbo |
-                                              nir_var_mem_shared);
+                                          nir_var_shader_temp |
+                                          nir_var_function_temp |
+                                          nir_var_mem_ssbo |
+                                          nir_var_mem_shared |
+                                          nir_var_mem_global);
          continue;
       }
 
@@ -307,12 +308,14 @@ combine_stores_block(struct combine_stores_state *state, nir_block *block)
       case nir_intrinsic_group_memory_barrier:
       case nir_intrinsic_memory_barrier:
          combine_stores_with_modes(state, nir_var_shader_out |
-                                              nir_var_mem_ssbo |
-                                              nir_var_mem_shared);
+                                          nir_var_mem_ssbo |
+                                          nir_var_mem_shared |
+                                          nir_var_mem_global);
          break;
 
       case nir_intrinsic_memory_barrier_buffer:
-         combine_stores_with_modes(state, nir_var_mem_ssbo);
+         combine_stores_with_modes(state, nir_var_mem_ssbo |
+                                          nir_var_mem_global);
          break;
 
       case nir_intrinsic_memory_barrier_shared:
index 54fbad221a7a3f382bddb7cb3285d9a314a65ea2..05bdec50f453b76ebac1489830f76d7103d47163 100644 (file)
@@ -155,7 +155,8 @@ gather_vars_written(struct copy_prop_var_state *state,
                               nir_var_shader_temp |
                               nir_var_function_temp |
                               nir_var_mem_ssbo |
-                              nir_var_mem_shared;
+                              nir_var_mem_shared |
+                              nir_var_mem_global;
             continue;
          }
 
@@ -168,7 +169,8 @@ gather_vars_written(struct copy_prop_var_state *state,
          case nir_intrinsic_memory_barrier:
             written->modes |= nir_var_shader_out |
                               nir_var_mem_ssbo |
-                              nir_var_mem_shared;
+                              nir_var_mem_shared |
+                              nir_var_mem_global;
             break;
 
          case nir_intrinsic_scoped_memory_barrier:
@@ -788,7 +790,8 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
                                          nir_var_shader_temp |
                                          nir_var_function_temp |
                                          nir_var_mem_ssbo |
-                                         nir_var_mem_shared);
+                                         nir_var_mem_shared |
+                                         nir_var_mem_global);
          if (debug) dump_copy_entries(copies);
          continue;
       }
@@ -804,13 +807,15 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
 
          apply_barrier_for_modes(copies, nir_var_shader_out |
                                          nir_var_mem_ssbo |
-                                         nir_var_mem_shared);
+                                         nir_var_mem_shared |
+                                         nir_var_mem_global);
          break;
 
       case nir_intrinsic_memory_barrier_buffer:
          if (debug) dump_instr(instr);
 
-         apply_barrier_for_modes(copies, nir_var_mem_ssbo);
+         apply_barrier_for_modes(copies, nir_var_mem_ssbo |
+                                         nir_var_mem_global);
          break;
 
       case nir_intrinsic_memory_barrier_shared:
index 0980647c63df16b628f7896ad3c7c7c4a7dc7689..6bd20db07ca8defb836318c7712e584fb6481531 100644 (file)
@@ -122,7 +122,8 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block)
                                                 nir_var_shader_temp |
                                                 nir_var_function_temp |
                                                 nir_var_mem_ssbo |
-                                                nir_var_mem_shared);
+                                                nir_var_mem_shared |
+                                                nir_var_mem_global);
          continue;
       }
 
@@ -135,12 +136,14 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block)
       case nir_intrinsic_memory_barrier: {
          clear_unused_for_modes(&unused_writes, nir_var_shader_out |
                                                 nir_var_mem_ssbo |
-                                                nir_var_mem_shared);
+                                                nir_var_mem_shared |
+                                                nir_var_mem_global);
          break;
       }
 
       case nir_intrinsic_memory_barrier_buffer:
-         clear_unused_for_modes(&unused_writes, nir_var_mem_ssbo);
+         clear_unused_for_modes(&unused_writes, nir_var_mem_ssbo |
+                                                nir_var_mem_global);
          break;
 
       case nir_intrinsic_memory_barrier_shared: