[Mesa-dev] [PATCH] r600g: Fix UMAD on Cayman

Marek Olšák maraeo at gmail.com
Mon Apr 8 18:18:48 PDT 2013


Pushed, thanks. The transform feedback test still doesn't pass, but at
least the hardlocks are gone.

Marek


On Sun, Apr 7, 2013 at 6:29 PM, Martin Andersson <g02maran at gmail.com> wrote:

> If there are no objections or comments on this, it would be nice if
> someone could commit it.
>
> //Martin
>
> On Tue, Apr 2, 2013 at 10:43 PM, Martin Andersson <g02maran at gmail.com>
> wrote:
> > The multiplication part of tgsi_umad did not work on Cayman, because it
> did
> > not populate the correct vector slots.
> > ---
> >  src/gallium/drivers/r600/r600_shader.c | 45
> ++++++++++++++++++++++++----------
> >  1 file changed, 32 insertions(+), 13 deletions(-)
> >
> > diff --git a/src/gallium/drivers/r600/r600_shader.c
> b/src/gallium/drivers/r600/r600_shader.c
> > index 82885d1..6c4cc8f 100644
> > --- a/src/gallium/drivers/r600/r600_shader.c
> > +++ b/src/gallium/drivers/r600/r600_shader.c
> > @@ -5840,7 +5840,7 @@ static int tgsi_umad(struct r600_shader_ctx *ctx)
> >  {
> >         struct tgsi_full_instruction *inst =
> &ctx->parse.FullToken.FullInstruction;
> >         struct r600_bytecode_alu alu;
> > -       int i, j, r;
> > +       int i, j, k, r;
> >         int lasti =
> tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
> >
> >         /* src0 * src1 */
> > @@ -5848,21 +5848,40 @@ static int tgsi_umad(struct r600_shader_ctx *ctx)
> >                 if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
> >                         continue;
> >
> > -               memset(&alu, 0, sizeof(struct r600_bytecode_alu));
> > +               if (ctx->bc->chip_class == CAYMAN) {
> > +                       for (j = 0 ; j < 4; j++) {
> > +                               memset(&alu, 0, sizeof(struct
> r600_bytecode_alu));
> >
> > -               alu.dst.chan = i;
> > -               alu.dst.sel = ctx->temp_reg;
> > -               alu.dst.write = 1;
> > +                               alu.op = ALU_OP2_MULLO_UINT;
> > +                               for (k = 0; k <
> inst->Instruction.NumSrcRegs; k++) {
> > +                                       r600_bytecode_src(&alu.src[k],
> &ctx->src[k], i);
> > +                               }
> > +                               tgsi_dst(ctx, &inst->Dst[0], j,
> &alu.dst);
> > +                               alu.dst.sel = ctx->temp_reg;
> > +                               alu.dst.write = (j == i);
> > +                               if (j == 3)
> > +                                       alu.last = 1;
> > +                               r = r600_bytecode_add_alu(ctx->bc, &alu);
> > +                               if (r)
> > +                                       return r;
> > +                       }
> > +               } else {
> > +                       memset(&alu, 0, sizeof(struct
> r600_bytecode_alu));
> >
> > -               alu.op = ALU_OP2_MULLO_UINT;
> > -               for (j = 0; j < 2; j++) {
> > -                       r600_bytecode_src(&alu.src[j], &ctx->src[j], i);
> > -               }
> > +                       alu.dst.chan = i;
> > +                       alu.dst.sel = ctx->temp_reg;
> > +                       alu.dst.write = 1;
> >
> > -               alu.last = 1;
> > -               r = r600_bytecode_add_alu(ctx->bc, &alu);
> > -               if (r)
> > -                       return r;
> > +                       alu.op = ALU_OP2_MULLO_UINT;
> > +                       for (j = 0; j < 2; j++) {
> > +                               r600_bytecode_src(&alu.src[j],
> &ctx->src[j], i);
> > +                       }
> > +
> > +                       alu.last = 1;
> > +                       r = r600_bytecode_add_alu(ctx->bc, &alu);
> > +                       if (r)
> > +                               return r;
> > +               }
> >         }
> >
> >
> > --
> > 1.8.2
> >
> _______________________________________________
> 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/20130409/679aac4f/attachment.html>


More information about the mesa-dev mailing list