From acab52f5201683ec3f3698d25045ed1441ecdd14 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. Fixes: af2c320190f3c731 "intel/fs: Implement GRF bank conflict mitigation pass." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104199 Reported-by: Darius Spitznagel Reviewed-by: Matt Turner --- 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 0e3ab381fa6..3717c50e32a 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 9c160068a7e..63373580ee4 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 42cdc6ef7dc..0cd880d44f2 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.30.2