Mesa (master): i965: Don't set the "switch" flag on control flow instructions on Gen6+.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Jun 10 23:39:04 UTC 2014


Module: Mesa
Branch: master
Commit: 000f4a33c0359ed6b3c11aafa5f0cba1d6d91fea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=000f4a33c0359ed6b3c11aafa5f0cba1d6d91fea

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Dec 12 18:01:00 2012 -0800

i965: Don't set the "switch" flag on control flow instructions on Gen6+.

Thread switching on control flow instructions is a documented workaround
for Gen4-5 errata.  As far as I can tell, it hasn't been needed since
Sandybridge.  Thread switching is not free, so in theory this may help
performance slightly.

Flow control instructions with the "switch" flag cannot be compacted, so
removing it will make these instructions compactable.  (Of course, we
still have to implement compaction for flow control instructions...)

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_eu_emit.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 06baebf..6b2117d 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -1267,7 +1267,7 @@ brw_IF(struct brw_compile *p, unsigned execute_size)
    insn->header.compression_control = BRW_COMPRESSION_NONE;
    insn->header.predicate_control = BRW_PREDICATE_NORMAL;
    insn->header.mask_control = BRW_MASK_ENABLE;
-   if (!p->single_program_flow)
+   if (!p->single_program_flow && brw->gen < 6)
       insn->header.thread_control = BRW_THREAD_SWITCH;
 
    push_if_stack(p, insn);
@@ -1300,9 +1300,6 @@ gen6_IF(struct brw_compile *p, uint32_t conditional,
    assert(insn->header.predicate_control == BRW_PREDICATE_NONE);
    insn->header.destreg__conditionalmod = conditional;
 
-   if (!p->single_program_flow)
-      insn->header.thread_control = BRW_THREAD_SWITCH;
-
    push_if_stack(p, insn);
    return insn;
 }
@@ -1464,7 +1461,7 @@ brw_ELSE(struct brw_compile *p)
 
    insn->header.compression_control = BRW_COMPRESSION_NONE;
    insn->header.mask_control = BRW_MASK_ENABLE;
-   if (!p->single_program_flow)
+   if (!p->single_program_flow && brw->gen < 6)
       insn->header.thread_control = BRW_THREAD_SWITCH;
 
    push_if_stack(p, insn);
@@ -1534,7 +1531,8 @@ brw_ENDIF(struct brw_compile *p)
 
    insn->header.compression_control = BRW_COMPRESSION_NONE;
    insn->header.mask_control = BRW_MASK_ENABLE;
-   insn->header.thread_control = BRW_THREAD_SWITCH;
+   if (brw->gen < 6)
+      insn->header.thread_control = BRW_THREAD_SWITCH;
 
    /* Also pop item off the stack in the endif instruction: */
    if (brw->gen < 6) {




More information about the mesa-commit mailing list