<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 26, 2016 at 8:46 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">This prevents false dependencies from being created between<br>
instructions that write disjoint 8-bit portions of the flag register<br>
and OTOH should make sure that the scheduler considers dependencies<br>
between instructions that write or read multiple flag subregisters<br>
at once (e.g. 32-wide predication or conditional mods).<br>
---<br>
 .../drivers/dri/i965/brw_schedule_instructions.cpp | 41 ++++++++++++++++------<br>
 1 file changed, 31 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp<br>
index d40cbbd..b7ef151 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp<br>
@@ -912,7 +912,7 @@ fs_instruction_scheduler::calculate_deps()<br>
     */<br>
    schedule_node *last_grf_write[grf_count * 16];<br>
    schedule_node *last_mrf_write[BRW_MAX_MRF(v->devinfo->gen)];<br>
-   schedule_node *last_conditional_mod[2] = { NULL, NULL };<br>
+   schedule_node *last_conditional_mod[4] = {};<br>
    schedule_node *last_accumulator_write = NULL;<br>
    /* Fixed HW registers are assumed to be separate from the virtual<br>
     * GRFs, so they can be tracked separately.  We don't really write<br>
@@ -966,8 +966,13 @@ fs_instruction_scheduler::calculate_deps()<br>
          }<br>
       }<br>
<br>
-      if (inst->reads_flag()) {<br>
-         add_dep(last_conditional_mod[inst->flag_subreg], n);<br>
+      if (const uint32_t mask = inst->flags_read(v->devinfo)) {<br></blockquote><div><br></div><div>If we switch to a uint8_t, this should change too along with the other 3 below.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         assert(mask < (1 << ARRAY_SIZE(last_conditional_mod)));<br>
+<br>
+         for (unsigned i = 0; i < ARRAY_SIZE(last_conditional_mod); i++) {<br>
+            if (mask & (1 << i))<br>
+               add_dep(last_conditional_mod[i], n);<br>
+         }<br>
       }<br>
<br>
       if (inst->reads_accumulator_implicitly()) {<br>
@@ -1021,9 +1026,15 @@ fs_instruction_scheduler::calculate_deps()<br>
          }<br>
       }<br>
<br>
-      if (inst->writes_flag()) {<br>
-         add_dep(last_conditional_mod[inst->flag_subreg], n, 0);<br>
-         last_conditional_mod[inst->flag_subreg] = n;<br>
+      if (const uint32_t mask = inst->flags_written()) {<br>
+         assert(mask < (1 << ARRAY_SIZE(last_conditional_mod)));<br>
+<br>
+         for (unsigned i = 0; i < ARRAY_SIZE(last_conditional_mod); i++) {<br>
+            if (mask & (1 << i)) {<br>
+               add_dep(last_conditional_mod[i], n, 0);<br>
+               last_conditional_mod[i] = n;<br>
+            }<br>
+         }<br>
       }<br>
<br>
       if (inst->writes_accumulator_implicitly(v->devinfo) &&<br>
@@ -1078,8 +1089,13 @@ fs_instruction_scheduler::calculate_deps()<br>
          }<br>
       }<br>
<br>
-      if (inst->reads_flag()) {<br>
-         add_dep(n, last_conditional_mod[inst->flag_subreg]);<br>
+      if (const uint32_t mask = inst->flags_read(v->devinfo)) {<br>
+         assert(mask < (1 << ARRAY_SIZE(last_conditional_mod)));<br>
+<br>
+         for (unsigned i = 0; i < ARRAY_SIZE(last_conditional_mod); i++) {<br>
+            if (mask & (1 << i))<br>
+               add_dep(n, last_conditional_mod[i]);<br>
+         }<br>
       }<br>
<br>
       if (inst->reads_accumulator_implicitly()) {<br>
@@ -1130,8 +1146,13 @@ fs_instruction_scheduler::calculate_deps()<br>
          }<br>
       }<br>
<br>
-      if (inst->writes_flag()) {<br>
-         last_conditional_mod[inst->flag_subreg] = n;<br>
+      if (const uint32_t mask = inst->flags_written()) {<br>
+         assert(mask < (1 << ARRAY_SIZE(last_conditional_mod)));<br>
+<br>
+         for (unsigned i = 0; i < ARRAY_SIZE(last_conditional_mod); i++) {<br>
+            if (mask & (1 << i))<br>
+               last_conditional_mod[i] = n;<br>
+         }<br>
       }<br>
<br>
       if (inst->writes_accumulator_implicitly(v->devinfo)) {<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>