From b8dfdac3d83ee2843e59f2becb6b1edc13a61167 Mon Sep 17 00:00:00 2001 From: Tim Ansell Date: Wed, 10 Jan 2024 13:24:44 -0800 Subject: [PATCH] Add `-ffp-contract=off` to `.bazelrc`. This is needed for floating point stability. The global placement depends on the output of the FFT library. Without `-ffp-contract=off` the current FFT library produces different results dependent on if the compiler is targeting an x86 architecture which has the "FMA instruction". The FMA instruction omits the rounding done in the multiplication instruction, making the calculations produce different results for some input values See https://kristerw.github.io/2021/11/09/fp-contract/ See also OpenROAD change @ https://github.com/The-OpenROAD-Project/OpenROAD/pull/4518 Signed-off-by: Tim Ansell --- .bazelrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelrc b/.bazelrc index c8db7472..08fdc124 100644 --- a/.bazelrc +++ b/.bazelrc @@ -13,7 +13,9 @@ # limitations under the License. build --cxxopt "-std=c++17" +build --cxxopt "-ffp-contract=off" build --host_cxxopt "-std=c++17" +build --host_cxxopt "-ffp-contract=off" build --crosstool_top=@llvm_toolchain//:toolchain build:ciremotebuild --crosstool_top=@llvm_toolchain//:toolchain