torch-mlir/lib/Conversion
Ramiro Leal-Cavazos c9fd78988e
[NFC] Clean-up `ConvertAtenViewOp` in linalg backend (#2470)
While trying to fix a bug in the `ConvertAtenViewOp` pattern in the
linalg backend, I realized that the pattern had become quite complex and
had accumulated some dead code, making it hard to reason about.

This commit simplifies the pattern quite a bit. The main changes are:
1. All the static helper functions in the `ConvertAtenViewOp` class have
been simplified, both in their signature and their body. Each one now
performs simple calculations on arrays, and take the least number of
arguments necessary.
2. The body of [the `while`
loop](9fce566b0c/lib/Conversion/TorchToLinalg/DataMovement.cpp (L407))
inside the main pattern has been changed to work on `MutableArrayRef`
slices, to avoid having to keep track of `start` and `end` indices for
the input and output shape arrays.
3. All the heuristics used to determine the mapping between the input
and output dimensions are now in [this relatively short `if-else`
section](9fce566b0c/lib/Conversion/TorchToLinalg/DataMovement.cpp (L428-L460)),
making it easy to see what is going on.
4. Dead code was eliminated + updates to some of the documentation
comments

This commit does not add any new functionality to the
`ConvertAtenViewOp` pattern.
2023-09-26 09:20:01 -07:00
..
TorchConversionToMLProgram Fix a few missing dependencies. (#2014) 2023-04-11 11:18:49 -07:00
TorchToArith [Torch Dialect] Add canonicalize pattern for aten.is_floating_point (#2194) 2023-06-07 17:05:31 +08:00
TorchToLinalg [NFC] Clean-up `ConvertAtenViewOp` in linalg backend (#2470) 2023-09-26 09:20:01 -07:00
TorchToSCF [build] Update llvm tag to a3f2751f (#2397) 2023-08-15 09:53:28 -07:00
TorchToStablehlo Remove mlir-hlo (replace with stablehlo). (#2460) 2023-09-12 19:10:02 -07:00
TorchToTMTensor Bump llvm-project to f66cd9e9556a53142a26a5c21a72e21f1579217c. (#2466) 2023-09-19 10:50:53 -07:00
TorchToTosa Fixing implicit double to float casts. (#2476) 2023-09-20 10:48:40 -07:00
Utils Fix GCC warning recommending parens. 2023-09-06 00:23:23 -07:00
CMakeLists.txt mhlo: migrate conversion to stablehlo (#1840) 2023-02-02 07:29:47 -06:00
PassDetail.h Minor fixes for `ConvertTorchConversionToMLProgram`. (#1991) 2023-04-04 09:09:58 -07:00
Passes.cpp Remove mlir-hlo (replace with stablehlo). (#2460) 2023-09-12 19:10:02 -07:00