[Mesa-dev] [PATCH 17/38] i965/fs: Migrate Gen4 send dependency workarounds to the IR builder.

Francisco Jerez currojerez at riseup.net
Mon Jun 8 06:26:34 PDT 2015


Matt Turner <mattst88 at gmail.com> writes:

> On Thu, Jun 4, 2015 at 9:05 AM, Francisco Jerez <currojerez at riseup.net> wrote:
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp | 26 +++++++++-----------------
>>  src/mesa/drivers/dri/i965/brw_fs.h   |  2 +-
>>  2 files changed, 10 insertions(+), 18 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index 41015e6..e654af9 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -418,20 +418,14 @@ fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_reg &dst,
>>   * A helper for MOV generation for fixing up broken hardware SEND dependency
>>   * handling.
>>   */
>> -fs_inst *
>> -fs_visitor::DEP_RESOLVE_MOV(int grf)
>> +void
>> +fs_visitor::DEP_RESOLVE_MOV(const fs_builder &bld, int grf)
>>  {
>> -   fs_inst *inst = MOV(brw_null_reg(), fs_reg(GRF, grf, BRW_REGISTER_TYPE_F));
>> -
>> -   inst->ir = NULL;
>> -   inst->annotation = "send dependency resolve";
>> -
>>     /* The caller always wants uncompressed to emit the minimal extra
>>      * dependencies, and to avoid having to deal with aligning its regs to 2.
>>      */
>> -   inst->exec_size = 8;
>> -
>> -   return inst;
>> +   bld.annotate("send dependency resolve").half(0)
>> +      .MOV(brw_null_reg(), fs_reg(GRF, grf, BRW_REGISTER_TYPE_F));
>
> Instead of reconstructing this builder every time, shouldn't we
> construct it outside of DEP_RESOLVE_MOV? Or, maybe it doesn't matter
> because the thing we're passing as the bld argument is being
> copy-constructed anyway...
>
I guess that would save a couple of CPU cycles on Gen4, assuming that
the compiler is unable to inline DEP_RESOLVE_MOV(), at the cost of some
duplication between insert_gen4_pre_send_dependency_workarounds() and
insert_gen4_post_send_dependency_workarounds().

I doubt it will matter in practice.


>>  }
>>
>>  bool
>> @@ -3117,9 +3111,8 @@ fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,
>>         */
>>        if (block->start() == scan_inst) {
>>           for (int i = 0; i < write_len; i++) {
>> -            if (needs_dep[i]) {
>> -               inst->insert_before(block, DEP_RESOLVE_MOV(first_write_grf + i));
>> -            }
>> +            if (needs_dep[i])
>> +               DEP_RESOLVE_MOV(bld.at(block, inst), first_write_grf + i);
>>           }
>>           return;
>>        }
>> @@ -3135,7 +3128,7 @@ fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,
>>              if (reg >= first_write_grf &&
>>                  reg < first_write_grf + write_len &&
>>                  needs_dep[reg - first_write_grf]) {
>> -               inst->insert_before(block, DEP_RESOLVE_MOV(reg));
>> +               DEP_RESOLVE_MOV(bld.at(block, inst), reg);
>>                 needs_dep[reg - first_write_grf] = false;
>>                 if (scan_inst->exec_size == 16)
>>                    needs_dep[reg - first_write_grf + 1] = false;
>> @@ -3182,8 +3175,7 @@ fs_visitor::insert_gen4_post_send_dependency_workarounds(bblock_t *block, fs_ins
>>        if (block->end() == scan_inst) {
>>           for (int i = 0; i < write_len; i++) {
>>              if (needs_dep[i])
>> -               scan_inst->insert_before(block,
>> -                                        DEP_RESOLVE_MOV(first_write_grf + i));
>> +               DEP_RESOLVE_MOV(bld.at(block, scan_inst), first_write_grf + i);
>>           }
>>           return;
>>        }
>> @@ -3198,7 +3190,7 @@ fs_visitor::insert_gen4_post_send_dependency_workarounds(bblock_t *block, fs_ins
>>            scan_inst->dst.reg >= first_write_grf &&
>>            scan_inst->dst.reg < first_write_grf + write_len &&
>>            needs_dep[scan_inst->dst.reg - first_write_grf]) {
>> -         scan_inst->insert_before(block, DEP_RESOLVE_MOV(scan_inst->dst.reg));
>> +         DEP_RESOLVE_MOV(bld.at(block, scan_inst), scan_inst->dst.reg);
>>           needs_dep[scan_inst->dst.reg - first_write_grf] = false;
>>        }
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
>> index bdda9d0..5ad137b 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.h
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
>> @@ -131,7 +131,6 @@ public:
>>                  enum brw_conditional_mod condition);
>>     fs_inst *LRP(const fs_reg &dst, const fs_reg &a, const fs_reg &y,
>>                  const fs_reg &x);
>> -   fs_inst *DEP_RESOLVE_MOV(int grf);
>>     fs_inst *BFREV(const fs_reg &dst, const fs_reg &value);
>>     fs_inst *BFE(const fs_reg &dst, const fs_reg &bits, const fs_reg &offset,
>>                  const fs_reg &value);
>> @@ -159,6 +158,7 @@ public:
>>                                          const fs_reg &surf_index,
>>                                          const fs_reg &varying_offset,
>>                                          uint32_t const_offset);
>> +   void DEP_RESOLVE_MOV(const brw::fs_builder &bld, int grf);
>>
>>     bool run_fs();
>>     bool run_vs();
>> --
>> 2.3.5
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150608/d9637bf3/attachment-0001.sig>


More information about the mesa-dev mailing list