[Mlir-commits] [mlir] fe8e7e3 - [mlir-linalg-ods-yaml-gen] Fix a bug in getDpsInitsPositionRange

Andrey Turetskiy llvmlistbot at llvm.org
Wed Aug 30 21:09:12 PDT 2023


Author: Andrey Turetskiy
Date: 2023-08-30T21:08:56-07:00
New Revision: fe8e7e30f9a4ad1d3f88f87cd7a0d2eea454b3f2

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

LOG: [mlir-linalg-ods-yaml-gen] Fix a bug in getDpsInitsPositionRange
definition to support operators with multiple outputs.

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

Added: 
    

Modified: 
    mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml
    mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp

Removed: 
    


################################################################################
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 1f7f14a9f51f34..29075cb78a1cc7 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
@@ -82,6 +82,10 @@ structured_op: !LinalgStructuredOpConfig
 #       ODS:    buildStructuredOp($_builder, $_state, resultTensorTypes,
 #  ODS-NEXT:      attributes, Test1Op::getRegionBuilder())
 
+#       ODS:    std::pair<int64_t, int64_t> getDpsInitsPositionRange() {
+#  ODS-NEXT:      int64_t getNumOperands = this->getNumOperands();
+#  ODS-NEXT:      return {getNumOperands - getOutputs().size(), getNumOperands};
+#  ODS-NEXT:    }
 
 # IMPL-LABEL:  void Test1Op::regionBuilder(ImplicitLocOpBuilder &b,
 #  IMPL-NEXT:    Block &block, ArrayRef<NamedAttribute> attrs)

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 7f527197349b32..61cb5537f1df6d 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
@@ -565,7 +565,7 @@ def {0} : LinalgStructuredBase_Op<"{1}", !listconcat([AttrSizedOperandSegments],
 
       std::pair<int64_t, int64_t> getDpsInitsPositionRange() {{
         int64_t getNumOperands = this->getNumOperands();
-        return {{getNumOperands - 1, getNumOperands};
+        return {{getNumOperands - getOutputs().size(), getNumOperands};
       }
 
       // Generic methods.


        


More information about the Mlir-commits mailing list