Skip to content
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

Revert "Revert "Add full operator to fold dq/q handling" (#7351)" #7362

Merged
merged 6 commits into from
Dec 20, 2024

Conversation

per
Copy link
Collaborator

@per per commented Dec 18, 2024

This reverts commit 11beed1.

Re-enable the passes to fold Q/DQ nodes in Arm delegate.

Copy link

pytorch-bot bot commented Dec 18, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7362

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 9cd20c4 with merge base f341da8 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 18, 2024
@per per added ciflow/trunk topic: not user facing partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm labels Dec 18, 2024
@per
Copy link
Collaborator Author

per commented Dec 18, 2024

@digantdesai Added this here to try to sort out the issues with the changes.

@digantdesai
Copy link
Contributor

For some reason I can't import it internally ATM :(

@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@per
Copy link
Collaborator Author

per commented Dec 18, 2024

Failures due to conda.anaconda.org gives no healthy upstream

@digantdesai
Copy link
Contributor

digantdesai commented Dec 19, 2024

@per more type checker gifts for you

executorch/backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py:102:22 Redundant cast [22]: The value being cast is already of type `torch.fx.node.Node`.
executorch/backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py:128:42 Incompatible parameter type [6]: In call `torch.fx.node.Node.replace_input_with`, for 2nd positional argument, expected `Node` but got `torch.fx.node.Argument (resolves to Union[None, slice[typing.Any, typing.Any, typing.Any], Mapping[str, Argument], Sequence[Argument], bool, complex, float, int, range, str, SymBool, SymFloat, SymInt, device, dtype, layout, memory_format, OpOverload, Tensor, Node, typing.Tuple[Argument, ...]])`.
executorch/backends/arm/operators/op_avg_pool2d.py:11:0 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/operators/op_avg_pool2d.py:83:22 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_avg_pool2d.py:86:23 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_conv2d.py:11:0 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/operators/op_conv2d.py:167:26 Uninitialized local [61]: Local variable `input_qparams` is undefined, or not always defined.
executorch/backends/arm/operators/op_conv2d.py:168:27 Uninitialized local [61]: Local variable `input_qparams` is undefined, or not always defined.
executorch/backends/arm/operators/op_conv2d.py:169:27 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_conv2d.py:85:28 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_max.py:12:0 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/operators/op_max.py:46:28 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_min.py:13:0 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/operators/op_min.py:47:28 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/process_node.py:115:18 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/process_node.py:14:0 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/tosa_quant_utils.py:114:21 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/tosa_quant_utils.py:60:4 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/tosa_quant_utils.py:71:20 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.

@per
Copy link
Collaborator Author

per commented Dec 19, 2024

Unrelated failure in pull / unittest / macos / macos-job

@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@digantdesai
Copy link
Contributor

Still some more :(

executorch/backends/arm/process_node.py:117:18 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_conv2d.py:11:0 Undefined import [21]: Could not find a module corresponding to import `executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass`.
executorch/backends/arm/operators/op_max.py:48:28 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.
executorch/backends/arm/operators/op_min.py:49:28 Undefined attribute [16]: Module `executorch.backends.arm` has no attribute `_passes`.

@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

per added 6 commits December 19, 2024 22:19
This reverts commit 44e31fb.

Change-Id: I12d88419e45a800e43e1e31d21280bc3b63710c6
This reverts commit 11beed1.

Change-Id: I6ba9b37f069c3ad819114fe1384659bc0f68135f
Signed-off-by: Per Åstrand <[email protected]>
Change-Id: Iee35eeb4af28a037848570b1d5143380222f549d
Signed-off-by: Per Åstrand <[email protected]>
Change-Id: I60fb32ad55a3f6d3617993481ab0c1ed46cf778c
Change-Id: I37fb7468b5cb040b916fabb2784ec475318bddba
lintrunner moved the pyre-ignores to the wrong line, re-apply to the
right line again.

Signed-off-by: Per Åstrand <[email protected]>
Change-Id: Icbb6cf6f2d65d6fe1c00e7c4a738691ffeb7acb2
@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@digantdesai digantdesai self-requested a review December 20, 2024 00:29
Copy link
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @per for all the back and forth.

@digantdesai digantdesai merged commit 75b0d8a into pytorch:main Dec 20, 2024
108 checks passed
oscarandersson8218 added a commit to oscarandersson8218/executorch that referenced this pull request Dec 20, 2024
Address issues from pyre and add similar # pyre-ignores as in
pytorch#7362.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: I6feaa611dcd539b3b0d21a6a7dd696ef7db691ef
oscarandersson8218 added a commit to oscarandersson8218/executorch that referenced this pull request Dec 30, 2024
Address issues from pyre and add similar # pyre-ignores as in
pytorch#7362.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: I6feaa611dcd539b3b0d21a6a7dd696ef7db691ef
digantdesai pushed a commit that referenced this pull request Jan 7, 2025
* Add TOSA table as custom edge op

Edge operators that are lowered to TOSA TABLEs are convereted to a
custom edge IR table-op.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: I147008c30b9b46c7b8ae1a1c15bc540fea614a69

* Add support for concat q/dq folding

This is a special case where node.args can be lists with many incoming
dq-nodes.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: Icf511a8bdeaaffb597b18455ab7f1fbd947ce3ca

* Increase q/dq folding coverage

Add support for q/dq folding of more operators such as hardtanh,
maxpool2d, mul, relu, select, sub, to_copy.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: Ifdabda4c927dade41c000859054696844c546f7b

* Add support for sum q/dq folding

sum is retraced to an int64 dtype of operator after q/dq folding.
This patch adds a pass to manually force the dtype to be int8.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: Ifa737a398c5a878d52cd76a2392499905da085ce

* Complete q/dq folding coverage

Add support for q/dq folding for the remaining supported ops in Arm
backend.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: I9012b4a501ce018c9771c729706be3b031a5c7ae

* Remove is_quant_node from NodeVisitor.define_node

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: Ibb17add461dc79e022a7f4accde29f9f9d61b16d

* Fix pyre issues

Address issues from pyre and add similar # pyre-ignores as in
#7362.

Signed-off-by: Oscar Andersson <[email protected]>
Change-Id: I6feaa611dcd539b3b0d21a6a7dd696ef7db691ef

---------

Signed-off-by: Oscar Andersson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants