[Mlir-commits] [mlir] [mlir][Tosa] fix fp16/bf16 support for Clamp min/max attributes (PR #69192)

Georgios Pinitas llvmlistbot at llvm.org
Thu Oct 19 09:23:56 PDT 2023


================
@@ -266,6 +266,32 @@ LogicalResult tosa::AvgPool2dOp::verify() {
   return emitOpError("input/output element types are incompatible.");
 }
 
+LogicalResult tosa::ClampOp::verify() {
+  mlir::Type inputDT =
+      llvm::cast<ShapedType>(getInput().getType()).getElementType();
+  mlir::Type maxFpDT = getMaxFpAttr().getType();
+  mlir::Type minFpDT = getMinFpAttr().getType();
+  mlir::Type outputDT =
+      llvm::cast<ShapedType>(getOutput().getType()).getElementType();
+  unsigned dataTypeBitWidth = inputDT.getIntOrFloatBitWidth();
+
+  if (!(inputDT.getTypeID() == outputDT.getTypeID()))
----------------
GeorgeARM wrote:

Can't we just compare the IO element types?

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


More information about the Mlir-commits mailing list