This change adds support in finalizing-bufferize for IR such as:
%0 = bufferization.to_tensor %m : memref<?xf32, affine_map<(d0)[s0] -> (d0 + s0)> %1 = bufferization.to_memref %0 : memref<?xf32>
Depending on the exact source/dest type, this folds to a memref.cast or requires a reallocation + copy.
Memref types with non-standard layouts are required to support non-copying tensor.extact_slice ops.
Note: Dest memref types with non-standard layouts are not yet supported.
The goal of this commit is to ease the transition towards One-Shot Bufferization. This change allows us to remove the existing, partial, copying bufferization pattern of tensor.extract_slice and replace it with the non-copying, BufferizableOpInterface-based variant.
Depends On D119937
It's a bit of delay, but I am using OneShot now and I have a question regarding this line..
Why do we want memory space to match?
In test/Dialect/Tensor/one-shot-bufferize.mlir:268 we have an example of a memref.copy where src and dst have different memory space.
I tried to remove the check in line 31. I fail on canonicalization test since canonicalizer uses this method too.
Is there a difference between canonicalizer & OneShot approaches?