15 int64_t expectedCount = type.getNumDynamicDims();
16 int64_t actualCount = dynamicSizes.size();
17 if (expectedCount != actualCount) {
18 return op->
emitOpError(
"incorrect number of dynamic sizes, has ")
19 << actualCount <<
", expected " << expectedCount;
25 ShapedType
rhs, StringRef lhsName,
27 if (!
lhs.hasRank() || !
rhs.hasRank())
34 << lhsName <<
" rank (" << rank1 <<
") does not match " << rhsName
35 <<
" rank (" << rank2 <<
")";
41 ShapedType
rhs, StringRef lhsName,
43 Type lhsElementType =
lhs.getElementType();
44 Type rhsElementType =
rhs.getElementType();
45 if (lhsElementType != rhsElementType) {
46 return op->
emitOpError() << lhsName <<
" element type (" << lhsElementType
47 <<
") does not match " << rhsName
48 <<
" element type (" << rhsElementType <<
")";
Operation is the basic unit of execution within MLIR.
InFlightDiagnostic emitOpError(const Twine &message={})
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
Include the generated interface declarations.
LogicalResult verifyDynamicDimensionCount(Operation *op, ShapedType type, ValueRange dynamicSizes)
Verify that the number of dynamic size operands matches the number of dynamic dimensions in the shape...
LogicalResult verifyRanksMatch(Operation *op, ShapedType lhs, ShapedType rhs, StringRef lhsName, StringRef rhsName)
Verify that two shaped types have matching ranks.
LogicalResult verifyElementTypesMatch(Operation *op, ShapedType lhs, ShapedType rhs, StringRef lhsName, StringRef rhsName)
Verify that two shaped types have matching element types.