<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Sat, Sep 15, 2018 at 12:45 AM Caio Marcelo de Oliveira Filho <<a href="mailto:caio.oliveira@intel.com">caio.oliveira@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Calls are not used yet (functions are inlined), but since new code is<br>
already taking them into account, do it here too.  The convention here<br>
and in other places is that no writable memory is assumed to remain<br>
unchanged, as well as global variables.<br>
<br>
Also, explicitly state the modes affected (instead of using the<br>
reverse logic) in one of the apply_for_barrier_modes calls.<br>
<br>
Suggested (indirectly) by Jason.<br>
---<br>
<br>
Jason suggested this for the other pass, so doing this here too.<br>
<br>
 src/compiler/nir/nir_opt_copy_prop_vars.c | 17 +++++++++++------<br>
 1 file changed, 11 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c<br>
index 5276aa176d8..f58abfbb69f 100644<br>
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c<br>
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c<br>
@@ -404,6 +404,14 @@ copy_prop_vars_block(struct copy_prop_var_state *state,<br>
       copy_entry_remove(state, iter);<br>
<br>
    nir_foreach_instr_safe(instr, block) {<br>
+      if (instr->type == nir_instr_type_call) {<br>
+         apply_barrier_for_modes(copies, nir_var_shader_out |<br>
+                                         nir_var_global |<br>
+                                         nir_var_shader_storage |<br>
+                                         nir_var_shared);<br></blockquote><div><br></div><div>As I commented on the dead writes, pass, I think locals should be included here.  Other than that,</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         continue;<br>
+      }<br>
+<br>
       if (instr->type != nir_instr_type_intrinsic)<br>
          continue;<br>
<br>
@@ -411,12 +419,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,<br>
       switch (intrin->intrinsic) {<br>
       case nir_intrinsic_barrier:<br>
       case nir_intrinsic_memory_barrier:<br>
-         /* If we hit a barrier, we need to trash everything that may possibly<br>
-          * be accessible to another thread.  Locals, globals, and things of<br>
-          * the like are safe, however.<br>
-          */<br>
-         apply_barrier_for_modes(state, ~(nir_var_local | nir_var_global |<br>
-                                          nir_var_shader_in | nir_var_uniform));<br>
+         apply_barrier_for_modes(copies, nir_var_shader_out |<br>
+                                         nir_var_shader_storage |<br>
+                                         nir_var_shared);<br></blockquote><div><br></div><div>Yeah, this is better.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          break;<br>
<br>
       case nir_intrinsic_emit_vertex:<br>
-- <br>
2.19.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>