Commit Graph

1727 Commits (revert-1935-merge-main)
 

Author SHA1 Message Date
Ramiro Leal-Cavazos ca224bcf17 Revert "Merge main into dtype-functions-staging (#1935)"
This reverts commit 042d58b699.
2023-03-15 11:25:26 -07:00
Ramiro Leal-Cavazos 042d58b699
Merge main into dtype-functions-staging (#1935)
Signed-off-by: Gaurav Shukla <gaurav@nod-labs.com>
Signed-off-by: Prateek Gupta <prateek.gupta2@cerebras.net>
Co-authored-by: Jiahao Li <liplus17@163.com>
Co-authored-by: Yuanqiang Liu <liuyuanqiang.yqliu@bytedance.com>
Co-authored-by: Vivek Khandelwal <vivekkhandelwal1424@gmail.com>
Co-authored-by: Chi_Liu <chi@nod.ai>
Co-authored-by: Victor Guerra <vguerra@gmail.com>
Co-authored-by: Victor Guerra <vm.guerramoran@criteo.com>
Co-authored-by: powderluv <powderluv@users.noreply.github.com>
Co-authored-by: Ashay Rane <ashay@users.noreply.github.com>
Co-authored-by: Eric Kunze <eric.kunze@arm.com>
Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>
Co-authored-by: Matthias Gehre <93204396+mgehre-amd@users.noreply.github.com>
Co-authored-by: Yi Wang <yi.wang.2005@gmail.com>
Co-authored-by: Sean Silva <silvasean@google.com>
Co-authored-by: Zachary Cetinic <zachattack242@Hotmail.com>
Co-authored-by: Tanyo Kwok <tianyou.gty@alibaba-inc.com>
Co-authored-by: Zachary Cetinic <zacharycetinic@gmail.com>
Co-authored-by: Kunwar Grover <51270680+Groverkss@users.noreply.github.com>
Co-authored-by: Ziheng Jiang <ziheng@apache.org>
Co-authored-by: Ziheng Jiang <ziheng.jiang@bytedance.com>
Co-authored-by: Maksim Levental <maksim.levental@gmail.com>
Co-authored-by: Gaurav Shukla <gaurav@nod-labs.com>
Co-authored-by: Prateek Gupta <108802984+prateekgu-cerebras@users.noreply.github.com>
Co-authored-by: nvda <nvda@stanford.edu>
Co-authored-by: Ahmed S. Taei <asaadaldien@users.noreply.github.com>
Co-authored-by: Priya Savithiri <104089347+PriyaBSavithiri@users.noreply.github.com>
Co-authored-by: Zhekun Zhang <32320144+zhekunz2@users.noreply.github.com>
Co-authored-by: zhekun.zhang <zhekun.zhang@bytedance.com>
Co-authored-by: Kan Chen <chenkanhw@163.com>
Co-authored-by: gpetters94 <gpetters@protonmail.com>
2023-03-15 07:48:41 -07:00
Jiahao Li ce7abf4911
Add dtype functions for ops that take dtype from 2nd operand (#1891) 2023-02-21 14:54:41 -08:00
Ramiro Leal-Cavazos 63945a2fd4
Change dtype functions interface to take ints tuple for each tensor (#1865)
The original design for the dtype functions outlined in
https://github.com/llvm/torch-mlir/issues/1462 was unable to properly
handle ops that take optional tensors as an input when the optional
tensor has a value of None. By the time the op gets imported into
torch-mlir, if an optional value is None, all information about the
original type is lost from the op type signature, preventing
torch-mlir from knowing if a value of None was from an optional tensor
or not, which was crucial in the original design since each tensor
argument must be turned into two separate arguments for the dtype
function.

This commit changes the interface to dtype functions such that each
tensor turns into a tuple of two ints, the first representing the rank
of the tensor and the second the dtype of the tensor. Since now there
is a one-to-one correspondence between the operands of an op and the
operands of its dtype function, there is no ambiguity about which
operand of the op corresponds with which operand of the dtype
function.

To test the implementation, this commit defines dtype functions for
the convolution ops, all of which take one optional tensor as an
argument.
2023-02-13 17:56:09 -08:00
Ramiro Leal-Cavazos 981ac88758
Add dtype functions for two tensor promotion ops (#1831)
This commit adds dtype functions for ops in RefineTypes under the
category of "Promote the two dtypes". The only ops not added here are
convolution ops, since they take an optional tensor argument, and the
dtype pipeline currently does not correctly handle that case. I will
add a follow up patch fixing this.

This commit also adds two helper functions that perform a very
thorough testing of dtype functions. The helper function
`_check_two_tensor_op` is able to independently test invalid input
dtypes and invalid output dtypes.

Lastly, this commit also XFAILs "MobilenetV3Module_basic".
2023-02-01 22:30:27 +00:00
Jiahao Li 83d4e89d25
Add dtype functions for floating point ops (#1813) 2023-01-20 18:39:41 +00:00
Ramiro Leal-Cavazos 8cae5ba507
Add dtype functions for comparison ops (#1806)
This commit adds dtype functions for comparison ops that always return
a tensor of dtype `i1`.
2023-01-16 22:32:23 +00:00
Ramiro Leal-Cavazos 5b77c15128 Add CI to `dtype-functions-staging` branch 2023-01-16 20:27:49 +00:00
Ramiro Leal-Cavazos ac94ba22e2 Move dtype functions into their own section in lib gen file
In order to easily keep track of the dtype functions that have been
moved to `abstract_interp_lib_gen.py` and make it easier to add new
ones, this commit groups all the dtype functions together, rather than
having them interspersed between the shape functions.
2023-01-16 20:16:48 +00:00
Maksim Levental 8696752eb6
Expose metadata of torch-mlir types (plus verify DictType key and value types). (#1785) 2023-01-16 10:25:02 -06:00
Roll PyTorch Action 2fe697c0be update PyTorch version to 2.0.0.dev20230116 2023-01-16 14:45:56 +00:00
Vivek Khandelwal 924503c436 build: manually update PyTorch version
Set PyTorch and TorchVision version to nightly release 2023-01-15.

Signed-Off By: Vivek Khandelwal <vivek@nod-labs.com>
2023-01-16 13:07:57 +05:30
Roll PyTorch Action 3f49ba9fe2 update PyTorch version to 2.0.0.dev20230114 2023-01-14 14:35:15 +00:00
Roll PyTorch Action 7f95f44297 update PyTorch version to 2.0.0.dev20230113 2023-01-13 14:33:07 +00:00
Ramiro Leal-Cavazos 7714bebfe3
Fix sign-compare warnings in TosaLegalizeCommon.cpp (#1794) 2023-01-12 11:23:30 -08:00
Roll PyTorch Action f74164161a update PyTorch version to 2.0.0.dev20230112 2023-01-12 15:12:52 +00:00
Jiahao Li 4f94831fed
[LINALG][TOSA][MHLO] Add e2e support for aten bitwise ops (#1753) 2023-01-11 14:40:03 -08:00
Ahmed S. Taei 6b76e2e927
Use global for MLIRTorchOpsIncGenTdFiles (#1784) 2023-01-11 14:18:35 -08:00
Roll PyTorch Action cffee681bd update PyTorch version to 2.0.0.dev20230111 2023-01-11 16:20:26 +00:00
Vivek Khandelwal fd236b2c89 [MLIR][TORCH] Add decomposition for prims.var and prims.sqrt op
Signed-Off By: Vivek Khandelwal <vivek@nod-labs.com>
2023-01-11 17:39:10 +05:30
Vivek Khandelwal b966733e04 build: manually update PyTorch version
Set PyTorch and TorchVision version to nightly release 2023-01-08.

Signed-Off By: Vivek Khandelwal<vivek@nod-labs.com>
2023-01-11 17:39:10 +05:30
Ashay Rane 4e4a571104
[TOSA] Add LeakyReLU conversion pass (#1790)
* feat(TorchToTOSA): LeakyReLU legalization

* test(LeakyReLU): Add LIT test and enable e2e test

Co-authored-by: Philipp Braun <philipp.braun@amd.com>
2023-01-10 21:42:07 -08:00
Ashay Rane 0faba6d2fc
build: update llvm tag to de3f0f7f (#1789)
Credit to @vivekkhandelwal1 for finding the necessary changes.

Summary of changes:

 - Switch Tosa_IntArrayAttr[N], Tosa_IntArrayAttrUpto[N] to DenseI64ArrayAttr.

 - Replace kNoIterationLimit with kNoLimit. (https://reviews.llvm.org/D140525)

 - Add dependency on MhloPasses when MHLO is enabled

 - Specify result type when using mhlo::DotOp
2023-01-10 17:07:19 -06:00
Raghavan Raman 0979df6589
Fix unsqueeze in Torch to Tosa conversion (#1780) 2023-01-10 11:09:58 -08:00
Gleb Kazantaev c8b867b876
Added support for aten::norm.ScalarOpt_dim (#1774)
* Added support for aten::norm.ScalarOpt_dim

* Disable NormalizeModule_basic for linalg
2023-01-10 13:08:25 -05:00
Ashay Rane a897c49803
CI: miscellaneous fixes for Release builds (#1781)
- Use v3 of actions/checkout, since the version we use (v2) uses
   Node.js 12, which is deprecated by GitHub.

 - Source the PowerShell venv sctipt (instead of the bash sript) since
   the calling script is a PowerShell script.  Without this, the build
   doesn't use venv at all.

 - Make the build dependencies in whl-requirements.txt (used by
   setup.py) match those in requirements.txt.  To that end, this patch
   creates a build-requirements.txt that is referenced by
   requirements.txt and whl-requirements.txt.
2023-01-06 20:41:43 -06:00
Gleb Kazantaev 8f01072099
Fix OptionalCType class name (#1779)
* Fix OptionalCType class name

* Rmove LTC xfail tests
2023-01-06 17:03:24 -05:00
Roll PyTorch Action 1f2946a5a7 update PyTorch version to 2.0.0.dev20230106 2023-01-06 14:41:18 +00:00
Roll PyTorch Action 98cb12e3e5 update PyTorch version to 2.0.0.dev20230105 2023-01-05 14:28:36 +00:00
Roll PyTorch Action 5351db0e99 update PyTorch version to 2.0.0.dev20230104 2023-01-04 16:38:47 +00:00
Ashay Rane 6e0b5b9ba7 build: match windows CI and Release build steps
After a recent LLVM tag update, the Windows Release build failed even
though pre- and post-merge Windows CI builds passed.  This patch makes
the Windows Release build use the same flags as the Window CI build to
try and address the Release build failures in the future.
2023-01-04 14:29:17 +05:30
Jiahao Li 8dc5d985eb
Add e2e support for aten logical or/and/xor/not ops (#1761) 2023-01-03 18:11:25 -08:00
Ramiro Leal-Cavazos d44bdd2728
Add `hasDtype` checks everywhere dtypes are used in decompositions (#1750)
There are several decompositions that assume the operands of the op
have dtypes available; however, the only time dtypes are guaranteed to
be present is when the graph has reached the backend contract. In
general, every pass that happens before reaching the backend contract
should not assume dtypes are available and should use `hasDtype` to
check first.

This commit adds `hasDtype` checks to every decomposition that uses
dtypes.
2023-01-03 14:19:18 -08:00
Ramiro Leal-Cavazos 273664ded6
[custom op] Replace `tanh` dtype function with `expm1` (#1769)
This commit replaces the `tanh` dtype function, which was being used
to test the implementation of dtype functions in
a710237437, with a dtype function for
`expm1`. The dtype function for `expm1` is identical to the `tanh`
one, so the same level of testing is maintained.

Currently, there are ops getting dtype information from the
`RefineTypes` pass and ops getting dtype information from the
`TorchDtypeRefinementPipeline`. Since each pass can only propagete
dtype information for the ops it knows how to handle, some models with
many ops handled in both passes require the two dtype propagation
passes to execute many times, reaching the iteration limit set in the
`LowerToBackendContractPass`. To temporarily avoid this issue while
the migration to `TorchDtypeRefinementPipeline` is finished, this
commit switches `tanh` to `expm1`, since the latter is used a lot less
in large models.
2023-01-03 14:18:26 -08:00
Srirammaswamy a88e3766e8
Add E2E support for LeakyRelu and LeakyReluBackward ops (#1733)
Co-authored-by: srirammaswamy <srirammaswamy@gmail.com>
2023-01-03 08:30:16 -08:00
Roll PyTorch Action 324ccccc2d update PyTorch version to 2.0.0.dev20230103 2023-01-03 14:27:40 +00:00
Roll PyTorch Action 818f5dc3ad update PyTorch version to 2.0.0.dev20230102 2023-01-02 14:26:23 +00:00
powderluv 3d50d3d9fe
Revert "rebase llvm: 5f24f893cac7aaea292c70f8aa83b021499114be (#1760)" (#1765)
This reverts commit fa356cce50.
2023-01-01 10:56:06 -08:00
Roll PyTorch Action cfad718a86 update PyTorch version to 2.0.0.dev20230101 2023-01-01 14:27:33 +00:00
Roll PyTorch Action 9e71d271f6 update PyTorch version to 2.0.0.dev20221231 2023-01-01 09:33:45 +00:00
powderluv b2dbbba5e6
xfail ElementwisePreluModule_basic in dynamo (#1763) 2022-12-31 13:54:25 -08:00
Xiafei Qiu fa356cce50
rebase llvm: 5f24f893cac7aaea292c70f8aa83b021499114be (#1760) 2022-12-31 00:07:54 +08:00
Roll PyTorch Action 867fade9c5 update PyTorch version to 2.0.0.dev20221230 2022-12-30 14:36:33 +00:00
powderluv 4dbdc179b7
Bump to Python 3.8 (#1756) 2022-12-29 19:04:54 -08:00
Ashay Rane ac780529b4
Revert e2e support for aten logical or/and/xor/not ops (#1757)
This reverts commit eaab9be207, since it
is causing the post-merge CI tests to fail, causing subsequent PRs to be
blocked.  Specifically, the tests
`ElementwiseAtenLogicalAndOpPromoteBroadcastModule_basic` and
`ElementwiseAtenLogicalXorOpPromoteBroadcastModule_basic` fail because
the oracle does not match the computed result.  This patch reverts the
commit to make the post-merge builds green again.
2022-12-29 21:01:06 -06:00
Roll PyTorch Action f0998f92df update PyTorch version to 2.0.0.dev20221229 2022-12-29 14:39:28 +00:00
Roll PyTorch Action 49274dc3db update PyTorch version to 2.0.0.dev20221228 2022-12-28 15:03:28 +00:00
Shivam Gupta 2f45959f0d
Prelu lowering to linalg (#1712)
Prelu lowering to linalg
2022-12-28 08:51:33 +05:30
Roll PyTorch Action ff9523d2b6 update PyTorch version to 2.0.0.dev20221227 2022-12-27 14:29:41 +00:00
Roll PyTorch Action 6bd6a79e23 update PyTorch version to 2.0.0.dev20221226 2022-12-26 14:34:40 +00:00