Skip to content

Commit eb51e55

Browse files
Revert "[mlir][bufferization] Convert tensor enconding -> memref layout"
This reverts commit 94419f2.
1 parent a6c3ef2 commit eb51e55

File tree

5 files changed

+2
-197
lines changed

5 files changed

+2
-197
lines changed

mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,6 @@ struct BufferizationOptions {
272272
// Produce a MemorySpace attribute from a tensor type
273273
using DefaultMemorySpaceFn =
274274
std::function<std::optional<Attribute>(TensorType t)>;
275-
/// Construct a MemRefLayoutAttrInterface from a tensor type.
276-
using ConstructMemRefLayoutFn =
277-
std::function<MemRefLayoutAttrInterface(TensorType t)>;
278275

279276
BufferizationOptions();
280277

@@ -367,12 +364,6 @@ struct BufferizationOptions {
367364
DefaultMemorySpaceFn defaultMemorySpaceFn =
368365
[](TensorType t) -> std::optional<Attribute> { return Attribute(); };
369366

370-
/// Construction function used to determine the memref layout based on the
371-
/// original tensor type. Can be used to specialize tensor encoding -> memref
372-
/// layout conversion. By default, it is unset, making the layout construction
373-
/// behavior depend on the place where it is used.
374-
ConstructMemRefLayoutFn constructMemRefLayoutFn = nullptr;
375-
376367
/// If set to `true`, the analysis is skipped. A buffer is copied before every
377368
/// write. This flag cannot be used together with `testAnalysisOnly = true`.
378369
bool copyBeforeWrite = false;

mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ struct BuiltinTensorExternalModel
6565
auto memSpace = options.defaultMemorySpaceFn(tensorType);
6666
if (!memSpace.has_value())
6767
return emitError() << "could not infer memory space";
68-
MemRefLayoutAttrInterface layout = {};
69-
if (options.constructMemRefLayoutFn)
70-
layout = options.constructMemRefLayoutFn(tensorType);
7168

7269
return cast<BufferLikeType>(
73-
getMemRefType(tensorType, options, layout, *memSpace));
70+
getMemRefType(tensorType, options, /*layout=*/{}, *memSpace));
7471
}
7572

7673
mlir::LogicalResult verifyCompatibleBufferType(

mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,6 @@ AllocTensorOp::getBufferType(Value value, const BufferizationOptions &options,
244244
return getOperation()->emitError("could not infer memory space");
245245
}
246246

247-
// Note: Only rely on TensorLikeType::getBufferType() if memref layout is
248-
// explicitly specified by the user. Otherwise, the default behavior is to
249-
// return a fully dynamic layout map which is the opposite of the default
250-
// behavior of this function.
251-
if (options.constructMemRefLayoutFn) {
252-
return cast<TensorLikeType>(getType()).getBufferType(
253-
options, [&]() { return emitError(); });
254-
}
255-
256247
return cast<BufferLikeType>(
257248
getMemRefTypeWithStaticIdentityLayout(getType(), memorySpace));
258249
}
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
add_mlir_unittest(MLIRTransformsTests
22
Canonicalizer.cpp
33
DialectConversion.cpp
4-
OneShotBufferization.cpp
54
)
65
mlir_target_link_libraries(MLIRTransformsTests
76
PRIVATE
87
MLIRParser
9-
MLIRTransforms
10-
MLIRBufferizationTransforms
11-
)
8+
MLIRTransforms)

mlir/unittests/Transforms/OneShotBufferization.cpp

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)