[Mesa-dev] [PATCH] nir: fix an assertion for 16-bit integers in nir_imm_intN_t()

Jason Ekstrand jason at jlekstrand.net
Mon Nov 19 15:44:42 UTC 2018


agreed.

On Mon, Nov 19, 2018 at 5:57 AM Connor Abbott <cwabbott0 at gmail.com> wrote:

> This will cause the assert to pass when it shouldn't in some cases
> with a 32-bit bitsize, and seems like a hack since it's subverting the
> point of the assert, which is guarantee that we won't lose any
> information by truncating the source. It would be better to fix the
> caller that's hitting the assert, and maybe change the argument to be
> a int64_t too.
> On Mon, Nov 19, 2018 at 10:38 AM Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
> >
> > Fixes dEQP-VK.spirv_assembly.type.scalar.i16.*
> >
> > Fixes: 1f29f4db1e ("nir/builder: Assert that intN_t immediates fit")
> > Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> > ---
> >  src/compiler/nir/nir_builder.h | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/compiler/nir/nir_builder.h
> b/src/compiler/nir/nir_builder.h
> > index e37aba23dc..1f29209157 100644
> > --- a/src/compiler/nir/nir_builder.h
> > +++ b/src/compiler/nir/nir_builder.h
> > @@ -332,7 +332,8 @@ nir_imm_intN_t(nir_builder *build, uint64_t x,
> unsigned bit_size)
> >
> >     assert(bit_size == 64 ||
> >            (int64_t)x >> bit_size == 0 ||
> > -          (int64_t)x >> bit_size == -1);
> > +          (int64_t)x >> bit_size == -1 ||
> > +          (int64_t)x >> bit_size == 65535);
> >
> >     memset(&v, 0, sizeof(v));
> >     assert(bit_size <= 64);
> > --
> > 2.19.1
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181119/86c73134/attachment.html>


More information about the mesa-dev mailing list