Concerns regarding the -ffp-contract=fast default
Florian Weimer
fweimer@redhat.com
Thu Sep 14 16:48:35 GMT 2023
While rebuilding CentOS Stream with -march=x86-64-v3, I rediscovered
several packages had test suite failures because x86-64 suddenly gained
FMA support. I say “rediscovered” because these issues were already
visible on other architectures with FMA.
So far, our package/architecture maintainers had just disabled test
suites or had built the package with -fp-contract=off because the
failures did not reproduce on x86-64. I'm not sure if this is the right
course of action.
GCC contraction behavior is rather inconsistent. It does not contract x
+ x - x without -ffast-math, for example, although I believe it would be
permissible under the rules that enable FMA contraction. This whole
thing looks suspiciously like a quick hack to get a performance
improvement from FMA instructions (sorry).
I know that GCC 14 has -fp-contract=standard. Would it make sense to
switch the default to that? If it fixes those package test suites, it
probably has an observable performance impact. 8-/
Thanks,
Florian
More information about the Gcc
mailing list