<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Apr 3, 2016 at 5:36 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is kind of a hack. We currently track precise/invariant<br>
requirements by decorating ir_variables. Propagating or grafting<br>
the RHS of an assignment to a precise/invariant value into some<br>
other expression tree can lose those decorations.<br></blockquote><div><br></div><div>I don't think this is needed for "invariant". The "invariant" qualifier can only be applied to outputs and we propagate it to everything used by that output so I don't think copy-prop or tree grafting can ever move an invariant thing into a non-invariant one. For "precise", this probably is needed.<br><br></div><div>One other place we may need to be careful with "invariant" and "precise" is channel expressions. I'm not 100% sure how that pass works, but if it creates new variables, we need to propagate the qualifiers to them.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the long run, it might be better to replace these ir_variable<br>
decorations with an "exact" decoration on ir_expression nodes,<br>
similar to what NIR does.<br>
<br>
In the short run, this is probably good enough. It preserves<br>
enough information for glsl_to_nir to generate "exact" decorations,<br>
and NIR will then handle optimizing these expressions reasonably.<br>
<br>
Fixes ES31-CTS.gpu_shader5.precise_qualifier.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/compiler/glsl/opt_copy_propagation.cpp | 4 +++-<br>
src/compiler/glsl/opt_copy_propagation_elements.cpp | 4 ++++<br>
src/compiler/glsl/opt_tree_grafting.cpp | 3 +++<br>
3 files changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp<br>
index 310708d..ea7fed8 100644<br>
--- a/src/compiler/glsl/opt_copy_propagation.cpp<br>
+++ b/src/compiler/glsl/opt_copy_propagation.cpp<br>
@@ -331,7 +331,9 @@ ir_copy_propagation_visitor::add_copy(ir_assignment *ir)<br>
ir->condition = new(ralloc_parent(ir)) ir_constant(false);<br>
this->progress = true;<br>
} else if (lhs_var->data.mode != ir_var_shader_storage &&<br>
- lhs_var->data.mode != ir_var_shader_shared) {<br>
+ lhs_var->data.mode != ir_var_shader_shared &&<br>
+ lhs_var->data.precise == rhs_var->data.precise &&<br>
+ lhs_var->data.invariant == rhs_var->data.invariant) {<br>
entry = new(this->acp) acp_entry(lhs_var, rhs_var);<br>
this->acp->push_tail(entry);<br>
}<br>
diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp<br>
index a679180..b1f995a 100644<br>
--- a/src/compiler/glsl/opt_copy_propagation_elements.cpp<br>
+++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp<br>
@@ -493,6 +493,10 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)<br>
}<br>
}<br>
<br>
+ if (lhs->var->data.precise != rhs->var->data.precise ||<br>
+ lhs->var->data.invariant != rhs->var->data.invariant)<br>
+ return;<br>
+<br>
entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, write_mask,<br>
swizzle);<br>
this->acp->push_tail(entry);<br>
diff --git a/src/compiler/glsl/opt_tree_grafting.cpp b/src/compiler/glsl/opt_tree_grafting.cpp<br>
index 812f996..8913102 100644<br>
--- a/src/compiler/glsl/opt_tree_grafting.cpp<br>
+++ b/src/compiler/glsl/opt_tree_grafting.cpp<br>
@@ -368,6 +368,9 @@ tree_grafting_basic_block(ir_instruction *bb_first,<br>
lhs_var->data.mode == ir_var_shader_shared)<br>
continue;<br>
<br>
+ if (lhs_var->data.precise || lhs_var->data.invariant)<br>
+ continue;<br>
+<br>
ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var);<br>
<br>
if (!entry->declaration ||<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<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>