Issue 208382
Summary [bufferization] generate unexpected layout for CastOp when their layouts of input and output are different
Labels new issue
Assignees
Reporter vfdff
    * For example, the input layout is nN, while don't record the output layout 
```
%cast = tensor.cast %8 : tensor<?x?x32xbfp8, {data_layout = #hivm.data_layout<nN>}>  to tensor<?x32x32xbfp8>
```
* After OneShotBufferizePass, becomes:
```
cast = memref.cast %alloc_2  : memref<?x?x32xbfp8, {data_layout = #hivm.data_layout<nN>}> to memref<?x32x32xbfp8, {data_layout = #hivm.data_layout<nN>}>
```

* This bacause the getBufferType of **CastOpInterface** copies srcBufferType.getLayout() as the result memref layout, ignoring the target tensor's actual layout attributes. When target tensor has no custom layout.
https://github.com/llvm/llvm-project/blob/bea7080fe3ce45d397c2aefda3e27dff868f7746/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp#L85
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to