[Mlir-commits] [mlir] 73b759a - [MLIR] Add dialect prefix to all operations from Math

Arjun P llvmlistbot at llvm.org
Mon May 31 10:29:43 PDT 2021


Author: Andi Drebes
Date: 2021-05-31T22:59:26+05:30
New Revision: 73b759a33a9c2fccf72c31f7adb5038cc0eb621f

URL: https://github.com/llvm/llvm-project/commit/73b759a33a9c2fccf72c31f7adb5038cc0eb621f
DIFF: https://github.com/llvm/llvm-project/commit/73b759a33a9c2fccf72c31f7adb5038cc0eb621f.diff

LOG: [MLIR] Add dialect prefix to all operations from Math

Prefix all operations from the ODS of the `Math` dialect with `Math_`
in order to avoid name clashes when including `MathOps.td` in other
TableGen files (e.g., for `FloatUnaryOp`, which also exists in
`Standard`).

Reviewed By: jpienaar, mehdi_amini

Differential Revision: https://reviews.llvm.org/D103248

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Math/IR/MathOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Math/IR/MathOps.td b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
index 7ce4dc3a7aee..31f119740a8a 100644
--- a/mlir/include/mlir/Dialect/Math/IR/MathOps.td
+++ b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
@@ -13,11 +13,11 @@ include "mlir/Dialect/Math/IR/MathBase.td"
 include "mlir/Interfaces/VectorInterfaces.td"
 include "mlir/Interfaces/SideEffectInterfaces.td"
 
-class MathOp<string mnemonic, list<OpTrait> traits = []>
+class Math_Op<string mnemonic, list<OpTrait> traits = []>
     : Op<Math_Dialect, mnemonic, traits # [NoSideEffect]>;
 
-class FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
-    MathOp<mnemonic, traits #
+class Math_FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+    Math_Op<mnemonic, traits #
     [DeclareOpInterfaceMethods<VectorUnrollOpInterface>,
     SameOperandsAndResultType] # ElementwiseMappable.traits> {
   let arguments = (ins FloatLike:$operand);
@@ -27,8 +27,8 @@ class FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
   let assemblyFormat = "$operand attr-dict `:` type($result)";
 }
 
-class FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
-    MathOp<mnemonic, traits # [
+class Math_FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+    Math_Op<mnemonic, traits # [
     DeclareOpInterfaceMethods<VectorUnrollOpInterface>,
     SameOperandsAndResultType] # ElementwiseMappable.traits> {
   let arguments = (ins FloatLike:$lhs, FloatLike:$rhs);
@@ -41,7 +41,7 @@ class FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
 // AtanOp
 //===----------------------------------------------------------------------===//
 
-def AtanOp : FloatUnaryOp<"atan">{
+def Math_AtanOp : Math_FloatUnaryOp<"atan">{
   let summary = "arcus tangent of the given value";
   let description = [{
     Syntax:
@@ -74,7 +74,7 @@ def AtanOp : FloatUnaryOp<"atan">{
 // Atan2Op
 //===----------------------------------------------------------------------===//
 
-def Atan2Op : FloatBinaryOp<"atan2">{
+def Math_Atan2Op : Math_FloatBinaryOp<"atan2">{
   let summary = "2-argument arcus tangent of the given values";
   let description = [{
     Syntax:
@@ -114,7 +114,7 @@ def Atan2Op : FloatBinaryOp<"atan2">{
 // CosOp
 //===----------------------------------------------------------------------===//
 
-def CosOp : FloatUnaryOp<"cos"> {
+def Math_CosOp : Math_FloatUnaryOp<"cos"> {
   let summary = "cosine of the specified value";
   let description = [{
     Syntax:
@@ -147,7 +147,7 @@ def CosOp : FloatUnaryOp<"cos"> {
 // SinOp
 //===----------------------------------------------------------------------===//
 
-def SinOp : FloatUnaryOp<"sin"> {
+def Math_SinOp : Math_FloatUnaryOp<"sin"> {
   let summary = "sine of the specified value";
   let description = [{
     Syntax:
@@ -181,7 +181,7 @@ def SinOp : FloatUnaryOp<"sin"> {
 // ExpOp
 //===----------------------------------------------------------------------===//
 
-def ExpOp : FloatUnaryOp<"exp"> {
+def Math_ExpOp : Math_FloatUnaryOp<"exp"> {
   let summary = "base-e exponential of the specified value";
   let description = [{
     Syntax:
@@ -213,7 +213,7 @@ def ExpOp : FloatUnaryOp<"exp"> {
 // Exp2Op
 //===----------------------------------------------------------------------===//
 
-def Exp2Op : FloatUnaryOp<"exp2"> {
+def Math_Exp2Op : Math_FloatUnaryOp<"exp2"> {
   let summary = "base-2 exponential of the specified value";
 
   let description = [{
@@ -246,7 +246,7 @@ def Exp2Op : FloatUnaryOp<"exp2"> {
 // ExpM1Op
 //===----------------------------------------------------------------------===//
 
-def ExpM1Op : FloatUnaryOp<"expm1"> {
+def Math_ExpM1Op : Math_FloatUnaryOp<"expm1"> {
   let summary = "base-e exponential of the specified value minus 1";
   let description = [{
     Syntax:
@@ -280,7 +280,7 @@ def ExpM1Op : FloatUnaryOp<"expm1"> {
 // LogOp
 //===----------------------------------------------------------------------===//
 
-def LogOp : FloatUnaryOp<"log"> {
+def Math_LogOp : Math_FloatUnaryOp<"log"> {
   let summary = "base-e logarithm of the specified value";
 
   let description = [{
@@ -299,7 +299,7 @@ def LogOp : FloatUnaryOp<"log"> {
 // Log10Op
 //===----------------------------------------------------------------------===//
 
-def Log10Op : FloatUnaryOp<"log10"> {
+def Math_Log10Op : Math_FloatUnaryOp<"log10"> {
   let summary = "base-10 logarithm of the specified value";
 
   let description = [{
@@ -318,7 +318,7 @@ def Log10Op : FloatUnaryOp<"log10"> {
 // Log1pOp
 //===----------------------------------------------------------------------===//
 
-def Log1pOp : FloatUnaryOp<"log1p"> {
+def Math_Log1pOp : Math_FloatUnaryOp<"log1p"> {
   let summary = "Computes the natural logarithm of one plus the given value";
 
   let description = [{
@@ -339,7 +339,7 @@ def Log1pOp : FloatUnaryOp<"log1p"> {
 // Log2Op
 //===----------------------------------------------------------------------===//
 
-def Log2Op : FloatUnaryOp<"log2"> {
+def Math_Log2Op : Math_FloatUnaryOp<"log2"> {
   let summary = "base-2 logarithm of the specified value";
 
   let description = [{
@@ -358,7 +358,7 @@ def Log2Op : FloatUnaryOp<"log2"> {
 // PowFOp
 //===----------------------------------------------------------------------===//
 
-def PowFOp : FloatBinaryOp<"powf"> {
+def Math_PowFOp : Math_FloatBinaryOp<"powf"> {
   let summary = "floating point raised to the power of operation";
   let description = [{
     Syntax:
@@ -391,7 +391,7 @@ def PowFOp : FloatBinaryOp<"powf"> {
 // RsqrtOp
 //===----------------------------------------------------------------------===//
 
-def RsqrtOp : FloatUnaryOp<"rsqrt"> {
+def Math_RsqrtOp : Math_FloatUnaryOp<"rsqrt"> {
   let summary = "reciprocal of sqrt (1 / sqrt of the specified value)";
   let description = [{
     The `rsqrt` operation computes the reciprocal of the square root. It takes
@@ -405,7 +405,7 @@ def RsqrtOp : FloatUnaryOp<"rsqrt"> {
 // SqrtOp
 //===----------------------------------------------------------------------===//
 
-def SqrtOp : FloatUnaryOp<"sqrt"> {
+def Math_SqrtOp : Math_FloatUnaryOp<"sqrt"> {
   let summary = "sqrt of the specified value";
   let description = [{
     The `sqrt` operation computes the square root. It takes one operand and
@@ -430,7 +430,7 @@ def SqrtOp : FloatUnaryOp<"sqrt"> {
 // TanhOp
 //===----------------------------------------------------------------------===//
 
-def TanhOp : FloatUnaryOp<"tanh"> {
+def Math_TanhOp : Math_FloatUnaryOp<"tanh"> {
   let summary = "hyperbolic tangent of the specified value";
   let description = [{
     Syntax:


        


More information about the Mlir-commits mailing list