Mesa (master): i965/fs: Allow SIMD16 on pre-SNB when try_replace_with_sel is successful
Ian Romanick
idr at kemper.freedesktop.org
Sat Jan 24 01:35:36 UTC 2015
Module: Mesa
Branch: master
Commit: f02f1af9f7582bc9ca685ef240751aa57ce42638
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f02f1af9f7582bc9ca685ef240751aa57ce42638
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Fri Jan 23 12:31:05 2015 -0800
i965/fs: Allow SIMD16 on pre-SNB when try_replace_with_sel is successful
If try_replace_with_sel is able to replace the flow control with a SEL
instruction, then there is no flow control... failing SIMD16 because
of nonexistent flow control is wrong.
No piglit regressions on any i965 platform in Jenkins.
total instructions in shared programs: 4382707 -> 4382707 (0.00%)
instructions in affected programs: 0 -> 0
helped: 0
HURT: 0
GAINED: 2089
LOST: 0
No other platforms affected in shader-db.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 8 +++-----
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 16 +++++++++-------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 1de10bb..419fe48 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -535,7 +535,7 @@ public:
bool try_emit_saturate(ir_expression *ir);
bool try_emit_line(ir_expression *ir);
bool try_emit_mad(ir_expression *ir);
- void try_replace_with_sel();
+ bool try_replace_with_sel();
bool opt_peephole_sel();
bool opt_peephole_predicated_break();
bool opt_saturate_propagation();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 0eb137f..de0d780 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -435,10 +435,6 @@ fs_visitor::nir_emit_cf_list(exec_list *list)
void
fs_visitor::nir_emit_if(nir_if *if_stmt)
{
- if (brw->gen < 6) {
- no16("Can't support (non-uniform) control flow on SIMD16\n");
- }
-
/* first, put the condition into f0 */
fs_inst *inst = emit(MOV(reg_null_d,
retype(get_nir_src(if_stmt->condition),
@@ -456,7 +452,9 @@ fs_visitor::nir_emit_if(nir_if *if_stmt)
emit(BRW_OPCODE_ENDIF);
- try_replace_with_sel();
+ if (!try_replace_with_sel() && brw->gen < 6) {
+ no16("Can't support (non-uniform) control flow on SIMD16\n");
+ }
}
void
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 9805b55..f5d7383 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2741,7 +2741,7 @@ fs_visitor::emit_if_gen6(ir_if *ir)
*
* If src0 is an immediate value, we promote it to a temporary GRF.
*/
-void
+bool
fs_visitor::try_replace_with_sel()
{
fs_inst *endif_inst = (fs_inst *) instructions.get_tail();
@@ -2755,7 +2755,7 @@ fs_visitor::try_replace_with_sel()
fs_inst *match = (fs_inst *) endif_inst->prev;
for (int i = 0; i < 4; i++) {
if (match->is_head_sentinel() || match->opcode != opcodes[4-i-1])
- return;
+ return false;
match = (fs_inst *) match->prev;
}
@@ -2797,16 +2797,16 @@ fs_visitor::try_replace_with_sel()
sel->predicate = if_inst->predicate;
sel->predicate_inverse = if_inst->predicate_inverse;
}
+
+ return true;
}
+
+ return false;
}
void
fs_visitor::visit(ir_if *ir)
{
- if (brw->gen < 6) {
- no16("Can't support (non-uniform) control flow on SIMD16\n");
- }
-
/* Don't point the annotation at the if statement, because then it plus
* the then and else blocks get printed.
*/
@@ -2836,7 +2836,9 @@ fs_visitor::visit(ir_if *ir)
emit(BRW_OPCODE_ENDIF);
- try_replace_with_sel();
+ if (!try_replace_with_sel() && brw->gen < 6) {
+ no16("Can't support (non-uniform) control flow on SIMD16\n");
+ }
}
void
More information about the mesa-commit
mailing list