[PATCH] D78671: [mlir/Quant] Allows to use 32 bits storage type

Feng Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 14:41:48 PDT 2020


liufengdb created this revision.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
liufengdb added a reviewer: antiagainst.
liufengdb removed a subscriber: llvm-commits.
liufengdb added a reviewer: stellaraccident.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78671

Files:
  mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp


Index: mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
===================================================================
--- mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
+++ mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
@@ -35,6 +35,15 @@
       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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78671.259396.patch
Type: text/x-patch
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/1dd495cf/attachment.bin>


More information about the llvm-commits mailing list