Uh oh!
There was an error while loading. Please reload this page.
[microNPU] Move optimization passes to be a module pass and ensure they are running - #9831
Conversation
ekalda
left a comment
There was a problem hiding this comment.
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...
ekalda
commented
Jan 11, 2022
(Forgot to say that dealing with |
lhutton1
commented
Jan 11, 2022
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 |
manupak
commented
Jan 11, 2022
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 ? |
ekalda
commented
Jan 11, 2022
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 |
manupak
commented
Jan 11, 2022
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. |
lhutton1
commented
Jan 11, 2022
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 |
manupak
left a comment
There was a problem hiding this comment.
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.
lhutton1
commented
Jan 18, 2022
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
lhutton1
commented
Jan 20, 2022
friendly ping for approval/comments |
manupak
commented
Jan 20, 2022
…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