[Mesa-dev] [PATCH] radv: fix shared memory load/stores.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Feb 3 08:20:01 UTC 2017



On Fri, Feb 3, 2017, at 06:33, Dave Airlie wrote:
> On 3 February 2017 at 13:35, Dave Airlie <airlied at gmail.com> wrote:
> > From: Dave Airlie <airlied at redhat.com>
> >
> > If we have an indirect index here we need to scale it by attribute slots
> > e.g. is this is vec2[256] then we get an indir_index in the 0.255 range
> > but the vec2 are aligned inside vec4 slots. So scale the indir index,
> > then extract the channels.
> >
> > This appears to fix DOOM for me.
> 
> Looks like appearances were deceiving, doom isn't fully fixed by this.
> 

You are not the only one that has been down that rabbit hole :(

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> Dave.
> 
> >
> > Signed-off-by: Dave Airlie <airlied at redhat.com>
> > ---
> >  src/amd/common/ac_nir_to_llvm.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> > index 9be6e77..566516f 100644
> > --- a/src/amd/common/ac_nir_to_llvm.c
> > +++ b/src/amd/common/ac_nir_to_llvm.c
> > @@ -2237,6 +2237,9 @@ static LLVMValueRef visit_load_var(struct nir_to_llvm_context *ctx,
> >                 LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32);
> >                 LLVMValueRef derived_ptr;
> >
> > +               if (indir_index)
> > +                       indir_index = LLVMBuildMul(ctx->builder, indir_index, LLVMConstInt(ctx->i32, 4, false), "");
> > +
> >                 for (unsigned chan = 0; chan < ve; chan++) {
> >                         LLVMValueRef index = LLVMConstInt(ctx->i32, chan, false);
> >                         if (indir_index)
> > @@ -2343,6 +2346,10 @@ visit_store_var(struct nir_to_llvm_context *ctx,
> >                 break;
> >         case nir_var_shared: {
> >                 LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32);
> > +
> > +               if (indir_index)
> > +                       indir_index = LLVMBuildMul(ctx->builder, indir_index, LLVMConstInt(ctx->i32, 4, false), "");
> > +
> >                 for (unsigned chan = 0; chan < 8; chan++) {
> >                         if (!(writemask & (1 << chan)))
> >                                 continue;
> > --
> > 2.7.4
> >
> > _______________________________________________
> > 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


More information about the mesa-dev mailing list