[Mesa-dev] [PATCH 7/9] i965/fs: Restrict optimization that would fail for gen7's SENDs from GRFs

Eric Anholt eric at anholt.net
Mon Nov 26 10:22:05 PST 2012


Kenneth Graunke <kenneth at whitecape.org> writes:

> On 11/12/2012 10:53 AM, Eric Anholt wrote:
>> -      bool has_source_modifiers = inst->src[0].abs || inst->src[0].negate;
>> +      bool has_source_modifiers = (inst->src[0].abs ||
>> +                                   inst->src[0].negate ||
>> +                                   inst->src[0].file == UNIFORM);
>>
>>         /* Found a move of a GRF to a GRF.  Let's see if we can coalesce
>>          * them: check for no writes to either one until the exit of the
>> @@ -1611,10 +1631,8 @@ fs_visitor::register_coalesce()
>>   	  * unusual register regions, so avoid coalescing those for
>>   	  * now.  We should do something more specific.
>>   	  */
>> -	 if (intel->gen >= 6 &&
>> -	     scan_inst->is_math() &&
>> -	     (has_source_modifiers || inst->src[0].file == UNIFORM)) {
>> -	    interfered = true;
>> +	 if (has_source_modifiers && !can_do_source_mods(inst)) {
>> +            interfered = true;
>>   	    break;
>>   	 }
>
> This looks like it'll prevent MATH on uniforms for Gen6.  As far as I 
> know, that's allowed, so I'd rather not lose that...

See this existing comment:

   /* Can't do hstride == 0 args to gen6 math, so expand it out.  We
    * might be able to do better by doing execsize = 1 math and then
    * expanding that result out, but we would need to be careful with
    * masking.
    *
    * Gen 6 hardware ignores source modifiers (negate and abs) on math
    * instructions, so we also move to a temp to set those up.
    */

uniforms are hstride == 0.

> Also, there's another subtle change here: >= 6 becomes == 6.  In other 
> words, we begin allowing source modifiers on Gen7+.  This is correct, 
> but I'd really love to see it in a separate 1-line patch for the sake of 
> bisectability.  (Call me paranoid, but that's the sort of thing that can 
> lead to bizarre failures in obscure cases...)

I'll split it out.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121126/4397be8d/attachment.pgp>


More information about the mesa-dev mailing list