This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Add ComplexToStandard conversion pass.
ClosedPublic

Authored by akuegel on Apr 28 2021, 4:16 AM.

Details

Summary

So far, only a conversion for complex::AbsOp is done, but more will be added.

Diff Detail

Event Timeline

akuegel created this revision.Apr 28 2021, 4:16 AM
akuegel requested review of this revision.Apr 28 2021, 4:16 AM
pifon2a accepted this revision.Apr 28 2021, 5:02 AM
pifon2a added inline comments.
mlir/include/mlir/Conversion/Passes.td
106

is it a ModuleOp pass because you want to convert func args of ComplexType? If not, then would FunctionPass be enough?

mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
38

nit: realSqr?

This revision is now accepted and ready to land.Apr 28 2021, 5:02 AM
akuegel updated this revision to Diff 341154.Apr 28 2021, 5:15 AM

Address review comments.

akuegel marked an inline comment as done.Apr 28 2021, 5:16 AM
akuegel added inline comments.
mlir/include/mlir/Conversion/Passes.td
106

Thanks for the suggestion :)
FunctionPass is enough. Done.

This revision was landed with ongoing or failed builds.Apr 28 2021, 5:18 AM
This revision was automatically updated to reflect the committed changes.

The conversion of AbsOp in this patch does not account for underflows or overflows. Since it does not use higher precisions for computing the intermediate results, it might not be precise as well. We are hitting an underflow issue in Flang due to using this conversion. https://github.com/llvm/llvm-project/issues/62011
What are the plans for this pass? Would you accept fixes to improve precision or is the assumption that we should only use this pass where preciseness is not important?
Thanks in advance.

Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 5:43 AM

The conversion of AbsOp in this patch does not account for underflows or overflows. Since it does not use higher precisions for computing the intermediate results, it might not be precise as well. We are hitting an underflow issue in Flang due to using this conversion. https://github.com/llvm/llvm-project/issues/62011
What are the plans for this pass? Would you accept fixes to improve precision or is the assumption that we should only use this pass where preciseness is not important?
Thanks in advance.

We would accept fixes to improve precision. Thanks in advance :)