Skip to content

Remove redundant checks related to quantized type #110604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "]";
Expand Down Expand Up @@ -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 << "]";
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/Quant/parse-uniform-invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

// -----
// Illegal scale: negative
// expected-error@+1 {{illegal scale: -1.000000}}
// expected-error@+1 {{scale out of expressed type range}}
!qalias = !quant.uniform<i8<-4:3>:f32, -1.0:127>

// -----
Expand Down
Loading