-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[microNPU] Move optimization passes to be a module pass and ensure they are running #9831
Conversation
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.
Thanks @lhutton1 for spotting and fixing this, it is a very subtle problem! As discussed offline, the fact that these passes silently ceased running as a part of a pipeline (they certainly did use to run when I was implementing the LUT pass) is quite worrying since it means there has been an underlying change to how a relay.transform.function_pass
works (or maybe even a bug since the docstring of the implementation implies that it should work on the modules), so there could be other optimization passes that are silently not running now. I think @lhutton1 mentioned though that he didn't grep out many use cases of that function_pass
outside of tutorials, but I think in that case we should properly retire it and update the tutorials. Re-tagging @manupa-arm for opinion...
(Forgot to say that dealing with |
Thanks @ekalda for taking a look, yes it seems quite strange to me. Just wanted to note that I did a little bit more digging and it seems like the |
kCompiler (a.k.a. "Compiler") attribute generally blocks most passes from visiting the function body. Are we saying there was a time where the pass worked even when the kCompiler is set ? |
I saw the LUT pass working as a part of a pipeline when I was developing it (I first developed it by running an end to end codegen test with a breakpoint before the pass and checked that the Relay had changed as expected after stepping over it). Out of interest, why does the |
It is used to annotate relay functions meant to be compiled with BYOC. Therefore, the compilation passes of core compiler ignores it. IIRC, that was the reason. I believe this affects function pass because (and not module pass) the pass it self does not choose which functions to mutate as opposed to a module pass. |
Thanks @manupa-arm, in that case it sounds like migrating to a module pass is the correct thing to do here. It's still a bit of a mystery as to why @ekalda and I believe this used to work, although its probably worth not dwelling on it for now |
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.
The implementation LGTM!
I think we need to be a specific with the title and/or commit message to say what this PR enables. I believe that should be :
- Moves LUTOptimizer to be a module pass
- Ensure LUTOptimizer Pass is run
rather than generically adding the feature to ensure all optimization passes are run.
Agreed, that makes more sense :) |
are running Moves LayoutOptimizer and LUTOptimizer passes to be a module pass, rather than a function pass. This is because it was found that these passes were not running in the NPU compilation flow. In addition, a test for both LayoutOptimizer and LUTOptimizer has been added to check that the passes are running in the compilation pipeline of the NPU. Change-Id: I5145c6f02eeb0daea3cdba56198e0804ec32f351
9858432
to
9301f72
Compare
friendly ping for approval/comments |
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.
LGTM!
…ey (apache#9831) are running Moves LayoutOptimizer and LUTOptimizer passes to be a module pass, rather than a function pass. This is because it was found that these passes were not running in the NPU compilation flow. In addition, a test for both LayoutOptimizer and LUTOptimizer has been added to check that the passes are running in the compilation pipeline of the NPU. Change-Id: I5145c6f02eeb0daea3cdba56198e0804ec32f351
…ey (apache#9831) are running Moves LayoutOptimizer and LUTOptimizer passes to be a module pass, rather than a function pass. This is because it was found that these passes were not running in the NPU compilation flow. In addition, a test for both LayoutOptimizer and LUTOptimizer has been added to check that the passes are running in the compilation pipeline of the NPU. Change-Id: I5145c6f02eeb0daea3cdba56198e0804ec32f351
Moves LayoutOptimizer and LUTOptimizer passes to be a module pass, rather than a function pass. This is because it was found that these passes were not running in the NPU compilation flow. In addition, a test for both LayoutOptimizer and LUTOptimizer has been added to check that the passes are running in the compilation pipeline of the NPU.
cc @ekalda @manupa-arm