<div dir="ltr">Cool, thanks! <br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 15, 2018 at 2:38 PM Caio Marcelo de Oliveira Filho <<a href="mailto:caio.oliveira@intel.com">caio.oliveira@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> > > > +{<br>
> > > > + bool progress = false;<br>
> > > > +<br>
> > > > + /* Find writes that are unused and can be removed. */<br>
> > > > + util_dynarray_foreach_reverse(unused_writes, struct write_entry,<br>
> > > > entry) {<br>
> > > > + nir_deref_compare_result comp = nir_compare_derefs(dst,<br>
> > entry->dst);<br>
> > > > + if (comp & nir_derefs_a_contains_b_bit) {<br>
> > > ><br>
> > ><br>
> > > Mind throwing an assert in here:<br>
> > ><br>
> > > assert((comp & nir_derefs_equal_bit) || mask ==<br>
> > ~(nir_component_mask_t)0);<br>
> ><br>
> > We can assert that. We can have an entry for a copy between arrays a<br>
> > and b, and see a store a[1].x that will invalidate the 'x' component<br>
> > of the copy.<br>
> ><br>
> <br>
> Do you mean, "we can't assert that"?<br>
<br>
Correct. I meant "we can't".<br>
<br>
<br>
> I'm trying to think about whether or not the type of per-component<br>
> invalidation you're talking about there is valid or not. If we can assume<br>
> that all struct copies are split and that all copies are fully qualified<br>
> (i.e., they end in a vector or scalar with wildcards for all the arrays),<br>
> then I think such inference is fine. Maybe worth a comment that such is<br>
> intentional?<br>
<br>
I've added the following comment and assert to update_unused_writes()<br>
<br>
/* This pass assumes that destination of copies and stores are derefs that<br>
* end in a vector or scalar (it is OK to have wildcards or indirects for<br>
* arrays).<br>
*/<br>
assert(glsl_type_is_vector_or_scalar(dst->type));<br>
<br>
My understanding is that in this context this always is true, but in<br>
the future might not be if we do things like: "copy a b" instead of<br>
"copy a[*] b[*]" when a and b are arrays (similar to structs).<br>
<br>
Updated my branch with that too.<br>
<br>
<br>
<br>
Caio<br>
</blockquote></div>