<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 27, 2016 at 7:06 PM, Francisco Jerez <span dir="ltr"><<a href="mailto:currojerez@riseup.net" target="_blank">currojerez@riseup.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We know that there cannot be any destination dependency race if we<br>
reach the beginning or end of the program without having found any<br>
other instruction the send could possibly race with.  This avoids<br>
emitting a pile of useless moves at the beginning or end of the<br>
program in the most common case in which the program has a single<br>
basic block only.<br>
<br>
On the original i965 I get the following shader-db results:<br>
<br>
 total instructions in shared programs: 3354165 -> 3215637 (-4.13%)<br>
 instructions in affected programs: 3183065 -> 3044537 (-4.35%)<br>
 helped: 13498<br>
 HURT: 0<br></blockquote><div><br></div><div>Nice!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
---<br>
 src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++--<br>
 1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
index 660a8db..bfde69c 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
@@ -3210,7 +3210,7 @@ fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,<br>
       /* If we hit control flow, assume that there *are* outstanding<br>
        * dependencies, and force their cleanup before our instruction.<br>
        */<br>
-      if (block->start() == scan_inst) {<br>
+      if (block->start() == scan_inst && block->num != 0) {<br></blockquote><div><br></div><div>Yes, hitting the top of the program does *not* count as control flow.  Good work us!<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          for (int i = 0; i < write_len; i++) {<br>
             if (needs_dep[i])<br>
                DEP_RESOLVE_MOV(fs_builder(this, block, inst),<br>
@@ -3274,7 +3274,7 @@ fs_visitor::insert_gen4_post_send_dependency_workarounds(bblock_t *block, fs_ins<br>
     */<br>
    foreach_inst_in_block_starting_from(fs_inst, scan_inst, inst) {<br>
       /* If we hit control flow, force resolve all remaining dependencies. */<br>
-      if (block->end() == scan_inst) {<br>
+      if (block->end() == scan_inst && block->num != cfg->num_blocks - 1) {<br>
          for (int i = 0; i < write_len; i++) {<br>
             if (needs_dep[i])<br>
                DEP_RESOLVE_MOV(fs_builder(this, block, scan_inst),<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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>
</font></span></blockquote></div><br></div></div>