Skip to content

Conversation

@Lunderberg
Copy link
Contributor

Prior to this commit, PrimFuncPass directly removed empty PrimFunc objects from the module's Map<GlobalVar, BaseFunc> functions. Because it didn't update the global_var_map_ as well, these two maps could become out of sync. Since the global_var_map_ is checked as part of StructuralEqual(), but isn't displayed when printing to TVMScript, this can result in identical printouts being flagged as non-identical.

This commit updates PrimFuncPass to call the IRModuleNode::Remove method, which updates both the functions and global_var_map_ variables.

This is part of changes described in #14486, to improve round-trip failures that occur in lowering.

Prior to this commit, `PrimFuncPass` directly removed empty `PrimFunc`
objects from the module's `Map<GlobalVar, BaseFunc> functions`.
Because it didn't update the `global_var_map_` as well, these two maps
could become out of sync.  Since the `global_var_map_` is checked as
part of `StructuralEqual()`, but isn't displayed when printing to
TVMScript, this can result in identical printouts being flagged as
non-identical.

This commit updates `PrimFuncPass` to call the `IRModuleNode::Remove`
method, which updates both the `functions` and `global_var_map_`
variables.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 4, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@tqchen tqchen merged commit deb11d3 into apache:main Apr 5, 2023
@Lunderberg Lunderberg deleted the transform_primfunc_remove_none_fix branch April 5, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants