Skip to content

Commit 56a275b

Browse files
committed
[mlir] make Math dialect depend on Arith dialect
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. Reviewed By: tpopp Differential Revision: https://reviews.llvm.org/D147999
1 parent b58a58c commit 56a275b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

mlir/include/mlir/Dialect/Math/IR/MathBase.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@ def Math_Dialect : Dialect {
3030
```
3131
}];
3232
let hasConstantMaterializer = 1;
33+
let dependentDialects = [
34+
"::mlir::arith::ArithDialect"
35+
];
3336
}
3437
#endif // MATH_BASE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: mlir-opt %s --mlir-print-op-generic | FileCheck %s
2+
3+
// Check that math.atan can be constructed by parsing and the fastmath
4+
// attribute can be created. This requires math dialect to depend on arith
5+
// dialect. Note that we don't want other dialects in here as they may
6+
// transitively depend on arith and load it even if math doesn't.
7+
8+
"test.some_op_with_region"() ({
9+
^bb0(%arg0: f64):
10+
// CHECK: #arith.fastmath<none>
11+
math.atan %arg0 : f64
12+
"test.possible_terminator"() : () -> ()
13+
}) : () -> ()

0 commit comments

Comments
 (0)