[Mlir-commits] [clang] [llvm] [mlir] [AMDGPU] Add the support for 45-bit buffer resource (PR #159702)

Jakub Kuderski llvmlistbot at llvm.org
Tue Sep 23 07:38:48 PDT 2025


================
@@ -95,17 +114,15 @@ static Value getNumRecords(ConversionPatternRewriter &rewriter, Location loc,
                            MemRefType memrefType,
                            MemRefDescriptor &memrefDescriptor,
                            ArrayRef<int64_t> strides,
-                           uint32_t elementByteWidth) {
+                           int64_t elementByteWidth) {
   if (memrefType.hasStaticShape() &&
       !llvm::any_of(strides, ShapedType::isDynamic)) {
     int64_t size = memrefType.getRank() == 0 ? 1 : 0;
     ArrayRef<int64_t> shape = memrefType.getShape();
     for (uint32_t i = 0, e = memrefType.getRank(); i < e; ++i)
       size = std::max(shape[i] * strides[i], size);
     size = size * elementByteWidth;
-    assert(size < std::numeric_limits<uint32_t>::max() &&
-           "the memref buffer is too large");
-    return createI32Constant(rewriter, loc, static_cast<int32_t>(size));
+    return createI64Constant(rewriter, loc, static_cast<int32_t>(size));
----------------
kuhar wrote:

Can we at least assert this is in range for int32?

https://github.com/llvm/llvm-project/pull/159702


More information about the Mlir-commits mailing list