[llvm] [mlir] [MLIR] Generalize expand_shape to take shape as explicit input (PR #90040)
Gaurav Shukla via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 10:08:56 PDT 2024
================
@@ -2280,14 +2332,28 @@ LogicalResult ExpandShapeOp::verify() {
return emitOpError("expected expanded type to be ")
<< *expectedResultType << " but found " << resultType;
+ if ((int64_t)getStaticOutputShape().size() != resultType.getRank())
+ return emitOpError("expected number of static shape bounds to be equal to "
+ "the output rank (")
+ << resultType.getRank() << ") but found "
+ << getStaticOutputShape().size() << " inputs instead";
+
+ if ((int64_t)getOutputShape().size() !=
+ llvm::count(getStaticOutputShape(), ShapedType::kDynamic))
+ return emitOpError("mismatch in dynamic dims in output_shape and "
+ "static_output_shape: static_output_shape has ")
+ << llvm::count(getStaticOutputShape(), ShapedType::kDynamic)
+ << " dynamic dims while output_shape has " << getOutputShape().size()
+ << " values";
+
----------------
Shukla-Gaurav wrote:
Added test for the first check. The IR representation already takes care of the second check, it's useful while creating the op using builder.create() method.
https://github.com/llvm/llvm-project/pull/90040
More information about the llvm-commits
mailing list