This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add support for expanding tanh op into exp form.
ClosedPublic

Authored by hanchung on Jun 17 2020, 12:13 PM.

Details

Summary

Fixed build of D81618

Add a pattern for expanding tanh op into exp form.
A tanh is expanded into:

  1. 1-exp^{-2x} / 1+exp^{-2x}, if x => 0
  2. exp^{2x}-1 / exp^{2x}+1 , if x < 0.

Diff Detail

Event Timeline

hanchung created this revision.Jun 17 2020, 12:13 PM
Herald added a project: Restricted Project. · View Herald Transcript

It's fixed by adding a missing dep in mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt

Oh wait me a sec, I think I should populate the pattern at populateStdToLLVMConversionPatterns, not in LinalgToLLVM.cpp file. Let me fix it.

hanchung updated this revision to Diff 271453.Jun 17 2020, 12:37 PM

Remove the pattern from ConvertLinalgToLLVMPass.

hanchung retitled this revision from [mlir] Add support for lowering tanh to LLVMIR. to [mlir] Add support for expanding tanh op into exp form..Jun 17 2020, 12:39 PM
Harbormaster completed remote builds in B60682: Diff 271442.
ftynse accepted this revision.Jun 18 2020, 5:20 AM
This revision is now accepted and ready to land.Jun 18 2020, 5:20 AM
hanchung updated this revision to Diff 271750.Jun 18 2020, 9:32 AM

Remove unneeded include from mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp

This revision was automatically updated to reflect the committed changes.