This is an archive of the discontinued LLVM Phabricator instance.

[mlir][math] Expand math.powf to exp, log and multiply
ClosedPublic

Authored by bviyer on Apr 12 2023, 1:28 PM.

Details

Summary

Powf functions are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will decompose the
powf function into log of exponent multiplied by log of base and raise
it to the exp.

Diff Detail

Event Timeline

bviyer created this revision.Apr 12 2023, 1:28 PM
bviyer requested review of this revision.Apr 12 2023, 1:28 PM
rsuderman added inline comments.Apr 12 2023, 2:15 PM
mlir/lib/Dialect/Math/Transforms/ExpandPatterns.cpp
167

Do we have a polynomial approximation for log? Curious whether it currently exists or not. This is not a blocking issue, just wondering if we should add it on our polynomial approximation list.

mlir/test/Dialect/Math/expand-math.mlir
177

This should just be CHECK

bviyer updated this revision to Diff 513044.Apr 12 2023, 7:34 PM
bviyer marked 2 inline comments as done.

Replaced CHECK-NEXT with CHECK.

bviyer added inline comments.Apr 13 2023, 7:27 AM
mlir/lib/Dialect/Math/Transforms/ExpandPatterns.cpp
167

yes we do. We have for Log base 2 and log base e.

bviyer updated this revision to Diff 513325.Apr 13 2023, 12:06 PM

Moved the test to a different file.

rsuderman accepted this revision.Apr 14 2023, 6:51 AM
This revision is now accepted and ready to land.Apr 14 2023, 6:51 AM