[Mesa-dev] [PATCH] nir/algebraic: Only replace an instruction once

Jason Ekstrand jason at jlekstrand.net
Wed Jan 14 19:41:32 PST 2015


On Wed, Jan 14, 2015 at 7:27 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:

> Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
>
> Just curious, how did this come about?
>

I was running shader-db and it was segfaulting.  I'm not sure why I didn't
notice it before.  Perhaps it's because of the new optimizations you asked
me to add?  In any case, it's fixed now.
--Jason


>
> On Wed, Jan 14, 2015 at 10:15 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > Without the break, it was possible that an instruction would match
> multiple
> > expressions.  If this happened, you could end up trying to replace it
> > multiple times and get a segfault.  This makes it so that, after a
> > successful replacement, it moves on to the next instruction.
> > ---
> >  src/glsl/nir/nir_algebraic.py | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/glsl/nir/nir_algebraic.py
> b/src/glsl/nir/nir_algebraic.py
> > index 72703be..f9b246d 100644
> > --- a/src/glsl/nir/nir_algebraic.py
> > +++ b/src/glsl/nir/nir_algebraic.py
> > @@ -192,8 +192,10 @@ ${pass_name}_block(nir_block *block, void
> *void_state)
> >           for (unsigned i = 0; i <
> ARRAY_SIZE(${pass_name}_${opcode}_xforms); i++) {
> >              if (nir_replace_instr(alu,
> ${pass_name}_${opcode}_xforms[i].search,
> >
> ${pass_name}_${opcode}_xforms[i].replace,
> > -                                  state->mem_ctx))
> > +                                  state->mem_ctx)) {
> >                 state->progress = true;
> > +               break;
> > +            }
> >           }
> >           break;
> >        % endfor
> > --
> > 2.2.1
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150114/0627e9fc/attachment.html>


More information about the mesa-dev mailing list