[Mlir-commits] [mlir] 16ffb28 - Revert "[mlir][Linalg] Allow all build methods of Structured ops to specify additional attributes."
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Aug 19 11:54:19 PDT 2021
Author: MaheshRavishankar
Date: 2021-08-19T11:53:41-07:00
New Revision: 16ffb283c5e49ccb00f450d6d7aaa5af75cce544
URL: https://github.com/llvm/llvm-project/commit/16ffb283c5e49ccb00f450d6d7aaa5af75cce544
DIFF: https://github.com/llvm/llvm-project/commit/16ffb283c5e49ccb00f450d6d7aaa5af75cce544.diff
LOG: Revert "[mlir][Linalg] Allow all build methods of Structured ops to specify additional attributes."
This reverts commit 95ddc8341ae2c27229ad3dcf1d55abebcec15d02.
Differential Revision: https://reviews.llvm.org/D108396
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 1d4e6d546067e..33f4992e41f9d 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -620,22 +620,18 @@ def GenericOp : LinalgStructuredBase_Op<"generic", [
"ValueRange":$outputs, "ArrayRef<AffineMap>":$indexingMaps,
"ArrayRef<StringRef>":$iteratorTypes, "StringRef":$doc,
"StringRef":$libraryCall,
- CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>,
OpBuilder<(ins "ValueRange":$inputs, "ValueRange":$outputBuffers,
"ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
"StringRef":$doc, "StringRef":$libraryCall,
- CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>,
OpBuilder<(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
"ValueRange":$outputs, "ArrayRef<AffineMap>":$indexingMaps,
"ArrayRef<StringRef>":$iteratorTypes,
- CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>,
OpBuilder<(ins "ValueRange":$inputs, "ValueRange":$outputBuffers,
"ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
- CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>
];
let extraClassDeclaration = structuredOpsBaseDecls # [{
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index f4750ca390a88..6b65a9ecd9e51 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -502,15 +502,13 @@ void GenericOp::build(
OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,
ValueRange inputs, ValueRange outputs, ArrayRef<AffineMap> indexingMaps,
ArrayRef<StringRef> iteratorTypes, StringRef doc, StringRef libraryCall,
- function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild,
- ArrayRef<NamedAttribute> attributes) {
+ function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
build(builder, result, resultTensorTypes, inputs, outputs,
builder.getAffineMapArrayAttr(indexingMaps),
builder.getStrArrayAttr(iteratorTypes),
doc.empty() ? StringAttr() : builder.getStringAttr(doc),
libraryCall.empty() ? StringAttr()
: builder.getStringAttr(libraryCall));
- result.addAttributes(attributes);
if (!bodyBuild)
return;
@@ -529,33 +527,30 @@ void GenericOp::build(
OpBuilder &builder, OperationState &result, ValueRange inputs,
ValueRange outputs, ArrayRef<AffineMap> indexingMaps,
ArrayRef<StringRef> iteratorTypes, StringRef doc, StringRef libraryCall,
- function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild,
- ArrayRef<NamedAttribute> attributes) {
+ function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
build(builder, result, TypeRange{}, inputs, outputs, indexingMaps,
- iteratorTypes, doc, libraryCall, bodyBuild, attributes);
+ iteratorTypes, doc, libraryCall, bodyBuild);
}
void GenericOp::build(
OpBuilder &builder, OperationState &result, ValueRange inputs,
ValueRange outputs, ArrayRef<AffineMap> indexingMaps,
ArrayRef<StringRef> iteratorTypes,
- function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild,
- ArrayRef<NamedAttribute> attributes) {
+ function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
build(builder, result, inputs, outputs, indexingMaps, iteratorTypes,
/*doc=*/"",
- /*libraryCall=*/"", bodyBuild, attributes);
+ /*libraryCall=*/"", bodyBuild);
}
void GenericOp::build(
OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,
ValueRange inputs, ValueRange outputs, ArrayRef<AffineMap> indexingMaps,
ArrayRef<StringRef> iteratorTypes,
- function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild,
- ArrayRef<NamedAttribute> attributes) {
+ function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
build(builder, result, resultTensorTypes, inputs, outputs, indexingMaps,
iteratorTypes,
/*doc=*/"",
- /*libraryCall=*/"", bodyBuild, attributes);
+ /*libraryCall=*/"", bodyBuild);
}
static void print(OpAsmPrinter &p, GenericOp op) {
diff --git a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
index 743bdbdb12d6a..471961f837bf3 100644
--- a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
+++ b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
@@ -169,8 +169,7 @@ It has one output.
// ODS-LABEL: def Test7Op
// ODS: OpBuilder<
// ODS: (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
-// ODS: "ValueRange":$outputs, "Attribute":$attr_a, "Attribute":$attr_b,
-// ODS: CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)
+// ODS: "ValueRange":$outputs, "Attribute":$attr_a, "Attribute":$attr_b)
// ODS: $_state.addAttribute("attr_a", attr_a);
// ODS: $_state.addAttribute("attr_b", attr_b);
//
diff --git a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml
index f8393a232e43e..6613ab2a006f1 100644
--- a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml
+++ b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml
@@ -75,7 +75,6 @@ structured_op: !LinalgStructuredOpConfig
# ODS-NEXT: $_builder.getI32VectorAttr({
# ODS-NEXT: static_cast<int32_t>(inputs.size()),
# ODS-NEXT: static_cast<int32_t>(outputs.size())}));
-# ODS-NEXT: $_state.addAttributes(attributes);
# ODS-NEXT: createAndFillStructuredOpRegion<Test1Op>(
# ODS-NEXT: $_builder,
# ODS-NEXT: $_state,
diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
index 590f17fdedfa2..1bdb5b8806d0d 100644
--- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
+++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
@@ -1910,8 +1910,7 @@ void TCParser::printODS(llvm::raw_ostream &os, StringRef cppOpName,
let skipDefaultBuilders = 1;
let builders = [
OpBuilder<
- (ins "ValueRange":$inputs, "ValueRange":$outputs,
- CArg<"ArrayRef<NamedAttribute>", "{{}">:$attributes),
+ (ins "ValueRange":$inputs, "ValueRange":$outputs),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputs);
@@ -1920,7 +1919,6 @@ void TCParser::printODS(llvm::raw_ostream &os, StringRef cppOpName,
$_builder.getI32VectorAttr({{
static_cast<int32_t>(inputs.size()),
static_cast<int32_t>(outputs.size())}));
- $_state.addAttributes(attributes);
createAndFillStructuredOpRegion<{0}>(
$_builder,
$_state,
@@ -1929,8 +1927,7 @@ void TCParser::printODS(llvm::raw_ostream &os, StringRef cppOpName,
}]>,
OpBuilder<
(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
- "ValueRange":$outputs,
- CArg<"ArrayRef<NamedAttribute>", "{{}">:$attributes),
+ "ValueRange":$outputs),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputs);
@@ -1940,7 +1937,6 @@ void TCParser::printODS(llvm::raw_ostream &os, StringRef cppOpName,
$_builder.getI32VectorAttr({{
static_cast<int32_t>(inputs.size()),
static_cast<int32_t>(outputs.size())}));
- $_state.addAttributes(attributes);
createAndFillStructuredOpRegion<{0}>(
$_builder,
$_state,
@@ -2024,8 +2020,7 @@ void TCParser::printODS(llvm::raw_ostream &os, StringRef cppOpName,
const char *builderFmt = R"FMT(
, OpBuilder<
(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
- "ValueRange":$outputs, {1},
- CArg<"ArrayRef<NamedAttribute>", "{{}">:$attributes),
+ "ValueRange":$outputs, {1}),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputs);
@@ -2035,7 +2030,6 @@ void TCParser::printODS(llvm::raw_ostream &os, StringRef cppOpName,
$_builder.getI32VectorAttr({{
static_cast<int32_t>(inputs.size()),
static_cast<int32_t>(outputs.size())}));
- $_state.addAttributes(attributes);
createAndFillStructuredOpRegion<{0}>(
$_builder,
$_state,
diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
index 98e90b69d631d..a0eb1dea88603 100644
--- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
+++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
@@ -457,8 +457,7 @@ def {0} : LinalgStructuredBase_Op<"{1}", !listconcat([
let skipDefaultBuilders = 1;
let builders = [
OpBuilder<
- (ins "ValueRange":$inputs, "ValueRange":$outputs,
- CArg<"ArrayRef<NamedAttribute>", "{{}">:$attributes),
+ (ins "ValueRange":$inputs, "ValueRange":$outputs),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputs);
@@ -472,7 +471,6 @@ def {0} : LinalgStructuredBase_Op<"{1}", !listconcat([
$_builder.getI32VectorAttr({{
static_cast<int32_t>(inputs.size()),
static_cast<int32_t>(outputs.size())}));
- $_state.addAttributes(attributes);
createAndFillStructuredOpRegion<{0}>(
$_builder,
$_state,
@@ -541,8 +539,7 @@ def {0} : LinalgStructuredBase_Op<"{1}", !listconcat([
static const char structuredOpBuilderFormat[] = R"FMT(
, OpBuilder<
(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
- "ValueRange":$outputs, {1},
- CArg<"ArrayRef<NamedAttribute>", "{{}">:$attributes),
+ "ValueRange":$outputs, {1}),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputs);
@@ -558,7 +555,6 @@ static const char structuredOpBuilderFormat[] = R"FMT(
TypeRange(inputs),
TypeRange(outputs));
{2}
- $_state.addAttributes(attributes);
}]>
)FMT";
More information about the Mlir-commits
mailing list