[Mlir-commits] [mlir] [mlir][bufferization] Introduce reconcileBufferTypeMismatchFn hook (PR #202667)
Matthias Springer
llvmlistbot at llvm.org
Thu Jun 11 02:30:39 PDT 2026
================
@@ -83,28 +81,35 @@ struct OpWithUnstructuredControlFlowBufferizableOpInterfaceExternalModel
if (bufferType == callerType)
continue;
- // If the computed buffer type does not match the computed buffer type
- // of the earlier forwarded operands, fall back to a buffer type with a
- // fully dynamic layout map.
+ // If the computed buffer type does not match the computed buffer type of
+ // the earlier forwarded operands, fall back to a reconciled buffer type.
#ifndef NDEBUG
- if (auto rankedTensorType = dyn_cast<RankedTensorType>(tensorType)) {
- assert(bufferType.hasRank() && callerType.hasRank() &&
- "expected ranked memrefs");
- assert(llvm::all_equal({bufferType.getShape(), callerType.getShape(),
- rankedTensorType.getShape()}) &&
- "expected same shape");
- } else {
- assert(!bufferType.hasRank() && !callerType.hasRank() &&
- "expected unranked memrefs");
+ auto tensorType = value.getType();
----------------
matthias-springer wrote:
The code in this `NDEBUG` block looks outdated. We should probably not hard-code tensor / memref types here. I believe with the current design it's not even guaranteed that a tensor type bufferizes to a memref type (?).
I'm not sure how exactly to fix this. Maybe the entire `NDEBUG` section should just be deleted.
https://github.com/llvm/llvm-project/pull/202667
More information about the Mlir-commits
mailing list