aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorRafael Ubal <rubal@mathworks.com>2024-03-26 10:52:55 -0400
committerGitHub <noreply@github.com>2024-03-26 10:52:55 -0400
commit26d896f3688a8bff6faf85ccce557e320108997f (patch)
treeded9d68f59575c6e25398fb0cfc6d77dae22f5c2 /clang/lib/CodeGen/CodeGenFunction.cpp
parent507e59aa757bdc690ebc0bf69c6d3c84061061a8 (diff)
downloadllvm-26d896f3688a8bff6faf85ccce557e320108997f.zip
llvm-26d896f3688a8bff6faf85ccce557e320108997f.tar.gz
llvm-26d896f3688a8bff6faf85ccce557e320108997f.tar.bz2
Fixes in 'tosa.reshape' lowering and folder (#85798)
- Revamped lowering conversion pattern for `tosa.reshape` to handle previously unsupported combinations of dynamic dimensions in input and output tensors. The lowering strategy continues to rely on pairs `tensor.collapse_shape` + `tensor.expand_shape`, which allow for downstream fusion with surrounding `linalg.generic` ops. - Fixed bug in canonicalization pattern `ReshapeOp::fold()` in `TosaCanonicalizations.cpp`. The input and result types being equal is not a sufficient condition for folding. If there is more than 1 dynamic dimension in the input and result types, a productive reshape could still occur. - This work exposed the fact that bufferization does not properly handle a `tensor.collapse_shape` op producing a 0D tensor from a dynamically shaped one due to a limitation in `memref.collapse_shape`. While the proper way to address this would involve releasing the `memref.collapse_shape` restriction and verifying correct bufferization, this is left as possible future work. For now, this scenario is avoided by casting the `tosa.reshape` input tensor to a static shape if necessary (see `inferReshapeInputType()`. - An extended set of tests are intended to cover relevant conversion paths. Tests are named using pattern `test_reshape_<rank>_{up|down|same}_{s2s|s2d|d2s|d2d}_{explicit|auto}[_empty][_identity]`, where: - `<rank>` is the input rank (e.g., 3d, 6d) - `{up|down|same}` indicates whether the reshape increases, decreases, or retains the input rank. - `{s2s|s2d|d2s|d2d}` indicates whether reshape converts a statically shaped input to a statically shaped result (`s2s`), a statically shaped input to a dynamically shaped result (`s2d`), etc. - `{explicit|auto}` is used to indicate that all values in the `new_shape` attribute are >=0 (`explicit`) or that a -1 placeholder value is used (`auto`). - `empty` is used to indicate that `new_shape` includes a component set to 0. - `identity` is used when the input and result shapes are the same.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions