[Mlir-commits] [mlir] b578c92 - [mlir/Quant] Allows to use 32 bits storage type
Feng Liu
llvmlistbot at llvm.org
Thu Apr 23 11:18:18 PDT 2020
Author: Feng Liu
Date: 2020-04-23T11:18:05-07:00
New Revision: b578c92a98981c2d585d07ba033b52332a0d1cf5
URL: https://github.com/llvm/llvm-project/commit/b578c92a98981c2d585d07ba033b52332a0d1cf5
DIFF: https://github.com/llvm/llvm-project/commit/b578c92a98981c2d585d07ba033b52332a0d1cf5.diff
LOG: [mlir/Quant] Allows to use 32 bits storage type
Differential Revision: https://reviews.llvm.org/D78671
Added:
Modified:
mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp b/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
index 51ed4414f75c..71b7e042aa1a 100644
--- a/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
+++ b/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
@@ -35,6 +35,15 @@ static bool getDefaultStorageParams(unsigned numBits, bool narrowRange,
qmin = 0;
qmax = 65535;
}
+ } else if (numBits <= 32) {
+ storageType = IntegerType::get(32, ctx);
+ if (isSigned) {
+ qmin = std::numeric_limits<int32_t>::min();
+ qmax = std::numeric_limits<int32_t>::max();
+ } else {
+ qmin = std::numeric_limits<uint32_t>::min();
+ qmax = std::numeric_limits<uint32_t>::max();
+ }
} else {
return true;
}
More information about the Mlir-commits
mailing list