Page MenuHomePhabricator

[mlir] Add lowering from math.expm1 to LLVM.
AcceptedPublic

Authored by akuegel on Feb 16 2021, 5:40 AM.

Details

Reviewers
herhut
ftynse
Summary

This is the straightforward lowering to exp(x) - 1.

Diff Detail

Event Timeline

akuegel created this revision.Feb 16 2021, 5:40 AM
akuegel requested review of this revision.Feb 16 2021, 5:40 AM
akuegel updated this revision to Diff 323974.Feb 16 2021, 5:55 AM

Fix comment that was still copy/pasted from rsqrt.

I won't ask to split out the math conversion from "standard" conversion, yet, but have you considered implementing this (as well as rsqrt from which most of the code is duplicated) as a sort of expand-math conversion instead?

herhut accepted this revision.Feb 24 2021, 12:24 AM

I won't ask to split out the math conversion from "standard" conversion, yet, but have you considered implementing this (as well as rsqrt from which most of the code is duplicated) as a sort of expand-math conversion instead?

Splitting this out is on my todo list. I though about having a general lowering to libm / llvm intrinsics that converts everything into a form that can be mapped that way. Additionally, we will have a lowering to GPU intrinsics and also the explicit approximations that are currently being worked on. Then the user of these lowerings can choose between those three sets of patterns, depending on their use-case. WDYT?

This revision is now accepted and ready to land.Feb 24 2021, 12:24 AM

Then the user of these lowerings can choose between those three sets of patterns, depending on their use-case. WDYT?

As long as the patterns are reusable so that the user can combine them and decide what is legal/illegal to chose a lowering strategy "per operation" :)

Sorry for not following up on this patch. I was very busy this week to work on a new op that we need for Kernel Generator broadcast specialization, and that is blocking and thus has priority over this patch.
I hope I can do the necessary adjustments to this patch soon.