<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 10, 2015 at 10:32 AM, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Connor Abbott <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>> writes:<br>
<br>
> On Sat, Feb 7, 2015 at 12:16 AM, Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>> wrote:<br>
>> NIR instruction count results on i965:<br>
>> total instructions in shared programs: 1261954 -> 1261937 (-0.00%)<br>
>> instructions in affected programs:     455 -> 438 (-3.74%)<br>
>><br>
>> One in yofrankie, two in tropics.  Apparently i965 had also optimized all<br>
>> of these out anyway.<br>
>> ---<br>
>>  src/glsl/nir/nir_opt_cse.c | 43 +++++++++++++++++++++++++++++++++++++++----<br>
>>  1 file changed, 39 insertions(+), 4 deletions(-)<br>
>><br>
>> diff --git a/src/glsl/nir/nir_opt_cse.c b/src/glsl/nir/nir_opt_cse.c<br>
>> index b3e9c0d..55dc083 100644<br>
>> --- a/src/glsl/nir/nir_opt_cse.c<br>
>> +++ b/src/glsl/nir/nir_opt_cse.c<br>
>> @@ -80,8 +80,41 @@ nir_instrs_equal(nir_instr *instr1, nir_instr *instr2)<br>
>>        }<br>
>>        return true;<br>
>>     }<br>
>> -   case nir_instr_type_tex:<br>
>> -      return false;<br>
>> +   case nir_instr_type_tex: {<br>
>> +      nir_tex_instr *tex1 = nir_instr_as_tex(instr1);<br>
>> +      nir_tex_instr *tex2 = nir_instr_as_tex(instr2);<br>
>> +<br>
>> +      if (tex1->op != tex2->op)<br>
>> +         return false;<br>
>> +<br>
>> +      if (tex1->num_srcs != tex2->num_srcs)<br>
>> +         return false;<br>
>> +      for (unsigned i = 0; i < tex1->num_srcs; i++) {<br>
>> +         if (tex1->src[i].src_type != tex2->src[i].src_type ||<br>
>> +             !nir_srcs_equal(tex1->src[i].src, tex2->src[i].src)) {<br>
>> +            return false;<br>
>> +         }<br>
>> +      }<br>
>> +<br>
>> +      if (tex1->coord_components != tex2->coord_components ||<br>
>> +          tex1->sampler_dim != tex2->sampler_dim ||<br>
>> +          tex1->is_array != tex2->is_array ||<br>
>> +          tex1->is_shadow != tex2->is_shadow ||<br>
>> +          tex1->is_new_style_shadow != tex2->is_new_style_shadow ||<br>
>> +          memcmp(tex1->const_offset, tex2->const_offset,<br>
>> +                 sizeof(tex1->const_offset)) != 0 ||<br>
>> +          tex1->component != tex2->component ||<br>
>> +         tex1->sampler_index != tex2->sampler_index ||<br>
>> +         tex1->sampler_array_size != tex2->sampler_array_size) {<br>
><br>
> I think some of these fields are sometimes unused, so you need to<br>
> split them out and not check them if they're unused. For example,<br>
> is_new_style_shadow is only used when is_shadow is true, and component<br>
> isn't used if we're not doing a textureGather (?) op -- I don't<br>
> remember all the details. That, or we have to have a defined value for<br>
> these fields when they're unused and document that somewhere.<br>
<br>
</div></div>Oh god, we don't zero-allocate structures.  This is going to be awful.<br></blockquote><div><br></div><div>I'm all for zeroing structures btw.  However, if it's modified we may not be able to trust that it's zeroed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br></blockquote></div><br></div></div>