Mesa (staging/20.1): Revert "ac: generate FMA for inexact instructions for radeonsi"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 10 15:03:36 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: f1129d30a84e18ff0d6a189511d7fd4691094884
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1129d30a84e18ff0d6a189511d7fd4691094884

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Aug 31 23:37:37 2020 -0400

Revert "ac: generate FMA for inexact instructions for radeonsi"

This reverts commit 4b9370cb0f3a2d9030e827f847f66bdefeaf08fd.

Fixes: 4b9370cb0f3a2d9030e827f847f66bdefeaf08fd
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3429

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>
(cherry picked from commit f85294207f808c8f3072d63ac9e8624f9594045c)

---

 .pick_status.json               |  2 +-
 src/amd/llvm/ac_llvm_helper.cpp | 31 -------------------------------
 src/amd/llvm/ac_llvm_util.h     |  2 --
 src/amd/llvm/ac_nir_to_llvm.c   |  7 -------
 4 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 956dc4f25e3..a564099ef0d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1471,7 +1471,7 @@
         "description": "Revert \"ac: generate FMA for inexact instructions for radeonsi\"",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "4b9370cb0f3a2d9030e827f847f66bdefeaf08fd"
     },
diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
index f5383344dd4..578521a6f2d 100644
--- a/src/amd/llvm/ac_llvm_helper.cpp
+++ b/src/amd/llvm/ac_llvm_helper.cpp
@@ -96,11 +96,6 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx,
 		 */
 		flags.setAllowReciprocal(); /* arcp */
 
-		/* Allow floating-point contraction (e.g. fusing a multiply
-		 * followed by an addition into a fused multiply-and-add).
-		 */
-		flags.setAllowContract(); /* contract */
-
 		llvm::unwrap(builder)->setFastMathFlags(flags);
 		break;
 	}
@@ -108,32 +103,6 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx,
 	return builder;
 }
 
-/* Return the original state of inexact math. */
-bool ac_disable_inexact_math(LLVMBuilderRef builder)
-{
-	auto *b = llvm::unwrap(builder);
-	llvm::FastMathFlags flags = b->getFastMathFlags();
-
-	if (!flags.allowContract())
-		return false;
-
-	flags.setAllowContract(false);
-	b->setFastMathFlags(flags);
-	return true;
-}
-
-void ac_restore_inexact_math(LLVMBuilderRef builder, bool value)
-{
-	auto *b = llvm::unwrap(builder);
-	llvm::FastMathFlags flags = b->getFastMathFlags();
-
-	if (flags.allowContract() == value)
-		return;
-
-	flags.setAllowContract(value);
-	b->setFastMathFlags(flags);
-}
-
 LLVMTargetLibraryInfoRef
 ac_create_target_library_info(const char *triple)
 {
diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h
index f9650bdf4f1..4cfb3b55388 100644
--- a/src/amd/llvm/ac_llvm_util.h
+++ b/src/amd/llvm/ac_llvm_util.h
@@ -109,8 +109,6 @@ LLVMModuleRef ac_create_module(LLVMTargetMachineRef tm, LLVMContextRef ctx);
 
 LLVMBuilderRef ac_create_builder(LLVMContextRef ctx,
 				 enum ac_float_mode float_mode);
-bool ac_disable_inexact_math(LLVMBuilderRef builder);
-void ac_restore_inexact_math(LLVMBuilderRef builder, bool value);
 
 void
 ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index c6f612f58df..9fb06cba1d6 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -589,10 +589,6 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
 	unsigned num_components = instr->dest.dest.ssa.num_components;
 	unsigned src_components;
 	LLVMTypeRef def_type = get_def_type(ctx, &instr->dest.dest.ssa);
-	bool saved_inexact = false;
-
-	if (instr->exact)
-		saved_inexact = ac_disable_inexact_math(ctx->ac.builder);
 
 	assert(nir_op_infos[instr->op].num_inputs <= ARRAY_SIZE(src));
 	switch (instr->op) {
@@ -1199,9 +1195,6 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
 		result = ac_to_integer_or_pointer(&ctx->ac, result);
 		ctx->ssa_defs[instr->dest.dest.ssa.index] = result;
 	}
-
-	if (instr->exact)
-		ac_restore_inexact_math(ctx->ac.builder, saved_inexact);
 }
 
 static void visit_load_const(struct ac_nir_context *ctx,



More information about the mesa-commit mailing list