[Mlir-commits] [mlir] 84354b2 - [mlir][linalg] Remove GenericOpBase.
Tobias Gysi
llvmlistbot at llvm.org
Thu Jul 8 01:37:27 PDT 2021
Author: Tobias Gysi
Date: 2021-07-08T08:35:28Z
New Revision: 84354b2ab20924b3807c0464308852e4568b63a3
URL: https://github.com/llvm/llvm-project/commit/84354b2ab20924b3807c0464308852e4568b63a3
DIFF: https://github.com/llvm/llvm-project/commit/84354b2ab20924b3807c0464308852e4568b63a3.diff
LOG: [mlir][linalg] Remove GenericOpBase.
Remove the GenericOpBase class formerly used to factor out common logic shared be GenericOp and IndexedGenericOp. After removing IndexedGenericOp, the base class is not used anymore.
Differential Revision: https://reviews.llvm.org/D105307
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 18f5beeddf2ea..fa17237216596 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -503,41 +503,10 @@ def PoolingSumOp: SingleInputPoolingBase_Op<"pooling_sum"> {
// Generic Linalg ops.
//===----------------------------------------------------------------------===//
-class GenericOpBase<string mnemonic> : LinalgStructuredBase_Op<mnemonic, [
+def GenericOp : LinalgStructuredBase_Op<"generic", [
AttrSizedOperandSegments,
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
SingleBlockImplicitTerminator<"YieldOp">]> {
- let arguments = (ins Variadic<AnyType>:$inputs,
- Variadic<AnyShaped>:$outputs,
- AffineMapArrayAttr:$indexing_maps,
- ArrayAttr:$iterator_types,
- OptionalAttr<StrAttr>:$doc,
- OptionalAttr<StrAttr>:$library_call);
- let results = (outs Variadic<AnyRankedTensor>:$result_tensors);
- let regions = (region AnyRegion:$region);
- let extraClassDeclaration = structuredOpsBaseDecls # [{
- SmallVector<StringRef, 8> linalgTraitAttrNames() {
- return SmallVector<StringRef, 8>{
- getDocAttrName(),
- getIndexingMapsAttrName(), getLibraryCallAttrName(),
- getIteratorTypesAttrName(),
- };
- }
- std::string getLibraryCallName() {
- return library_call().hasValue() ?
- library_call()->str() : "op_has_no_registered_library_name";
- }
-
- static std::function<void(ImplicitLocOpBuilder &b, Block &block)>
- getRegionBuilder() {
- return nullptr;
- }
- }];
- let printer = [{ return ::print(p, *this); }];
- let parser = [{ return ::parseGenericOp(parser, result); }];
-}
-
-def GenericOp : GenericOpBase<"generic"> {
let description = [{
Generic Linalg op form where the key properties of the computation are
specified as attributes. In pretty form, a `linalg.generic` op is written
@@ -636,6 +605,15 @@ def GenericOp : GenericOpBase<"generic"> {
```
}];
+ let arguments = (ins Variadic<AnyType>:$inputs,
+ Variadic<AnyShaped>:$outputs,
+ AffineMapArrayAttr:$indexing_maps,
+ ArrayAttr:$iterator_types,
+ OptionalAttr<StrAttr>:$doc,
+ OptionalAttr<StrAttr>:$library_call);
+ let results = (outs Variadic<AnyRankedTensor>:$result_tensors);
+ let regions = (region AnyRegion:$region);
+
let builders = [
OpBuilder<(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
"ValueRange":$outputs, "ArrayRef<AffineMap>":$indexingMaps,
@@ -654,6 +632,29 @@ def GenericOp : GenericOpBase<"generic"> {
"ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>
];
+
+ let extraClassDeclaration = structuredOpsBaseDecls # [{
+ SmallVector<StringRef, 8> linalgTraitAttrNames() {
+ return SmallVector<StringRef, 8>{
+ getDocAttrName(),
+ getIndexingMapsAttrName(), getLibraryCallAttrName(),
+ getIteratorTypesAttrName(),
+ };
+ }
+ std::string getLibraryCallName() {
+ return library_call().hasValue() ?
+ library_call()->str() : "op_has_no_registered_library_name";
+ }
+
+ static std::function<void(ImplicitLocOpBuilder &b, Block &block)>
+ getRegionBuilder() {
+ return nullptr;
+ }
+ }];
+
+ let printer = [{ return ::print(p, *this); }];
+ let parser = [{ return ::parseGenericOp(parser, result); }];
+
let verifier = [{ return ::verify(*this); }];
let hasFolder = 1;
More information about the Mlir-commits
mailing list