Skip to content

Commit 7c5b417

Browse files
committed
[mlir][memref]: Fix Bug in GlobalOp Verifier
When reconstructing the corresponding tensor type of a memref ensure we include the memory space of the tensor if it exists. Signed-off-by: Jack Frankland <[email protected]>
1 parent 148111f commit 7c5b417

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ LogicalResult mlir::memref::foldMemRefCast(Operation *op, Value inner) {
5959
/// type.
6060
Type mlir::memref::getTensorTypeFromMemRefType(Type type) {
6161
if (auto memref = llvm::dyn_cast<MemRefType>(type))
62-
return RankedTensorType::get(memref.getShape(), memref.getElementType());
62+
return RankedTensorType::get(memref.getShape(), memref.getElementType(),
63+
memref.getMemorySpace());
6364
if (auto memref = llvm::dyn_cast<UnrankedMemRefType>(type))
6465
return UnrankedTensorType::get(memref.getElementType());
6566
return NoneType::get(type.getContext());

0 commit comments

Comments
 (0)