[Mlir-commits] [mlir] [mlir[tosa] Switch zero point of avgpool2d to input variable type (PR #128983)

Jack Frankland llvmlistbot at llvm.org
Thu Feb 27 06:42:13 PST 2025


================
@@ -455,18 +455,10 @@ LogicalResult tosa::ArgMaxOp::verify() {
 }
 
 LogicalResult tosa::AvgPool2dOp::verify() {
-  auto inputType = llvm::cast<ShapedType>(getInput().getType());
-
-  auto inputETy = inputType.getElementType();
-  auto resultETy = llvm::cast<ShapedType>(getType()).getElementType();
-
-  if (auto quantType =
-          llvm::dyn_cast<mlir::quant::UniformQuantizedType>(inputETy))
-    inputETy = quantType.getStorageType();
-
-  if (auto quantType =
-          llvm::dyn_cast<mlir::quant::UniformQuantizedType>(resultETy))
-    resultETy = quantType.getStorageType();
+  const Type inputETy = getStorageElementTypeOrSelf(getInput().getType());
----------------
FranklandJack wrote:

MLIR's `Type` class isn't `const` correct so I think this `const` should be removed (same below): https://mlir.llvm.org/docs/Rationale/UsageOfConst/.

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


More information about the Mlir-commits mailing list