This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][TOSA] add tosa erf operator
ClosedPublic

Authored by manupak on May 11 2023, 5:23 AM.

Details

Summary

This commit adds tosa erf operator and its lowering
to math lib functions.

Diff Detail

Event Timeline

manupak created this revision.May 11 2023, 5:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2023, 5:23 AM
manupak requested review of this revision.May 11 2023, 5:23 AM
manupak edited reviewers, added: eric-k256, jpienaar; removed: nicolasvasilache.May 11 2023, 5:26 AM
jpienaar accepted this revision.May 15 2023, 9:11 AM

Looks good overall.

mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
471

Mathjax is supported by Hugo (well and Github markdown, but the former is more important as that's what the mlir.llvm.org website is generated with), so lets switch to that here. Some plumbing may be needed mlir.llvm.org side, but can be done in follow up.

473

Why do we need to say this as part of the op rather than this be some lowering pattern?

This revision is now accepted and ready to land.May 15 2023, 9:11 AM

Agreed that this looks good, with only changes in the description that seem to be needed. As mentioned inline, part of the blame lies on the spec, and I'm going to try to correct the spec to allow legalizations to choose the best option, listing the existing version as an option rather than appearing to be required. (Let me know if there is benefit to the spec as is)

mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
473

I think this is matching the existing descriptions for sigmoid and tanh, and matches what is described in the TOSA spec. On Friday I was working on how to update the spec. The specification takes what is probably too strong a statement on how the integer versions of tanh/sigmoid are defined. As you describe, it should be up to the legalizations to define the 'best' legalizations, probably based on the quantization limits. The TensorFlow Lite legalizations we've added do this already.

manupak updated this revision to Diff 522505.May 16 2023, 2:22 AM

modified the equation

I've changed the equation now. see if it looks good.
I'll also need help landing the patch as well :).

mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
473

Yea, Im being consistent with others for now.

manupak marked an inline comment as done.May 16 2023, 5:54 AM
eric-k256 accepted this revision.May 16 2023, 4:27 PM

Looks good to me.

Can someone help me land this patch ?

I should be able to help land it, hopefully tomorrow.

This revision was automatically updated to reflect the committed changes.