[Mlir-commits] [mlir] [mlir][bufferization] Introduce reconcileBufferTypeMismatchFn hook (PR #202667)
Andrei Golubev
llvmlistbot at llvm.org
Thu Jun 11 07:55:47 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();
----------------
andrey-golubev wrote:
thanks for asking, i remembered we have a verifier function inside `TensorLikeType`, i believe we can use it here.
i left the `NDEBUG` and also made it through `if (dyn_cast<TensorLikeType>())` to guard against already-bufferized cases - probably good enough so long as it's under `NDEBUG`.
https://github.com/llvm/llvm-project/pull/202667
More information about the Mlir-commits
mailing list