This is an archive of the discontinued LLVM Phabricator instance.

Add a phase that lowers std.tanh to a C runtime call
Needs RevisionPublic

Authored by llitchev on Jun 11 2020, 9:17 AM.

Details

Summary

The TanhOp is not properly lowered to LLVM. To address that a phase was added to lower the TanhOp to a C runtime call.

Diff Detail

Event Timeline

llitchev created this revision.Jun 11 2020, 9:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2020, 9:17 AM
llitchev updated this revision to Diff 270170.Jun 11 2020, 9:53 AM

Code formatting changes.

rriddle requested changes to this revision.Jun 11 2020, 10:16 AM
rriddle added inline comments.
mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
19

This doesn't really seem like the right granularity for a pass. Seems better to just expose the patterns and use a test pass instead.

mlir/lib/Dialect/StandardOps/Transforms/StdOpToCall.cpp
27

Can you add proper documentation here?

This revision now requires changes to proceed.Jun 11 2020, 10:16 AM
ftynse requested changes to this revision.Jun 11 2020, 10:32 AM
ftynse added inline comments.
mlir/lib/Dialect/StandardOps/Transforms/StdOpToCall.cpp
1

Please make sure the header fits into 80 cols

54

This is wrong. You should use the pattern rewriter provided as function argument to _create_ ops as well.

56

rewriter.replaceWithNewOp<CallOp>(op, ...)

62

This function should take a PatternRewriter and use it to create the functions instead of defining local builders.

mlir/test/Dialect/Standard/tanh.mlir
2

Can we also check that the appropriate function references were inserted?

18

This file needs a better name

llitchev marked an inline comment as done.Jun 12 2020, 12:12 PM
llitchev added inline comments.
mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
19

Thanks!! Could you elaborate a bit more on this - using a test pass. Are there examples I can look at? I just modeled this after the ExpandAtomic pass (that was suggested to use as an example - https://reviews.llvm.org/D75509).

flaub added a subscriber: flaub.Jun 15 2020, 1:57 PM