This is an archive of the discontinued LLVM Phabricator instance.

[mlir] make Math dialect depend on Arith dialect
ClosedPublic

Authored by ftynse on Apr 11 2023, 1:43 AM.

Details

Summary

Ops from the Math dialect use fastmath attributes defined in Arith.
Therefore Math dialect must declare a dependency on Arith for proper
construction and parsing.

Diff Detail

Event Timeline

ftynse created this revision.Apr 11 2023, 1:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 1:43 AM
ftynse requested review of this revision.Apr 11 2023, 1:43 AM
tpopp accepted this revision.Apr 11 2023, 3:33 AM
This revision is now accepted and ready to land.Apr 11 2023, 3:33 AM
tpopp added inline comments.Apr 11 2023, 3:34 AM
mlir/test/Dialect/Math/dependent-dialect.mlir
2

Can you name this depends-on-arith.mlir or similar? It could be easy for someone to add additional checks on other dialects that might then mask testing that math depends on arith by one of the other dialects loading the dependency

This revision was automatically updated to reflect the committed changes.
ftynse marked an inline comment as done.Apr 11 2023, 3:36 AM

I wonder if fast math shouldn't be a builtin (or its own dialect): seems like arith went as far as redefining it to avoid using the one from the llvm dialect?

I wonder if fast math shouldn't be a builtin (or its own dialect): seems like arith went as far as redefining it to avoid using the one from the llvm dialect?

On one hand, this doesn't sound sufficiently "fundamental IR" like bulitin.module to be a builtin. On the other hand, floating point types are builtin, and one can argue fastmath relates to them. Let me surface this.