torch-mlir/lib/Conversion
Ze Zhang b3942ff984
Add canonicalize pattern for aten.mul.int and aten.floordiv.int (#3680)
This PR add `floordiv` to the `PY_BUILTIN_TO_TORCH_OP`. For
`aten.mul.int` and `aten.floordiv.int` ops, we add new Canonicalization
Patterns as follow:

```
%1 = torch.aten.mul.int %input, %const-5
%2 = torch.aten.mul.int %1, %const-6
```

Will be replaced by

`torch.aten.mul.int %input, %const-30`


And 

```
%1 = torch.aten.mul.int %input, %const-5
%2 = torch.aten.floordiv.int %1, %const-5
```
Will directly return `%input`


This PR also relaxes the `float` type constraint in TorchToTosa for the
`AtenRsubScalarOp` conversion.



To test:

`cmake --build build --target check-torch-mlir-all`
2024-09-03 09:13:59 -07:00
..
TorchConversionToMLProgram [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
TorchOnnxToTorch Fix onnx.Gather lowering with dynamic shapes (#3675) 2024-08-29 17:02:16 -07:00
TorchToArith [TorchToArith] Add a lowering for `torch.add.float_int` (#3594) 2024-08-07 11:55:27 -05:00
TorchToLinalg [MLIR][TORCH] Add E2E support for aten.polar op (#3671) 2024-09-03 10:51:03 +05:30
TorchToSCF [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
TorchToStablehlo [Stablehlo] use stablehlo specs lowering AtenSliceScatterOp (#3592) 2024-08-15 20:06:29 +08:00
TorchToTMTensor build: manually update PyTorch version (#3627) 2024-08-19 12:03:56 +05:30
TorchToTensor [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
TorchToTosa Add canonicalize pattern for aten.mul.int and aten.floordiv.int (#3680) 2024-09-03 09:13:59 -07:00
Utils Added support for integer to complex conversion (#3604) 2024-08-14 18:13:00 +05:30
CMakeLists.txt [torch] Improve shape inference for `torch-to-linalg` path for reshapes (#3055) 2024-03-26 12:41:40 -07:00
PassDetail.h Minor fixes for `ConvertTorchConversionToMLProgram`. (#1991) 2023-04-04 09:09:58 -07:00
Passes.cpp Clang format refresh (#2812) 2024-01-29 12:59:33 -05:00