jinhongyii commented on code in PR #14219:
URL: https://github.com/apache/tvm/pull/14219#discussion_r1127334110
##########
python/tvm/meta_schedule/tune_context.py:
##########
@@ -44,7 +44,8 @@
def _normalize_mod(mod: Union[PrimFunc, IRModule]) -> IRModule:
"""Normalize the input to an IRModule"""
if isinstance(mod, PrimFunc):
- mod = mod.with_attr("global_symbol", "main")
+ 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})
Review 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 information.
##########
python/tvm/meta_schedule/tune_context.py:
##########
@@ -44,7 +44,8 @@
def _normalize_mod(mod: Union[PrimFunc, IRModule]) -> IRModule:
"""Normalize the input to an IRModule"""
if isinstance(mod, PrimFunc):
- mod = mod.with_attr("global_symbol", "main")
+ 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})
Review 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]