[Mlir-commits] [mlir] [mlir][tosa] Add additional input output dtype verifiers for the foll… (PR #127923)
Luke Hutton
llvmlistbot at llvm.org
Fri Feb 21 07:55:38 PST 2025
================
@@ -852,6 +950,71 @@ LogicalResult tosa::ConcatOp::inferReturnTypeComponents(
return success();
}
+LogicalResult tosa::ConcatOp::verify() {
+ // check that each input has same element type as output
+ auto outType = getOutput().getType();
+ const Operation::operand_range inputList = getInput1();
+
+ for (auto input : inputList) {
+ if (verifySameElementTypes(*this, /* inType = */ input.getType(), outType)
+ .failed()) {
+ return failure();
+ }
+ }
+
+ // Check there is at least one input
+ if (inputList.empty())
+ return emitOpError("expect at least one input");
+
+ const Type firstInputType = inputList.front().getType();
+ const ShapeAdaptor firstInputShape(firstInputType);
+ const int32_t axis = getAxis();
+
+ if (firstInputShape.hasRank()) {
+ // Check axis is in expected range
+ if (axis < 0 || axis >= firstInputShape.getRank())
+ return emitOpError("expect axis to be within range 0 < axis < "
----------------
lhutton1 wrote:
These checks are contrary to the commit message. I'm okay with their addition here, but we may want to update the commit message so others are aware of their addition
https://github.com/llvm/llvm-project/pull/127923
More information about the Mlir-commits
mailing list