[Mlir-commits] [mlir] [mlir][tosa] Add acc_type to Tosa-v1.0 Conv Ops (PR #121466)
Luke Hutton
llvmlistbot at llvm.org
Thu Jan 2 02:44:33 PST 2025
================
@@ -271,6 +271,55 @@ LogicalResult tosa::ConstOp::verify() {
return success();
}
+template <typename T>
+static LogicalResult verifyConvOpModes(T op) {
+ auto inputEType =
+ llvm::cast<ShapedType>(op.getInput().getType()).getElementType();
+
+ if (auto quantType =
+ llvm::dyn_cast<mlir::quant::UniformQuantizedType>(inputEType))
+ inputEType = quantType.getStorageType();
+
+ auto accType = op.getAccType();
+ if (inputEType.isInteger(8) && !accType.isInteger(32))
+ return op.emitOpError("accumulator type for i8 tensor is not i32");
----------------
lhutton1 wrote:
In general the dialect can allow a superset of operations to be represented when compared to the specification. I suspect these checks may need relaxing for some users of the tosa dialect. The validation pass can be used in a pipeline to more strictly check for compatibility with the specification.
https://github.com/llvm/llvm-project/pull/121466
More information about the Mlir-commits
mailing list