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

Author: Marek Olšák <[email protected]>
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 <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

---

 .gitlab-ci/traces-radeonsi.yml  |  8 ++++----
 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, 4 insertions(+), 44 deletions(-)

diff --git a/.gitlab-ci/traces-radeonsi.yml b/.gitlab-ci/traces-radeonsi.yml
index 9e8d5dba8ad..111fc635e36 100644
--- a/.gitlab-ci/traces-radeonsi.yml
+++ b/.gitlab-ci/traces-radeonsi.yml
@@ -17,7 +17,7 @@ traces:
   - path: 0ad/0ad.trace
     expectations:
       - device: gl-radeonsi-stoney
-        checksum: bfd97a7190f2b9de24ddfd446fcc4850
+        checksum: c6261e56f37cc5d73b83d493561df646
   - path: pathfinder/demo.trace
     expectations:
       - device: gl-radeonsi-stoney
@@ -37,7 +37,7 @@ traces:
   - path: gputest/pixmark-piano.trace
     expectations:
       - device: gl-radeonsi-stoney
-        checksum: 061226c3fd179c611b8d60acaa44474f
+        checksum: a0e1d6358f76666603b08eab383af080
   - path: gputest/triangle.trace
     expectations:
       - device: gl-radeonsi-stoney
@@ -189,7 +189,7 @@ traces:
   - path: gputest/pixmark-piano.trace
     expectations:
       - device: gl-radeonsi-stoney
-        checksum: 061226c3fd179c611b8d60acaa44474f
+        checksum: a0e1d6358f76666603b08eab383af080
   - path: gputest/pixmark-volplosion.trace
     expectations:
       - device: gl-radeonsi-stoney
@@ -197,7 +197,7 @@ traces:
   - path: gputest/plot3d.trace
     expectations:
       - device: gl-radeonsi-stoney
-        checksum: 799ce7b2d8050d6ba2e3ae595cf8729e
+        checksum: fd367551aa74e2903e0590a893da01a6
   - path: gputest/tessmark.trace
     expectations:
       - device: gl-radeonsi-stoney
diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
index 1174b34b638..10cf301131a 100644
--- a/src/amd/llvm/ac_llvm_helper.cpp
+++ b/src/amd/llvm/ac_llvm_helper.cpp
@@ -114,11 +114,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;
        }
@@ -126,32 +121,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 622196081b4..8039c99bfbd 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 4f47c4d323d..4537ec71267 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -601,10 +601,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) {
@@ -1192,9 +1188,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,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to