[Mesa-dev] [PATCH 1/2] nv50/ir: don't optimize dnz muls to add

Ilia Mirkin imirkin at alum.mit.edu
Sun Nov 25 01:12:31 UTC 2018


Can you elaborate as to what the issue is? The dnz flag is set when we
want to make NaN -> Infinity. Do you have a concrete TGSI program that
triggers issues?
On Sat, Nov 24, 2018 at 6:04 PM Karol Herbst <kherbst at redhat.com> wrote:
>
> fixes asserts with gallium nine
>
> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 04d26dcbf53..0a284572ede 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -557,6 +557,8 @@ ConstantFolding::expr(Instruction *i,
>     case OP_MAD:
>     case OP_FMA:
>     case OP_MUL:
> +      if (i->dnz && i->op != OP_MUL)
> +         return;
>        if (i->dnz && i->dType == TYPE_F32) {
>           if (!isfinite(a->data.f32))
>              a->data.f32 = 0.0f;
> @@ -1089,7 +1091,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>              i->src(0).mod = 0;
>           i->setSrc(1, NULL);
>        } else
> -      if (!i->postFactor && (imm0.isInteger(2) || imm0.isInteger(-2))) {
> +      if (!i->postFactor && !i->dnz && (imm0.isInteger(2) || imm0.isInteger(-2))) {
>           if (imm0.isNegative())
>              i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG);
>           i->op = OP_ADD;
> @@ -1120,7 +1122,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>           if (i->op != OP_CVT)
>              i->src(0).mod = 0;
>        } else
> -      if (i->subOp != NV50_IR_SUBOP_MUL_HIGH &&
> +      if (i->subOp != NV50_IR_SUBOP_MUL_HIGH && !i->dnz &&
>            (imm0.isInteger(1) || imm0.isInteger(-1))) {
>           if (imm0.isNegative())
>              i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG);
> --
> 2.19.1
>
> _______________________________________________
> 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