At this point, the op should be limited to being entirely bufferized or not at all bufferized. Can you add this check to the verify method also? It could be as a followup as there's no very method currently.
I say this because partial bufferization along with this method would be very confusing and could easily lead to incorrect assumptions/bugs
clang tidy checks
This system relies on the assumption that a tiled loop with iteration patterns [parallel, sequential, parallel, sequential] can be reordered to [parallel, parallel, sequential, sequential]. Is that true and specified?
Maybe use builder here. This is relying on the caller of this never creating a new OpBuilfer from the rewriter passed to it (relying on two objects actually being the same). That could be easy to break and annoying to debug.
I don't think this is enough. If one op uses the result of another op in the body, I think it will still point to the original op rather than the new one.
Will result in
Unfortunately, comprehensive bufferization relies on tiled_loop with mixed buffers-tensors. It adds bufferized memref operands to the tiled_loop without removing the tensor ones and then canonicalization kicks in to clean this up. It does this because it has to be in-place.
I think it is true for the tiling that we support, since we are generating a perfectly nested loop where loop ctrl vars don't depend on each other. I will add a comment.
good catch, thanks.
builder.clone(op, bvm) also maps old results to new ones.
What do you think about a name that specifies the "only" fact? hasNoTensorSemantics or hasOnlyBufferSemantics.
hasBufferSemantics is what's used by mlir/Dialect/Linalg/IR/LinalgInterfaces.td