[Mlir-commits] [mlir] Remove redundant checks related to quantized type (PR #110604)
Sandeep Dasgupta
llvmlistbot at llvm.org
Fri Oct 4 09:08:30 PDT 2024
https://github.com/sdasgup3 updated https://github.com/llvm/llvm-project/pull/110604
>From 2461430fb58dbfc7c88d5a0233e2378db95889c8 Mon Sep 17 00:00:00 2001
From: Sandeep Dasgupta <sdasgup at google.com>
Date: Mon, 30 Sep 2024 23:54:29 +0000
Subject: [PATCH] Remove redundant checks related to quantized type
---
mlir/lib/Dialect/Quant/IR/QuantTypes.cpp | 4 ----
mlir/test/Dialect/Quant/parse-uniform-invalid.mlir | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
index ac01b37a553077..7c0d3696486515 100644
--- a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
+++ b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
@@ -322,8 +322,6 @@ LogicalResult UniformQuantizedType::verifyInvariants(
// Verify scale.
double minScale = getMinScale(expressedType);
double maxScale = getMaxScale(expressedType);
- if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale))
- return emitError() << "illegal scale: " << scale;
if (scale < minScale || scale > maxScale)
return emitError() << "scale out of expressed type range [" << minScale
<< ", " << maxScale << "]";
@@ -388,8 +386,6 @@ LogicalResult UniformQuantizedPerAxisType::verifyInvariants(
double minScale = getMinScale(expressedType);
double maxScale = getMaxScale(expressedType);
for (double scale : scales) {
- if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale))
- return emitError() << "illegal scale: " << scale;
if (scale < minScale || scale > maxScale)
return emitError() << "scale out of expressed type range [" << minScale
<< ", " << maxScale << "]";
diff --git a/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir b/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir
index 7613a344cf2b8f..4528d2826a850c 100644
--- a/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir
+++ b/mlir/test/Dialect/Quant/parse-uniform-invalid.mlir
@@ -107,7 +107,7 @@
// -----
// Illegal scale: negative
-// expected-error at +1 {{illegal scale: -1.000000}}
+// expected-error at +1 {{scale out of expressed type range}}
!qalias = !quant.uniform<i8<-4:3>:f32, -1.0:127>
// -----
More information about the Mlir-commits
mailing list