[RFC] Split the math `dialect` from `std`

This is part of splitting the std dialect .

Dialect Scope and Goal

The math dialect is intended to hold mathematical operations.

The following ops will be moved to MathOps.td, keeping their existing names:

  • atan
  • atan2
  • cos
  • exp
  • exp2
  • log10
  • log1p
  • log2
  • log
  • pow
  • rsqrt
  • sin
  • sqrt
  • tanh

I propose that operations like addition, etc., remain where they are. If we want to split these, we should move them to an integer or floatingpoint dialect.

Development process

The split will be done in two steps

  • Create math dialect without removing math ops from std
  • Remove math ops from std after giving downstream users time to migrate to the ones in math
1 Like

Thanks for pushing the split forward!




What does it mean concretely? How long is enough? 1month? 2 months? 6?
Are we gonna duplicate every lowering in the meantime?

In general I’m wary of creating an expectation here, in particular when things amounts to just a renaming.

1 Like

I tend to agree with Mehdi here. Since this isn’t really much more complex than a search and replace I think we should just
force people to do the search and replace.


Fair enough. I will do it in one change then.

⚙ D96272 [mlir][math] Split off the math dialect. landed.

I hope this makes it easier to add new operations. I already have expm1 on my whishlist :slight_smile: