diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp @@ -375,12 +375,6 @@ static Type convertBoolMemrefType(const spirv::TargetEnv &targetEnv, const SPIRVTypeConverter::Options &options, MemRefType type) { - if (!type.hasStaticShape()) { - LLVM_DEBUG(llvm::dbgs() - << type << " dynamic shape on i1 is not supported yet\n"); - return nullptr; - } - Optional storageClass = SPIRVTypeConverter::getStorageClassForMemorySpace( type.getMemorySpaceAsInt()); @@ -411,6 +405,12 @@ return nullptr; } + if (!type.hasStaticShape()) { + auto arrayType = + spirv::RuntimeArrayType::get(arrayElemType, *arrayElemSize); + return wrapInStructAndGetPointer(arrayType, *storageClass); + } + int64_t memrefSize = (type.getNumElements() * numBoolBits + 7) / 8; auto arrayElemCount = (memrefSize + *arrayElemSize - 1) / *arrayElemSize; auto arrayType = diff --git a/mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir b/mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir --- a/mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir +++ b/mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir @@ -511,9 +511,10 @@ // CHECK-SAME: memref<*xi32> func @unranked_memref(%arg0: memref<*xi32>) { return } -// Check that dynamic dims on i1 are not supported. // CHECK-LABEL: func @memref_1bit_type -// CHECK-SAME: memref +// CHECK-SAME: !spv.ptr [0])>, StorageBuffer> +// NOEMU-LABEL: func @memref_1bit_type +// NOEMU-SAME: memref func @memref_1bit_type(%arg0: memref) { return } // CHECK-LABEL: func @dynamic_dim_memref