[Mesa-dev] [PATCH] intel/fs: Don't emit a des copy for image ops with has_dest == false

Rob Clark robdclark at gmail.com
Tue Mar 27 23:41:16 UTC 2018


On Tue, Mar 27, 2018 at 7:35 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 03/27/2018 04:29 PM, Jason Ekstrand wrote:
>> This was causing us to walk dest_components times over a thing with no
>> destination.  This happened to work because all of the image intrinsics
>> without a destination also happened to have dest_components == 0.  We
>> shouldn't be reading dest_components if has_dest == false.
>
> I'm assuming we want this fix in addition to the other change to
> nir_intrinsics_c.py?  I haven't tested this yet, but, based on the
> discussion on IRC, I suspect this will fix my shader-db problem on its
> own.  Give me a couple minutes...
>

probably we want the nir_intrinsics_c.py patch either way, just in
case there are any other surprises like this.

I think a nir_intr_get_dest_components() helper is probably a good
idea going forward.. but probably safest to also push the .py patch
for now

BR,
-R

>> ---
>>  src/intel/compiler/brw_fs_nir.cpp | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
>> index f5d5399..8d1c387 100644
>> --- a/src/intel/compiler/brw_fs_nir.cpp
>> +++ b/src/intel/compiler/brw_fs_nir.cpp
>> @@ -3848,9 +3848,11 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
>>                                   get_image_atomic_op(instr->intrinsic, type));
>>
>>        /* Assign the result. */
>> -      for (unsigned c = 0; c < info->dest_components; ++c)
>> -         bld.MOV(offset(retype(dest, base_type), bld, c),
>> -                 offset(tmp, bld, c));
>> +      if (nir_intrinsic_infos[instr->intrinsic].has_dest) {
>> +         for (unsigned c = 0; c < info->dest_components; ++c)
>> +            bld.MOV(offset(retype(dest, base_type), bld, c),
>> +                    offset(tmp, bld, c));
>> +      }
>>        break;
>>     }
>>
>>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list