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

Kristian Høgsberg krh at bitplanet.net
Wed Jul 9 09:08:23 PDT 2014


On Wed, Jul 9, 2014 at 8:19 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> 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 :)
>
> 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.

Or you could add something like Matts DEBUG_OPTIMIZER from brw_fs.cpp
to also cover brw_vec4.cpp.

Kristian


More information about the mesa-dev mailing list