Skip to content
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

[MetaSchedule] preseve global_symbol attached to function after applying MS #14219

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

jinhongyii
Copy link
Contributor

Right now seems a global symbol main will be attached to every fused prim_func after Meta Schedule tuning.
Although the problem get hidden because we will re-attach global symbols, this is a behavior that need to be fixed.
Now the transformed prim func preserves the original global symbol. If it doesn't exist, attach global symbol main.

cc: @tqchen @junrushao

@tvm-bot
Copy link
Collaborator

tvm-bot commented Mar 6, 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

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@junrushao junrushao merged commit 2f2d5d4 into apache:main Mar 7, 2023
Comment on lines +47 to 50
if not (mod.attrs and "global_symbol" in mod.attrs):
mod = mod.with_attr("global_symbol", "main")
mod = mod.with_attr("tir.noalias", True)
mod = IRModule({"main": mod})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not very sure here. One of the principle is that when a function in an IRModule has global_symbol, the global_symbol value and its global var name are supposed to equal. Here we are creating an IRModule with the only function “main”, so I think it is reasonable to attach global_symbol “main” to the function.

Copy link
Contributor Author

@jinhongyii jinhongyii Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thought! The inconsistency of global_symbol in the case I'm handling comes from the applying MS phase, so it seems I should change the code there

Copy link
Contributor Author

@jinhongyii jinhongyii Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, do we really have this principle? I read through the code and find many cases where it uses global var's name_hint and global_symbol for different branches. (such as internal linkage vs external linkage). Overwriting the func's global_symbol with main throw aways possible information we need
.

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.

4 participants