[Mesa-dev] [PATCH 07/12] i965/fs: Use the var_from_vgrf helper function instead of doing it manually

Jason Ekstrand jason at jlekstrand.net
Fri Sep 19 20:14:04 PDT 2014


On Fri, Sep 19, 2014 at 5:16 PM, Matt Turner <mattst88 at gmail.com> wrote:

> On Fri, Sep 19, 2014 at 1:10 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> > ---
> >  src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> > index 697b44a..036875f 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> > @@ -58,7 +58,7 @@ fs_visitor::dead_code_eliminate()
> >                 int var = live_intervals->var_from_reg(&inst->dst);
> >                 result_live = BITSET_TEST(live, var);
> >              } else {
> > -               int var = live_intervals->var_from_vgrf[inst->dst.reg];
> > +               int var = live_intervals->var_from_reg(&inst->dst);
> >                 for (int i = 0; i < inst->regs_written; i++) {
> >                    result_live = result_live || BITSET_TEST(live, var +
> i);
>
> This is wrong, isn't it? Before we get the base var and iterate 0
> through regs_written. After we're getting the var of the
> register+offset and then iterating.
>

No, in fact this hunk is what prompted me to make the change.  If we write
to vgrf3+2.0, then the previous version would tacitly assume that the
offset is 0 and treat it as if we were writing to vgrf3+0.0.


>
> >                 }
> > @@ -78,19 +78,19 @@ fs_visitor::dead_code_eliminate()
> >
> >           if (inst->dst.file == GRF) {
> >              if (!inst->is_partial_write()) {
> > -               int var = live_intervals->var_from_vgrf[inst->dst.reg];
> > +               int var = live_intervals->var_from_reg(&inst->dst);
> >                 for (int i = 0; i < inst->regs_written; i++) {
> > -                  BITSET_CLEAR(live, var + inst->dst.reg_offset + i);
> > +                  BITSET_CLEAR(live, var + i);
> >                 }
>
> This hunk seems fine.
>
> >              }
> >           }
> >
> >           for (int i = 0; i < inst->sources; i++) {
> >              if (inst->src[i].file == GRF) {
> > -               int var =
> live_intervals->var_from_vgrf[inst->src[i].reg];
> > +               int var = live_intervals->var_from_reg(&inst->src[i]);
> >
> >                 for (int j = 0; j < inst->regs_read(this, i); j++) {
> > -                  BITSET_SET(live, var + inst->src[i].reg_offset + j);
> > +                  BITSET_SET(live, var + j);
>
> I think this is also fine.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140919/39e97cd5/attachment.html>


More information about the mesa-dev mailing list