[Mesa-dev] [PATCH] radv/ac: canonicalize the output for 32-bit float min/max.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Mar 17 08:24:27 UTC 2017


Where do you see that they are required to flush denormals to 0? I
can't find it in the GLSL extensions for SPIR-V, and the vulkan spec
has the following note:

"Any denormalized value input into a shader or potentially generated
by any instruction in a shader may be flushed to 0."

Which very much sounds optional.


On Fri, Mar 17, 2017 at 4:42 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This fixes:
> dEQP-VK.glsl.builtin.precision.min.*
> dEQP-VK.glsl.builtin.precision.max.*
> dEQP-VK.glsl.builtin.precision.clamp.*
>
> As weren't flushing the denorms as SPIR-V required.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/amd/common/ac_nir_to_llvm.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index bb53386..122df7f 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1449,16 +1449,18 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
>         case nir_op_fmax:
>                 result = emit_intrin_2f_param(ctx, "llvm.maxnum",
>                                               to_float_type(ctx, def_type), src[0], src[1]);
> -               result = emit_intrin_1f_param(ctx, "llvm.canonicalize",
> -                                             to_float_type(ctx, def_type),
> -                                             result);
> +               if (instr->dest.dest.ssa.bit_size == 32)
> +                       result = emit_intrin_1f_param(ctx, "llvm.canonicalize",
> +                                                     to_float_type(ctx, def_type),
> +                                                     result);
>                 break;
>         case nir_op_fmin:
>                 result = emit_intrin_2f_param(ctx, "llvm.minnum",
>                                               to_float_type(ctx, def_type), src[0], src[1]);
> -               result = emit_intrin_1f_param(ctx, "llvm.canonicalize",
> -                                             to_float_type(ctx, def_type),
> -                                             result);
> +               if (instr->dest.dest.ssa.bit_size == 32)
> +                       result = emit_intrin_1f_param(ctx, "llvm.canonicalize",
> +                                                     to_float_type(ctx, def_type),
> +                                                     result);
>                 break;
>         case nir_op_ffma:
>                 result = emit_intrin_3f_param(ctx, "llvm.fma",
> --
> 2.9.3
>
> _______________________________________________
> 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