On Tue, Mar 10, 2015 at 4:18 AM, Kenneth Graunke <kenn...@whitecape.org> wrote: > This especially helps with NIR because we currently emit MOVs at the top > of the shader to copy from various ATTR registers to a giant VGRF array > of all inputs. (This could potentially be done better, but since > there's only ever one write to each register, it should be trivial to > copy propagate away...) > > With NIR - only vertex shaders: > total instructions in shared programs: 3083505 -> 2868128 (-6.98%) > instructions in affected programs: 2977237 -> 2761860 (-7.23%) > helped: 18653 > > Without NIR - only vertex shaders: > total instructions in shared programs: 2724564 -> 2708831 (-0.58%) > instructions in affected programs: 593696 -> 577963 (-2.65%) > helped: 3134 > > Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> > --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 1 + > src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 5 ++++- > 2 files changed, 5 insertions(+), 1 deletion(-) > > No apparent Piglit regressions. Please scrutinize though, I spent very > little actual thought on this, so I may have missed something stupid. > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index 9a415ff..6fa90d2 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -3235,6 +3235,7 @@ fs_visitor::lower_load_payload() > * destination may be used. > */ > assert(inst->src[i].file == IMM || > + inst->src[i].file == ATTR ||
I don't really like this. However, I think it's the best we can do at the moment. Let's go with it for now. Reviewed-by: Jason Ekstrand <jason.ekstr...@intel.com> > inst->src[i].file == UNIFORM); > mov->force_writemask_all = true; > } > diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp > b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp > index 764741d..56f4fa1 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp > @@ -283,7 +283,8 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, > acp_entry *entry) > > if (entry->src.file == IMM) > return false; > - assert(entry->src.file == GRF || entry->src.file == UNIFORM); > + assert(entry->src.file == GRF || entry->src.file == UNIFORM || > + entry->src.file == ATTR); > > if (entry->opcode == SHADER_OPCODE_LOAD_PAYLOAD && > inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) > @@ -382,6 +383,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, > acp_entry *entry) > inst->src[arg].reg_offset = entry->src.reg_offset; > inst->src[arg].subreg_offset = entry->src.subreg_offset; > break; > + case ATTR: > case GRF: > { > assert(entry->src.width % inst->src[arg].width == 0); > @@ -598,6 +600,7 @@ can_propagate_from(fs_inst *inst) > ((inst->src[0].file == GRF && > (inst->src[0].reg != inst->dst.reg || > inst->src[0].reg_offset != inst->dst.reg_offset)) || > + inst->src[0].file == ATTR || > inst->src[0].file == UNIFORM || > inst->src[0].file == IMM) && > inst->src[0].type == inst->dst.type && > -- > 2.2.1 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev