Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,13 @@ static IREEOneShotBufferizationOptions getBufferizationOptions() {

// This type converter converts tensor types to memref types when no exact
// memref type can be inferred from the context.
options.unknownTypeConverterFn = [](Value value, Attribute memorySpace,
options.unknownTypeConverterFn = [](TensorType tensorType,
Attribute memorySpace,
const BufferizationOptions &options) {
auto tensorType = llvm::cast<TensorType>(value.getType());

// Special rule for ConstantOps: These always lower to some memref with a
// static identity layout.
if (value.getDefiningOp<arith::ConstantOp>())
if (tensorType.hasStaticShape()) {
return bufferization::getMemRefTypeWithStaticIdentityLayout(tensorType,
memorySpace);

}
// Default case: Fully dynamic layout map for best compatibility.
return bufferization::getMemRefTypeWithFullyDynamicLayout(tensorType,
memorySpace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,16 +886,13 @@ static IREEOneShotBufferizationOptions getBufferizationOptions() {

// This type converter converts tensor types to memref types when no exact
// memref type can be inferred from the context.
options.unknownTypeConverterFn = [](Value value, Attribute memorySpace,
options.unknownTypeConverterFn = [](TensorType tensorType,
Attribute memorySpace,
const BufferizationOptions &options) {
auto tensorType = llvm::cast<TensorType>(value.getType());

// Special rule for ConstantOps: These always lower to some memref with a
// static identity layout.
if (value.getDefiningOp<arith::ConstantOp>())
if (tensorType.hasStaticShape()) {
return bufferization::getMemRefTypeWithStaticIdentityLayout(tensorType,
memorySpace);

}
// Default case: Fully dynamic layout map for best compatibility.
return bufferization::getMemRefTypeWithFullyDynamicLayout(tensorType,
memorySpace);
Expand Down
Loading