Missing trigonometry ops

ONNX has a couple of trig functions that are not yet supported. I assume that other languages will need them eventually too. It probably makes most sense to include them to MLIR as opposed to a custom ONNX dialect. Missing are: Acos/Asin/Atan, Acosh/Asinh/Atanh, tan.

Would they be objections to adding them to MLIR? Are folks already working on this?


1 Like

We mentioned the possible creation of a math dialect here: [RFC] Splitting the Standard dialect ; are you interested in getting this started?

I am not opposed to help reorganize in the long run; right now we have a short deadline for which we need to add the support for all trig operations.

Adding a new dialect to support these ops should be fairly trivial though, what complication do you anticipate?
(see the complex dialect that was just added for example: ⚙ D94764 [mlir] Add Complex dialect. and the associated [RFC] Split the `complex` dialect from `std` )

+1 to @mehdi_amini.

I haven’t gotten to splitting off the math dialect, but adding dialects is cheap. The only difference between adding those ops to the standard dialect and adding a new dialect with them is to write up the dialect scoping documentation.

It would be great to get them added. We have been adding the operations on a by need basis and the ones you mention are approximated in a higher-level dialect, hence they were not on our agenda.

It should not make much of a difference whether you create a new ONNX dialect or add the math dialect to core given that there seems to be a lot of support. I would also be ok with splitting the math dialect out first and removing the old ops later if that helps with spreading the refactoring load.

I will move ahead with the splitting, proposal in [RFC] Split the math `dialect` from `std`.

1 Like

That would be wonderful. We will try to then contribute the missing ops.