Matt Turner <matts...@gmail.com> writes:

> On Fri, Feb 6, 2015 at 6:43 AM, Francisco Jerez <curroje...@riseup.net> wrote:
>> ---
>>  src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp 
>> b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
>> index 9604e60..5df0d31 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
>> @@ -122,7 +122,8 @@ vec4_visitor::dead_code_eliminate()
>>              }
>>           }
>>
>> -         if (inst->dst.file == GRF && !inst->predicate) {
>> +         if (inst->dst.file == GRF && !inst->predicate &&
>> +             inst->regs_written == alloc.sizes[inst->dst.reg]) {
>>              for (int c = 0; c < 4; c++) {
>>                 if (inst->dst.writemask & (1 << c)) {
>>                    int var = inst->dst.reg * 4 + c;
>> --
>> 2.1.3
>
> I think what you're saying is that if an instruction wrote less than
> the size of the destination register we would incorrectly mark it as
> entirely overwritten?
>
Yes, exactly.

> I'm not reading the code that way. It looks like we're just marking
> individual channels (i.e., channels of the writemask) as dead. I don't
> see, for example, us using the size of the destination register
> anywhere in the loop.
>
> How you triggered this, again, would be helpful.

The problem is that the current dead code elimination code doesn't take
into account that VGRFs could be larger than one register (and, ugh,
neither does the VEC4 live interval calculation code), so it will think
that a value spanning several registers is dead after any of the
registers is overwritten.

I started fixing the live intervals code and got distracted by something
higher-priority while I was in the middle of fixing the million
assumptions I broke by changing the granularity of the intervals.  In
the meantime this should keep dead code eliminate from eliminating live
instructions that write to several registers.

Attachment: pgpIX_Ej2wYNq.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to