-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TORCH] Add decomposition of aten.linear
op
#862
Conversation
Remove the TorchToLinalg code as well please since it is not not useful. |
Once #951 is merged, this PR will be unblocked wrt (3D, 2D) case of matmul. |
d87086f
to
9b7e965
Compare
aten.linear
opaten.linear
op
@sjarus Could you please take a look into this, |
I'll attempt to repro this early next week . Right now I'm trying to get a pipeline of pending BERT related legalizations out. Do you have detailed verbose output from the test ? |
c79cc85
to
5cc818b
Compare
@sjarus There is a case where Test case:
|
What happens when you use 3, 4, 3 instead of -1, -1, -1 in the annotate args ? |
It passed successfully! |
@sjarus Did you get a chance to look at it? |
Right, sorry for the delay. The experiment result appears aligned to my expectations, but I agree that if dynamic dims are unsupported then it should fail gracefully and not assert. It seems the best way to unblock is to keep the test static and refer in a comment to me to update the code so it doesn't assert, or better yet can pass, tho the latter is typically harder. Would that work ? |
3b8a6f9
to
7c3d8cf
Compare
@sjarus I have made the test case partially static for now in order to pass the tosa test. Should I create a new issue for the dynamic case handling in tosa matmul? |
We definitely don't want to regress our testing of dynamic shapes for all backends due a limitation in the TOSA backend, so I would avoid changing the test. We can use the functionality in #1242 to control the decompositions, but I need to make a PR to centralize that logic first -- will try to do that today. @Shukla-Gaurav can you also file a bug for the TOSA assertion failure? Ideally include a |
We were already hitting many cases where backends different in terms of the legal ops that they wanted. This caused unnecessary coupling between the backends. Examples: - llvm#1161 - llvm#862 This PR centralizes all compilation to go through `torch_mlir.compile` so that we can keep the logic centralized there. We should move these lists closer to each backend. Especially cases like llvm#862 where blocking a decomposition is necessary to avoid a crash emphasize that the set of decompositions is tightly coupled to the backend, and should be "controlled by the backend" and not something arbitrarily tweakable. Also: - Fix a small bug in the way we passed through the backendLegalOps option. - Add better error messages in `torch_mlir.compile` for import errors.
See #1248 |
We were already hitting many cases where backends different in terms of the legal ops that they wanted. This caused unnecessary coupling between the backends. Examples: - llvm#1161 - llvm#862 This PR centralizes all compilation to go through `torch_mlir.compile` so that we can keep the logic centralized there. We should move these lists closer to each backend. Especially cases like llvm#862 where blocking a decomposition is necessary to avoid a crash emphasize that the set of decompositions is tightly coupled to the backend, and should be "controlled by the backend" and not something arbitrarily tweakable. Also: - Fix a small bug in the way we passed through the backendLegalOps option. - Add better error messages in `torch_mlir.compile` for import errors.
We were already hitting many cases where backends different in terms of the legal ops that they wanted. This caused unnecessary coupling between the backends. Examples: - #1161 - #862 This PR centralizes all compilation to go through `torch_mlir.compile` so that we can keep the logic centralized there. We should move these lists closer to each backend. Especially cases like #862 where blocking a decomposition is necessary to avoid a crash emphasize that the set of decompositions is tightly coupled to the backend, and should be "controlled by the backend" and not something arbitrarily tweakable. Also: - Fix a small bug in the way we passed through the backendLegalOps option. - Add better error messages in `torch_mlir.compile` for import errors.
7c3d8cf
to
6d0c6bc
Compare
@silvasean Thanks for adding support for more control over decomposition based on backend. Could you please review this again? |
This commit adds decomposition of `aten.linear` op. Due to limited support at tosa backend in case of dynamic dimensions, this decomposition is currently disabled for tosa backend. Signed-Off-by: Gaurav Shukla <[email protected]>
6d0c6bc
to
8cf264f
Compare
This commit adds decomposition of
aten.linear
op.TODO: remove existing implementation and add a simple test case. Also handle the (3D,2D) case of matmul.
Signed-Off-by: Gaurav Shukla