// 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
```
}];
+ 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,
"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;