Commit a79579b
authored
[TorchToTosa] cast to match result (#4568)
Fixes aten.clamp conversion when the input tensor type differs from the
result type.
Previously, the lowering created a tosa.cast when promotion was needed,
but still passed the original input to tosa.clamp. This MR updates the
conversion to use the casted value, ensuring cases like si64 input with
f32 clamp bounds lower correctly.
Also adds a regression test covering integer-to-float promotion for
torch.aten.clamp, verifying that the generated TOSA IR casts the input
to f32 before applying tosa.clamp.1 parent eaaa9c2 commit a79579b
4 files changed
Lines changed: 73 additions & 2 deletions
File tree
- lib/Conversion/TorchToTosa
- projects/pt1
- e2e_testing
- python/torch_mlir_e2e_test/test_suite
- test/Conversion/TorchToTosa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6001 | 6001 | | |
6002 | 6002 | | |
6003 | 6003 | | |
| 6004 | + | |
| 6005 | + | |
| 6006 | + | |
| 6007 | + | |
| 6008 | + | |
6004 | 6009 | | |
6005 | 6010 | | |
6006 | 6011 | | |
| 6012 | + | |
| 6013 | + | |
| 6014 | + | |
6007 | 6015 | | |
| 6016 | + | |
| 6017 | + | |
| 6018 | + | |
| 6019 | + | |
| 6020 | + | |
| 6021 | + | |
| 6022 | + | |
6008 | 6023 | | |
6009 | 6024 | | |
6010 | 6025 | | |
| |||
6048 | 6063 | | |
6049 | 6064 | | |
6050 | 6065 | | |
6051 | | - | |
| 6066 | + | |
6052 | 6067 | | |
6053 | 6068 | | |
6054 | 6069 | | |
| |||
6061 | 6076 | | |
6062 | 6077 | | |
6063 | 6078 | | |
6064 | | - | |
| 6079 | + | |
6065 | 6080 | | |
6066 | 6081 | | |
6067 | 6082 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
513 | 514 | | |
514 | 515 | | |
515 | 516 | | |
| 517 | + | |
516 | 518 | | |
517 | 519 | | |
518 | 520 | | |
| |||
548 | 550 | | |
549 | 551 | | |
550 | 552 | | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| |||
2762 | 2765 | | |
2763 | 2766 | | |
2764 | 2767 | | |
| 2768 | + | |
2765 | 2769 | | |
2766 | 2770 | | |
2767 | 2771 | | |
| |||
4074 | 4078 | | |
4075 | 4079 | | |
4076 | 4080 | | |
| 4081 | + | |
4077 | 4082 | | |
4078 | 4083 | | |
4079 | 4084 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1815 | 1815 | | |
1816 | 1816 | | |
1817 | 1817 | | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
1818 | 1841 | | |
1819 | 1842 | | |
1820 | 1843 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1614 | 1614 | | |
1615 | 1615 | | |
1616 | 1616 | | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
1617 | 1645 | | |
1618 | 1646 | | |
1619 | 1647 | | |
| |||
0 commit comments