You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/12/14 20:07:46 UTC

[GitHub] [tvm] vinx13 opened a new pull request #9743: [TIR][Schedule] Analysis functions to check if compute_inline and com…

vinx13 opened a new pull request #9743:
URL: https://github.com/apache/tvm/pull/9743


   …pute_inline is allowed
   
   Co-authored-by: Siyuan Feng <Hz...@sjtu.edu.cn>
   Co-authored-by: Bohan Hou <32...@users.noreply.github.com>
   Co-authored-by: Hongyi Jin <32...@qq.com>
   Co-authored-by: Ruihang Lai <la...@qq.com>
   Co-authored-by: Junru Shao <ju...@gmail.com>
   Co-authored-by: Wuwei Lin <wu...@apache.org>
   Co-authored-by: Xiyou Zhou <xi...@octoml.ai>
   
   


-- 
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] comaniac commented on a change in pull request #9743: [TIR][Schedule] Analysis functions to check if compute_inline and com…

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #9743:
URL: https://github.com/apache/tvm/pull/9743#discussion_r769076960



##########
File path: src/tir/schedule/primitive/compute_inline.cc
##########
@@ -550,17 +567,32 @@ void ComputeInline(ScheduleState self, const StmtSRef& producer_block_sref) {
     throw OpaqueAccessError(self->mod, scope_root_sref);
   }
   // Step 6. Do the real mutation on the AST and the sref tree in the schedule state
-  self->Replace(scope_root_sref, tgt_stmt, inliner.block_reuse);
+  return [=]() -> void { self->Replace(scope_root_sref, tgt_stmt, inliner.block_reuse); };

Review comment:
       ditto

##########
File path: src/tir/schedule/primitive/compute_at.cc
##########
@@ -501,29 +503,59 @@ void ComputeAtOrReverseComputeAtImpl(ScheduleState self, const StmtSRef& block_s
       CalculateBlockVarDomain(/*iter_vars=*/block->iter_vars,
                               /*provided_regions=*/std::move(provided_regions),
                               /*required_regions=*/std::move(required_regions),
-                              /*analyzer=*/&analyzer);
+                              /*analyzer=*/analyzer);
   // Step 6. Create the new scope according to the iteration domain
   reconstructor.MakeNewLoop(/*insert_position=*/insert_position, /*iter_doms=*/std::move(iter_doms),
                             /*preserve_unit_loops=*/preserve_unit_loops);
   Block new_scope_root = Downcast<Block>(reconstructor(scope_root));
-  // Step 7. Do the actual replacement
-  self->Replace(scope_root_sref, new_scope_root, {{scope_root, new_scope_root}});
-  // Step 8. Update the cached flags
-  BlockInfo& block_info = self->block_info[block_sref];
-  block_info.affine_binding = IsAffineBinding(
-      /*realize=*/reconstructor.new_block_realize_,
-      /*loop_var_ranges=*/LoopDomainOfSRefTreePath(GetRef<StmtSRef>(block_sref->parent)),
-      /*analyzer=*/&analyzer);
+  return [=]() -> void {

Review comment:
       This style is interesting but I'm not sure if it's intuitive. Would that be better to just have an optional argument like `check_only=false`?

##########
File path: src/tir/schedule/primitive/compute_inline.cc
##########
@@ -579,7 +611,20 @@ void ReverseComputeInline(ScheduleState self, const StmtSRef& consumer_block_sre
     throw OpaqueAccessError(self->mod, scope_root_sref);
   }
   // Step 7. Do the real mutation on the AST and the sref tree in the schedule state
-  self->Replace(scope_root_sref, tgt_stmt, inliner.block_reuse);
+  return [=]() -> void { self->Replace(scope_root_sref, tgt_stmt, inliner.block_reuse); };

Review comment:
       ditto




-- 
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] junrushao1994 commented on a change in pull request #9743: [TIR][Schedule] Analysis functions to check if compute_inline and com…

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #9743:
URL: https://github.com/apache/tvm/pull/9743#discussion_r769088046



##########
File path: src/tir/schedule/primitive/compute_at.cc
##########
@@ -501,29 +503,59 @@ void ComputeAtOrReverseComputeAtImpl(ScheduleState self, const StmtSRef& block_s
       CalculateBlockVarDomain(/*iter_vars=*/block->iter_vars,
                               /*provided_regions=*/std::move(provided_regions),
                               /*required_regions=*/std::move(required_regions),
-                              /*analyzer=*/&analyzer);
+                              /*analyzer=*/analyzer);
   // Step 6. Create the new scope according to the iteration domain
   reconstructor.MakeNewLoop(/*insert_position=*/insert_position, /*iter_doms=*/std::move(iter_doms),
                             /*preserve_unit_loops=*/preserve_unit_loops);
   Block new_scope_root = Downcast<Block>(reconstructor(scope_root));
-  // Step 7. Do the actual replacement
-  self->Replace(scope_root_sref, new_scope_root, {{scope_root, new_scope_root}});
-  // Step 8. Update the cached flags
-  BlockInfo& block_info = self->block_info[block_sref];
-  block_info.affine_binding = IsAffineBinding(
-      /*realize=*/reconstructor.new_block_realize_,
-      /*loop_var_ranges=*/LoopDomainOfSRefTreePath(GetRef<StmtSRef>(block_sref->parent)),
-      /*analyzer=*/&analyzer);
+  return [=]() -> void {

Review comment:
       Why do you both hate my fashionable coolest functional style 😭😝




-- 
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] junrushao1994 commented on pull request #9743: [TIR][Schedule] Analysis functions to check if compute_inline and com…

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on pull request #9743:
URL: https://github.com/apache/tvm/pull/9743#issuecomment-994063993


   CC: @comaniac @jcf94 @wrongtest @Hzfengsy @csullivan


-- 
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] Hzfengsy merged pull request #9743: [TIR][Schedule] Analysis functions to check if compute_inline and com…

Posted by GitBox <gi...@apache.org>.
Hzfengsy merged pull request #9743:
URL: https://github.com/apache/tvm/pull/9743


   


-- 
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