From 1ae3bf32ffe93f9aefc53b89c82b69c557b6f9ec Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Mon, 11 Dec 2017 20:24:53 -0800 Subject: [PATCH] intel/fs/bank_conflicts: Don't touch Gen7 MRF hack registers. --- src/intel/compiler/brw_fs.cpp | 2 +- src/intel/compiler/brw_fs.h | 2 +- src/intel/compiler/brw_fs_bank_conflicts.cpp | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index c5d4f5634d..19e5cd7e05 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -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; diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index 9c160068a7..63373580ee 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -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); diff --git a/src/intel/compiler/brw_fs_bank_conflicts.cpp b/src/intel/compiler/brw_fs_bank_conflicts.cpp index 42cdc6ef7d..0cd880d44f 100644 --- a/src/intel/compiler/brw_fs_bank_conflicts.cpp +++ b/src/intel/compiler/brw_fs_bank_conflicts.cpp @@ -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; -- 2.14.3