[Mesa-dev] i965: overwriting parts of a register and optimization passes

Iago Toral itoral at igalia.com
Wed Jul 9 23:03:04 PDT 2014


Hi Kenneth,

El 2014-07-09 17:19, Kenneth Graunke escribió:
> On Tuesday, July 08, 2014 11:19:38 AM Iago Toral wrote:
> 
>> Hi,
> 
>> 
> 
>> I have some code that first initializes a register and then
> overwrites a
> 
>> specific subregister. However, after the optimization passes in
> 
>> brw_vec4.cpp the initialization instruction goes away. I see that
> live
> 
>> intervals are computed for the destination register without
> considering
> 
>> if we are writing only to a specific subregister, so I guess that is
> the
> 
>> reason for this behaviour, but this strikes me as odd, as it defeats
> the
> 
>> purpose of overwriting only specific subregs, so I guess there is
> 
>> something else that I am missing.
> 
>> 
> 
>> This an example of what is happening:
> 
>> 
> 
>> mov(8) g6<1>.xUD g0<4,4,1>UD {
> 
>> align16 WE_all 1Q };
> 
>> mov(1) g6.2<1>UD 0x00000007UD { align1
> 
>> WE_all compacted };
> 
>> 
> 
>> The first MOV is removed from the instruction set when I put the
> second
> 
>> MOV, however the second MOV should only be writing to subreg 6.2 and
> 
> 
>> keep the rest of register 6 intact, or at least that is what I am
> trying
> 
>> to do...
> 
>> 
> 
>> Can someone explain what is wrong with those two instructions? how
> 
>> should I overwrite only a specific subregister without causing this
> 
>> behavior?
> 
>> 
> 
>> Thanks,
> 
>> Iago
> 
> This sounds a lot like the bug I fixed in:
> 
> commit d0575d98fc595dcc17706dc73d1eb461027ca17a
> 
> Author: Kenneth Graunke <kenneth at whitecape.org>
> 
> Date: Sat Jun 14 03:53:07 2014 -0700
> 
>  i965/vec4: Fix dead code elimination for VGRFs of size > 1.
> 
> where it would see those two as the same register, and delete the
> first MOV.
> 
> You probably already have that in your tree though, right? If not,
> update :)

Yeah, I have it already, so I guess my problem was different.

> If so, you might try turning off other optimization passes in
> brw_vec4.cpp and see if it helps - sounds like a bug in one of them.

The one causing that behaviour was the dead code elimination pass in 
brw_vec4.cpp. Anyway, this is not happening consistently, I have done 
some changes to my code that are unrelated to these two instructions and 
now this is not happening any more...

Iago


More information about the mesa-dev mailing list