[Mesa-stable] [Mesa-dev] [PATCH] intel: compiler: remove dead local variables at optimization pass

Jason Ekstrand jason at jlekstrand.net
Tue Sep 4 20:51:31 UTC 2018


Doesn't matter too much

On Tue, Sep 4, 2018 at 3:45 PM Andres Gomez <agomez at igalia.com> wrote:

> Lionel, should we also include this in the stable queues ?
>
>
> On Mon, 2018-09-03 at 16:47 +0100, Lionel Landwerlin wrote:
> > We're hitting an assert in gfxbench because one of the local variable
> > is a sampler (according to Jason this isn't valid) :
> >
> > testfw_app: ../src/compiler/nir_types.cpp:551: void
> glsl_get_natural_size_align_bytes(const glsl_type*, unsigned int*, unsigned
> int*): Assertion `!"type does not have a natural size"' failed.
> >
> > Since this particular variable isn't used and it can be eliminated by
> > removing unused local variables in the optimization pass. This makes
> > sense also for valid local variables.
> >
> > v2: Move additional local variable removal out of optimization loop,
> >     but before large constant removal (Jason/Lionel)
> >
> > Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> > ---
> >  src/intel/compiler/brw_nir.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > index ef5034d1e1e..8c1bcb99f8c 100644
> > --- a/src/intel/compiler/brw_nir.c
> > +++ b/src/intel/compiler/brw_nir.c
> > @@ -673,6 +673,11 @@ brw_preprocess_nir(const struct brw_compiler
> *compiler, nir_shader *nir)
> >
> >     nir = brw_nir_optimize(nir, compiler, is_scalar, true);
> >
> > +   /* Workaround Gfxbench unused local sampler variable which will
> trigger an
> > +    * assert in the opt_large_constants pass.
> > +    */
> > +   OPT(nir_remove_dead_variables, nir_var_local);
> > +
> >     /* This needs to be run after the first optimization pass but before
> we
> >      * lower indirect derefs away
> >      */
> --
> Br,
>
> Andres
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20180904/9d66f349/attachment-0001.html>


More information about the mesa-stable mailing list