[Mlir-commits] [mlir] bc8acf2 - Update the maximum integer bitwidth in MLIR.

Andrew Lenharth llvmlistbot at llvm.org
Fri Jan 8 15:28:53 PST 2021


Author: Andrew Lenharth
Date: 2021-01-08T17:28:24-06:00
New Revision: bc8acf2ce8ad6e8c9b1d97b2e02d3f4ad26e1d9d

URL: https://github.com/llvm/llvm-project/commit/bc8acf2ce8ad6e8c9b1d97b2e02d3f4ad26e1d9d
DIFF: https://github.com/llvm/llvm-project/commit/bc8acf2ce8ad6e8c9b1d97b2e02d3f4ad26e1d9d.diff

LOG: Update the maximum integer bitwidth in MLIR.

Large integers are generated in Circt commonly which exceed 4kbits.  This aligns the maximum bitwidth in MLIR and LLVM.

Reviewed By: rriddle, lattner, mehdi_amini

Differential Revision: https://reviews.llvm.org/D94116

Added: 
    

Modified: 
    mlir/include/mlir/IR/BuiltinTypes.h
    mlir/test/IR/invalid-ops.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/BuiltinTypes.h b/mlir/include/mlir/IR/BuiltinTypes.h
index 3bfb3ce4c79b..d9d1a6e4e68c 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.h
+++ b/mlir/include/mlir/IR/BuiltinTypes.h
@@ -139,7 +139,7 @@ class IntegerType
   IntegerType scaleElementBitwidth(unsigned scale);
 
   /// Integer representation maximal bitwidth.
-  static constexpr unsigned kMaxWidth = 4096;
+  static constexpr unsigned kMaxWidth = (1 << 24) - 1; // Aligned with LLVM
 };
 
 //===----------------------------------------------------------------------===//

diff  --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir
index 0b41f4002ad1..595e3fe3f123 100644
--- a/mlir/test/IR/invalid-ops.mlir
+++ b/mlir/test/IR/invalid-ops.mlir
@@ -135,8 +135,8 @@ func @test_alloc_memref_map_rank_mismatch() {
 
 func @intlimit2() {
 ^bb:
-  %0 = "std.constant"() {value = 0} : () -> i4096
-  %1 = "std.constant"() {value = 1} : () -> i4097 // expected-error {{integer bitwidth is limited to 4096 bits}}
+  %0 = "std.constant"() {value = 0} : () -> i16777215
+  %1 = "std.constant"() {value = 1} : () -> i16777216 // expected-error {{integer bitwidth is limited to 16777215 bits}}
   return
 }
 


        


More information about the Mlir-commits mailing list