Mesa (staging/20.0): ac/llvm: flush denorms for nir_op_fmed3 on GFX8 and older gens

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 28 22:44:48 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 9fc39b9c670dfaee7a6665fb80e0a9c0012eef45
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fc39b9c670dfaee7a6665fb80e0a9c0012eef45

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Feb 26 15:12:55 2020 +0100

ac/llvm: flush denorms for nir_op_fmed3 on GFX8 and older gens

The hardware doesn't flush denorms, exactly like fmin/fmax, so
we have to do it manually. This doesn't fix anything known.

Fixes: d6a07732c9c ("ac: use llvm.amdgcn.fmed3 intrinsic for nir_op_fmed3")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3962>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3962>
(cherry picked from commit 9e5d2a73c5fc12841b62758a035b2bdb191b3f86)

---

 .pick_status.json            | 2 +-
 src/amd/llvm/ac_llvm_build.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 09b0c3448ba..9a7e8ba6a85 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1048,7 +1048,7 @@
         "description": "ac/llvm: flush denorms for nir_op_fmed3 on GFX8 and older gens",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "d6a07732c9c155c73f7d2cddc10faa7eab768df9"
     },
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index 116abf942c2..2531c5740e0 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -2759,6 +2759,11 @@ LLVMValueRef ac_build_fmed3(struct ac_llvm_context *ctx, LLVMValueRef src0,
 					    AC_FUNC_ATTR_READNONE);
 	}
 
+	if (ctx->chip_class < GFX9 && bitsize == 32) {
+		/* Only pre-GFX9 chips do not flush denorms. */
+		result = ac_build_canonicalize(ctx, result, bitsize);
+	}
+
 	return result;
 }
 



More information about the mesa-commit mailing list