[MetaSchedule] preseve global_symbol attached to function after applying MS#14219
[MetaSchedule] preseve global_symbol attached to function after applying MS#14219junrushao merged 1 commit intoapache:mainfrom
Conversation
|
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 |
| 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}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
.
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