NFC: Remove references to the toy.generic attribute.
authorRiver Riddle <riverriddle@google.com>
Wed, 23 Oct 2019 21:30:01 +0000 (14:30 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 23 Oct 2019 21:30:35 +0000 (14:30 -0700)
This was used for shape inference in the previous tutorial flow.

PiperOrigin-RevId: 276351916

mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
mlir/g3doc/Tutorials/Toy/Ch-3.md

index 73bff29..8b434b1 100644 (file)
@@ -126,13 +126,7 @@ private:
     llvm::SmallVector<mlir::Type, 4> arg_types(proto.getArgs().size(),
                                                getType(VarType{}));
     auto func_type = builder.getFunctionType(arg_types, llvm::None);
-    auto function = mlir::FuncOp::create(location, proto.getName(), func_type);
-
-    // Mark the function as generic: it'll require type specialization for every
-    // call site.
-    if (function.getNumArguments())
-      function.setAttr("toy.generic", builder.getUnitAttr());
-    return function;
+    return mlir::FuncOp::create(location, proto.getName(), func_type);
   }
 
   /// Emit a new function and add it to the MLIR module.
index 73bff29..8b434b1 100644 (file)
@@ -126,13 +126,7 @@ private:
     llvm::SmallVector<mlir::Type, 4> arg_types(proto.getArgs().size(),
                                                getType(VarType{}));
     auto func_type = builder.getFunctionType(arg_types, llvm::None);
-    auto function = mlir::FuncOp::create(location, proto.getName(), func_type);
-
-    // Mark the function as generic: it'll require type specialization for every
-    // call site.
-    if (function.getNumArguments())
-      function.setAttr("toy.generic", builder.getUnitAttr());
-    return function;
+    return mlir::FuncOp::create(location, proto.getName(), func_type);
   }
 
   /// Emit a new function and add it to the MLIR module.
index 55391d7..5f9dd30 100644 (file)
@@ -126,13 +126,7 @@ private:
     llvm::SmallVector<mlir::Type, 4> arg_types(proto.getArgs().size(),
                                                getType(VarType{}));
     auto func_type = builder.getFunctionType(arg_types, llvm::None);
-    auto function = mlir::FuncOp::create(location, proto.getName(), func_type);
-
-    // Mark the function as generic: it'll require type specialization for every
-    // call site.
-    if (function.getNumArguments())
-      function.setAttr("toy.generic", builder.getUnitAttr());
-    return function;
+    return mlir::FuncOp::create(location, proto.getName(), func_type);
   }
 
   /// Emit a new function and add it to the MLIR module.
index 73bff29..8b434b1 100644 (file)
@@ -126,13 +126,7 @@ private:
     llvm::SmallVector<mlir::Type, 4> arg_types(proto.getArgs().size(),
                                                getType(VarType{}));
     auto func_type = builder.getFunctionType(arg_types, llvm::None);
-    auto function = mlir::FuncOp::create(location, proto.getName(), func_type);
-
-    // Mark the function as generic: it'll require type specialization for every
-    // call site.
-    if (function.getNumArguments())
-      function.setAttr("toy.generic", builder.getUnitAttr());
-    return function;
+    return mlir::FuncOp::create(location, proto.getName(), func_type);
   }
 
   /// Emit a new function and add it to the MLIR module.
index 73bff29..8b434b1 100644 (file)
@@ -126,13 +126,7 @@ private:
     llvm::SmallVector<mlir::Type, 4> arg_types(proto.getArgs().size(),
                                                getType(VarType{}));
     auto func_type = builder.getFunctionType(arg_types, llvm::None);
-    auto function = mlir::FuncOp::create(location, proto.getName(), func_type);
-
-    // Mark the function as generic: it'll require type specialization for every
-    // call site.
-    if (function.getNumArguments())
-      function.setAttr("toy.generic", builder.getUnitAttr());
-    return function;
+    return mlir::FuncOp::create(location, proto.getName(), func_type);
   }
 
   /// Emit a new function and add it to the MLIR module.
index e63b1a3..9b028f6 100644 (file)
@@ -35,8 +35,7 @@ def transpose_transpose(x) {
 Which corresponds to the following IR:
 
 ```MLIR(.mlir)
-func @transpose_transpose(%arg0: tensor<*xf64>) -> tensor<*xf64>
-attributes  {toy.generic} {
+func @transpose_transpose(%arg0: tensor<*xf64>) -> tensor<*xf64> {
   %0 = "toy.transpose"(%arg0) : (tensor<*xf64>) -> tensor<*xf64>
   %1 = "toy.transpose"(%0) : (tensor<*xf64>) -> tensor<*xf64>
   "toy.return"(%1) : (tensor<*xf64>) -> ()
@@ -131,8 +130,7 @@ Finally, we can try to run `toyc-ch3 test/transpose_transpose.toy -emit=mlir -op
 and observe our pattern in action:
 
 ```MLIR(.mlir)
-func @transpose_transpose(%arg0: tensor<*xf64>) -> tensor<*xf64>
-attributes  {toy.generic} {
+func @transpose_transpose(%arg0: tensor<*xf64>) -> tensor<*xf64> {
   %0 = "toy.transpose"(%arg0) : (tensor<*xf64>) -> tensor<*xf64>
   "toy.return"(%arg0) : (tensor<*xf64>) -> ()
 }
@@ -153,8 +151,7 @@ def TransposeOp : Toy_Op<"transpose", [NoSideEffect]> {...}
 Let's retry now `toyc test/transpose_transpose.toy -emit=mlir -opt`:
 
 ```MLIR(.mlir)
-func @transpose_transpose(%arg0: tensor<*xf64>) -> tensor<*xf64>
-attributes  {toy.generic} {
+func @transpose_transpose(%arg0: tensor<*xf64>) -> tensor<*xf64> {
   "toy.return"(%arg0) : (tensor<*xf64>) -> ()
 }
 ```