This is an archive of the discontinued LLVM Phabricator instance.

[flang] Use libm functions for complex operations by default
ClosedPublic

Authored by DavidTruby on Jul 14 2023, 9:50 AM.

Details

Summary

This patch changes the default lowering for complex operations to use
the more accurate libm operations as opposed to the mlir complex
operations. This is necessary due to precision issues in the mlir
complex dialect that cause failures in e.g. the LAPACK tests.

The mlir complex dialect lowering will still be used when
-fapprox-func is set (and by extension -ffast-math and -Ofast)

Diff Detail

Event Timeline

DavidTruby created this revision.Jul 14 2023, 9:50 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
DavidTruby requested review of this revision.Jul 14 2023, 9:50 AM

LG.

Could you announce in https://discourse.llvm.org/t/rfc-proposal-for-complex-math-intrinsic-lowering-through-the-mlir-complex-dialect/65420 about this change when you submit? Please specify that complex intrinsic lowering now follows -fapprox-func and disableMlirComplex. It will not follow math-runtime option. Also, mark this as fixing https://github.com/llvm/llvm-project/issues/58799. Also, include a comment in issue 58799.

This revision is now accepted and ready to land.Jul 17 2023, 1:41 PM
vzakhari accepted this revision.Jul 17 2023, 1:53 PM

LGTM except for one minor issue. Thank you!

flang/lib/Optimizer/Builder/IntrinsicCall.cpp
51

This looks out of style :)

This revision was landed with ongoing or failed builds.Jul 19 2023, 6:34 AM
This revision was automatically updated to reflect the committed changes.