[Mlir-commits] [mlir] [mlir][tosa] Add additional input output dtype verifiers for the foll… (PR #127923)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 21 13:26:44 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 < "
----------------
Jerry-Ge wrote:

added. 

https://github.com/llvm/llvm-project/pull/127923


More information about the Mlir-commits mailing list