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

Kenneth Graunke kenneth at whitecape.org
Wed Jul 9 08:19:39 PDT 2014


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.

--Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140709/8935ca25/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140709/8935ca25/attachment.sig>


More information about the mesa-dev mailing list