Skip to content

Commit a74c205

Browse files
committed
Fix
1 parent ac8630b commit a74c205

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

mlir/test/lib/Dialect/Test/TestDialect.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ mlir::LogicalResult test::TestDummyTensorOp::bufferize(
482482
const mlir::bufferization::BufferizationOptions &options) {
483483
const auto inputType = getInput().getType();
484484
const auto bufferizedInputType = test::TestMemrefType::get(
485-
getContext(), inputType.getShape(), inputType.getElementType(), nullptr);
485+
getContext(), inputType.getShape(), inputType.getElementType(), nullptr, 0);
486486
const auto outputType = getOutput().getType();
487487
const auto bufferizedOutputType =
488488
test::TestMemrefType::get(getContext(), outputType.getShape(),
489-
outputType.getElementType(), nullptr);
489+
outputType.getElementType(), nullptr, 0);
490490

491491
// replace op with memref analogy, preserve correct types at the boundaries
492492
auto toMemref = rewriter.create<mlir::bufferization::ToMemrefOp>(

mlir/test/lib/Dialect/Test/TestTypeDefs.td

+7-3
Original file line numberDiff line numberDiff line change
@@ -421,23 +421,27 @@ def TestMemrefType : Test_Type<"TestMemref", [BaseMemRefTypeInterface]> {
421421
let parameters = (ins
422422
ArrayRefParameter<"int64_t">:$shape,
423423
"mlir::Type":$elementType,
424-
DefaultValuedParameter<"mlir::Attribute", "nullptr">:$memSpace
424+
DefaultValuedParameter<"mlir::Attribute", "nullptr">:$memSpace,
425+
DefaultValuedParameter<"unsigned", "0">:$memSpaceAsInt
425426
);
426-
let assemblyFormat = "`<` `[` $shape `]` `,` $elementType (`,` $memSpace^)? `>`";
427+
let assemblyFormat = "`<` `[` $shape `]` `,` $elementType (`,` $memSpace^)? (`,` $memSpaceAsInt^)? `>`";
427428

428429
let extraClassDeclaration = [{
429430
// ShapedTypeInterface:
430431
bool hasRank() const {
431432
return true;
432433
}
433434
mlir::ShapedType cloneWith(std::optional<llvm::ArrayRef<int64_t>> shape, mlir::Type elementType) const {
434-
return test::TestMemrefType::get(getContext(), shape.value_or(getShape()), elementType, getMemSpace());
435+
return test::TestMemrefType::get(getContext(), shape.value_or(getShape()), elementType, getMemSpace(), getMemSpaceAsInt());
435436
}
436437

437438
// BaseMemRefTypeInterface:
438439
mlir::Attribute getMemorySpace() const {
439440
return getMemSpace();
440441
}
442+
unsigned getMemorySpaceAsInt() const {
443+
return getMemSpaceAsInt();
444+
}
441445
}];
442446
}
443447

0 commit comments

Comments
 (0)