[Mesa-stable] Fwd: [Mesa-dev] [PATCH 1/1] radv: use a faster version for nir_op_pack_half_2x16

Alex Smith asmith at feralinteractive.com
Fri Dec 22 09:23:59 UTC 2017


Just noticed this didn't get tagged for stable. Since it fixes various
rendering issues on Vega, I'd like to nominate it for 17.3.

Commit 5f81a43535e8512cef26ea3dcd1e3a489bd5a1bb on master.

---------- Forwarded message ----------
From: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: 5 December 2017 at 17:02
Subject: [Mesa-dev] [PATCH 1/1] radv: use a faster version for
nir_op_pack_half_2x16
To: mesa-dev at lists.freedesktop.org


This patch is ported from RadeonSI and it has two effects.

It fixes a rendering issue which affects F1 2017 and Dawn
of War 3 (Vega only) because LLVM was ending up by generating
the new v_mad_mix_{hi,lo} instructions which appear to be
buggy in some way. Not sure if Mesa is generating something
wrong or if the issue is in LLVM only. Anyway, that explains why
the DOW3 issue can't be reproduced with GL on Vega.

It also improves performance because v_cvt_pkrtz_f16 is faster,
and because I guess the rounding mode behaviour is similar between
GL and VK, we can use it. About performance, it improves Talos
by +3/4% but I don't see any other impacts.

No CTS regressions on Polaris (Vega in progress).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/common/ac_nir_to_llvm.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_
llvm.c
index 96ba289a81..663b27d265 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1426,23 +1426,13 @@ static LLVMValueRef emit_bitfield_insert(struct
ac_llvm_context *ctx,
 static LLVMValueRef emit_pack_half_2x16(struct ac_llvm_context *ctx,
                                        LLVMValueRef src0)
 {
-       LLVMValueRef const16 = LLVMConstInt(ctx->i32, 16, false);
-       int i;
        LLVMValueRef comp[2];

        src0 = ac_to_float(ctx, src0);
        comp[0] = LLVMBuildExtractElement(ctx->builder, src0, ctx->i32_0,
"");
        comp[1] = LLVMBuildExtractElement(ctx->builder, src0, ctx->i32_1,
"");
-       for (i = 0; i < 2; i++) {
-               comp[i] = LLVMBuildFPTrunc(ctx->builder, comp[i], ctx->f16,
"");
-               comp[i] = LLVMBuildBitCast(ctx->builder, comp[i], ctx->i16,
"");
-               comp[i] = LLVMBuildZExt(ctx->builder, comp[i], ctx->i32,
"");
-       }
-
-       comp[1] = LLVMBuildShl(ctx->builder, comp[1], const16, "");
-       comp[0] = LLVMBuildOr(ctx->builder, comp[0], comp[1], "");

-       return comp[0];
+       return ac_build_cvt_pkrtz_f16(ctx, comp);
 }

 static LLVMValueRef emit_unpack_half_2x16(struct ac_llvm_context *ctx,
--
2.15.1

_______________________________________________
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-stable/attachments/20171222/5fc485a6/attachment.html>


More information about the mesa-stable mailing list