This is an archive of the discontinued LLVM Phabricator instance.

[mlir][math] Added math::FPowI conversion to calls of outlined implementations.
ClosedPublic

Authored by vzakhari on Dec 11 2022, 7:39 PM.

Details

Summary

Power functions are implemented as linkonce_odr scalar functions
for FPowI operations met in a module.
Vector form of FPowI is linearized into a sequence of calls
of the scalar functions.

Option {min-width-of-fpowi-exponent} controls which FPowI operations
are converted by MathToFuncs: if the width of the exponent's integer
type is less than the specified value, then the operation is not converted.

Flang will specify {min-width-of-fpowi-exponent=33} to make sure that
math::FPowI operations with exponent wider than 32 bits will be converted
by MathToFuncs, and operations with more narrow exponent will be left
for MathToLLVM to convert them to LLVM::PowIOp.

Diff Detail

Event Timeline

vzakhari created this revision.Dec 11 2022, 7:39 PM
vzakhari requested review of this revision.Dec 11 2022, 7:39 PM
Mogball requested changes to this revision.Dec 12 2022, 10:19 PM
Mogball added inline comments.
mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
20

Can you change this to use the new pass generation? It should auto-generated these constructors.

mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
81

please make this a class and move private fields to the bottom

125

does this work?

This revision now requires changes to proceed.Dec 12 2022, 10:19 PM
vzakhari added inline comments.Dec 12 2022, 11:02 PM
mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
20

Thank you for the hint! Done.

mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
125

Nope, the parameter has to be an object.

vzakhari updated this revision to Diff 482365.Dec 12 2022, 11:03 PM
vzakhari marked 3 inline comments as done.

Thank you for the review, @Mogball! I updated the files.

vzakhari updated this revision to Diff 482509.Dec 13 2022, 8:56 AM

Fixed Flang build.

Mogball accepted this revision.Dec 13 2022, 9:37 AM
This revision is now accepted and ready to land.Dec 13 2022, 9:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 13 2022, 12:15 PM