[Mesa-dev] [PATCH 29/29] nir: verify destination bit size when checking algebraic optimizations
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Mon Mar 21 12:06:08 UTC 2016
Some instructions (like flrp in i965) cannot be lowered depending on the
bit size because it doesn't support all bit sizes.
If the bit size field is defined in nir_opt_algebraic.py, take it into
account.
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
src/compiler/nir/nir_algebraic.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 1818877..61a92ae 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -173,6 +173,11 @@ class SearchAndReplace(object):
else:
self.condition = 'true'
+ if len(transform) > 3:
+ self.bit_size = transform[3]
+ else:
+ self.bit_size = 0
+
if self.condition not in condition_list:
condition_list.append(self.condition)
self.condition_index = condition_list.index(self.condition)
@@ -201,6 +206,7 @@ struct transform {
const nir_search_expression *search;
const nir_search_value *replace;
unsigned condition_offset;
+ unsigned bit_size;
};
struct opt_state {
@@ -219,7 +225,7 @@ struct opt_state {
static const struct transform ${pass_name}_${opcode}_xforms[] = {
% for xform in xform_list:
- { &${xform.search.name}, ${xform.replace.c_ptr}, ${xform.condition_index} },
+ { &${xform.search.name}, ${xform.replace.c_ptr}, ${xform.condition_index}, ${xform.bit_size}},
% endfor
};
% endfor
@@ -242,6 +248,9 @@ ${pass_name}_block(nir_block *block, void *void_state)
case nir_op_${opcode}:
for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_${opcode}_xforms); i++) {
const struct transform *xform = &${pass_name}_${opcode}_xforms[i];
+ if (xform->bit_size != 0 &&
+ alu->dest.dest.ssa.bit_size != xform->bit_size)
+ continue;
if (state->condition_flags[xform->condition_offset] &&
nir_replace_instr(alu, xform->search, xform->replace,
state->mem_ctx)) {
--
2.5.0
More information about the mesa-dev
mailing list