-
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
Fix InternalError in StaticPlanBlockMemory when visiting DataflowBlockNode #17501
Conversation
cc @MasterJH5574 can you take a look |
Hi @Thrsu, thanks for contributing! Actually we expect all dataflow blocks to have been removed in order to properly apply memory planning, given we no longer need the dataflow block information in subsequent lowering passes. Here is our lowering pipeline and you can see that we apply tvm/python/tvm/relax/pipeline.py Lines 89 to 92 in 3e386fd
So if possible, do you mind sharing the reason why you want the memory planning pass to work with dataflow blocks? A code example may be sufficient, thanks! |
@MasterJH5574 in that case, would be great to have a proper error message when assumption do not hold |
Thanks for your response! @tqchen @MasterJH5574 |
@Thrsu I see. Thanks for elaborating! The memory planning pass also has a dependency on the |
@MasterJH5574 Thank you for the guidance! I've added a unit test to the specified file, demonstrating that the memory planning pass works for dataflow blocks as requested. Could you please review the latest changes? Thank you for your time and assistance! |
@Thrsu Thank you for adding the unit test! It looks good to me :-) |
This PR fixes an internal error #17488
This error happens because the visitor class StorageAllocatorBaseVisitor does not correctly handle DataflowBlockNode instances. Specifically, the VisitBindingBlock_ method is not overridden for DataflowBlockNode, leading to an empty block_stack_ when it is expected to contain the current block.
To fix this issue, we need to override the VisitBindingBlock_ method for const DataflowBlockNode* in the StorageAllocatorBaseVisitor class. By doing so, we ensure that the block_stack_ is correctly managed when visiting dataflow blocks, similar to how it is managed for regular binding blocks.