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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 27 07:50:11 UTC 2020


Module: Mesa
Branch: master
Commit: 9e5d2a73c5fc12841b62758a035b2bdb191b3f86
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e5d2a73c5fc12841b62758a035b2bdb191b3f86

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>

---

 src/amd/llvm/ac_llvm_build.c | 5 +++++
 1 file changed, 5 insertions(+)

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