intel/fs/bank_conflicts: Don't touch Gen7 MRF hack registers.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 12 Dec 2017 04:24:53 +0000 (20:24 -0800)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 12 Dec 2017 20:05:45 +0000 (12:05 -0800)
Fixes: af2c320190f3c731 "intel/fs: Implement GRF bank conflict mitigation pass."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104199
Reported-by: Darius Spitznagel <d.spitznagel@goodbytez.de>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_fs.h
src/intel/compiler/brw_fs_bank_conflicts.cpp

index 0e3ab381fa65d226b2614038760d5b195b730bad..3717c50e32af0f268aad933b74da9c4800b2065f 100644 (file)
@@ -945,7 +945,7 @@ fs_inst::flags_written() const
  * instruction -- the FS opcodes often generate MOVs in addition.
  */
 int
-fs_visitor::implied_mrf_writes(fs_inst *inst)
+fs_visitor::implied_mrf_writes(fs_inst *inst) const
 {
    if (inst->mlen == 0)
       return 0;
index 9c160068a7e5a31cb29d4d7acf239f9f8fe73064..63373580ee4bd0fd9c655b15c35ecb7b177ec2ea 100644 (file)
@@ -277,7 +277,7 @@ public:
 
    struct brw_reg interp_reg(int location, int channel);
 
-   int implied_mrf_writes(fs_inst *inst);
+   int implied_mrf_writes(fs_inst *inst) const;
 
    virtual void dump_instructions();
    virtual void dump_instructions(const char *name);
index 42cdc6ef7dcce4bd0d439c1869756c6ed33ad36a..0cd880d44f2d086905a320285178c9e2be1fb6b7 100644 (file)
@@ -530,12 +530,12 @@ namespace {
       for (unsigned reg = 0; reg < 2; reg++)
          constrained[p.atom_of_reg(reg)] = true;
 
-      /* Assume that anything referenced via fixed GRFs is baked into the
-       * hardware's fixed-function logic and may be unsafe to move around.
-       * Also take into account the source GRF restrictions of EOT
-       * send-message instructions.
-       */
       foreach_block_and_inst(block, fs_inst, inst, v->cfg) {
+         /* Assume that anything referenced via fixed GRFs is baked into the
+          * hardware's fixed-function logic and may be unsafe to move around.
+          * Also take into account the source GRF restrictions of EOT
+          * send-message instructions.
+          */
          if (inst->dst.file == FIXED_GRF)
             constrained[p.atom_of_reg(reg_of(inst->dst))] = true;
 
@@ -544,6 +544,18 @@ namespace {
                 (is_grf(inst->src[i]) && inst->eot))
                constrained[p.atom_of_reg(reg_of(inst->src[i]))] = true;
          }
+
+         /* The location of the Gen7 MRF hack registers is hard-coded in the
+          * rest of the compiler back-end.  Don't attempt to move them around.
+          */
+         if (v->devinfo->gen >= 7) {
+            assert(inst->dst.file != MRF);
+
+            for (int i = 0; i < v->implied_mrf_writes(inst); i++) {
+               const unsigned reg = GEN7_MRF_HACK_START + inst->base_mrf + i;
+               constrained[p.atom_of_reg(reg)] = true;
+            }
+         }
       }
 
       return constrained;