You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "jinhongyii (via GitHub)" <gi...@apache.org> on 2023/03/06 22:29:28 UTC

[GitHub] [tvm] jinhongyii opened a new pull request, #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

jinhongyii opened a new pull request, #14219:
URL: https://github.com/apache/tvm/pull/14219

   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 


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] jinhongyii commented on a diff in pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "jinhongyii (via GitHub)" <gi...@apache.org>.
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 possible information we need
   .



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] MasterJH5574 commented on a diff in pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 commented on code in PR #14219:
URL: https://github.com/apache/tvm/pull/14219#discussion_r1127288067


##########
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:
   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.



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] jinhongyii commented on a diff in pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "jinhongyii (via GitHub)" <gi...@apache.org>.
jinhongyii commented on code in PR #14219:
URL: https://github.com/apache/tvm/pull/14219#discussion_r1127329476


##########
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 and revert this change. I will send a fix PR later



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tvm-bot commented on pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14219:
URL: https://github.com/apache/tvm/pull/14219#issuecomment-1457118536

   <!---bot-comment-->
   
   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](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * cc @ibsidorenko <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao merged pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "junrushao (via GitHub)" <gi...@apache.org>.
junrushao merged PR #14219:
URL: https://github.com/apache/tvm/pull/14219


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] jinhongyii commented on a diff in pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "jinhongyii (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] jinhongyii commented on a diff in pull request #14219: [MetaSchedule] preseve global_symbol attached to function after applying MS

Posted by "jinhongyii (via GitHub)" <gi...@apache.org>.
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 throw aways information.



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org