-
Notifications
You must be signed in to change notification settings - Fork 713
Add ArmPassManager #3749
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
Add ArmPassManager #3749
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3749
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 2 New FailuresAs of commit a9c550b with merge base 074a81e ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| permute_memory_to_nhwc=True, | ||
| quantize_io=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one way to do it. But why hide it from the user? I would just run them at the top level i.e.
...
e = to_edge()
e = helper_run_pass(e, pass_foo) # new method
e = partition(my_delegate_partitioner())
e = helper_run_pass(e, pass_bar)
...
In theory delegate specific passes should only run on the "partitioned" subgraph i.e. inside the preprocess() to make sure the graph you are mutating has no external side effect.
This is different, and I understand the rationale, and this is mutating the graph before the partitioning. I am not sure if we want to hide this mutation from the user.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why hide it from the user?
The reasoning is that different compile_specs may require different passes and applying all the passes at the top level would leave all the responsibility on the end-user. With this pass manager, all the user needs to do is to configure the compile_spec and then the passes would be applied for "free".
On the second part I think it is fine that this specific pass (TagIOQuantPass) is hidden since it does not change the graph, it only makes sure that the delegate does not consume certain nodes. Pre-partition passes that does mutate the graph should probably not be hidden though as you say...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, you can still do it outside, I am not sure which one is better
e = helper_run_pass(e, pass, compile_spec)
@mergennachin - what do you think?
- Add ArmPassManager that's responsible for pass handling. - Add RemoveClones-pass. - Add initial pass test. Change-Id: I71e1e0787d0788a835a412c608ae75331fe65cc2 Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
Change-Id: I5e8e868c49b9c4d3b365e2154430a286028d8dfc Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
9c1281e to
7e7c6be
Compare
backends/arm/arm_partitioner.py
Outdated
| passes(exported_program.graph_module) | ||
| exported_program = ArmPassManager( | ||
| exported_program=exported_program | ||
| ).transform_partition_pipeline(compile_spec=self.delegation_spec.compile_specs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps print a warning or something here?
| from executorch.exir.pass_base import PassResult | ||
|
|
||
|
|
||
| class RemoveClone(ArmPass): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass suffix is commonly used
|
@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
backends/arm/arm_partitioner.py
Outdated
| graph_module = ArmPassManager().transform_partition_pipeline( | ||
| graph_module=exported_program.graph_module, | ||
| compile_spec=self.delegation_spec.compile_specs, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not gonna work.
The invariant is that input and output ofpartitioner() should be the same, except a tag.
https://github.com/pytorch/executorch/blob/main/exir/backend/backend_api.py#L368-L371
As @digantdesai mentioned, this should be a user pass before calling to_backend(ArmPartitioner) for now.
We might introduce a first class citizen API for backend specific passes, but for now, we will ask users to add this one-line call to ArmPassManager()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally nothing has changed since #3056. The tag_io_quant_pass has been moved from one file to another. Also, that pass only annotates a tag.
If I understand you correctly, you simply want to remove this call from the partitioner? You don't want the PassManager to be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can merge this PR, which just sheds light on the structural issues with quantized IO, and continue the more structural discussions in a new Github ticket?
- Update README - Suffix passes with Pass Signed-off-by: Oscar Andersson <oscar.andersson@arm.com> Change-Id: I32b5683ea373fe8d0706da1a004eca8f5478de3c
Change-Id: Ib7200c1eeb7ac2646f9177c1931ddac72919fd52
Signed-off-by: Oscar Andersson <oscar.andersson@arm.com> Change-Id: I98f8b68361a05452cf100f67ec4479690bc8699d
Change-Id: I9b628ea6705ce6bc4f95479607594a31f6c52064
Signed-off-by: Oscar Andersson <oscar.andersson@arm.com> Change-Id: I7eabfee97c52cdec81f12986f08b2ed590d5681a
|
IIUC - with a9c550b - there is no use of ArmPassManager in Partition fn. While it unblocks this PR, we should still treat the underlying issue as a priority. I will try to follow up on this. |
|
@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@digantdesai merged this pull request in dd7fa6a. |
Change-Id: I71e1e0787d0788a835a412c608ae75331fe65cc2