MasterJH5574 commented on a change in pull request #10420:
URL: https://github.com/apache/tvm/pull/10420#discussion_r817288926



##########
File path: src/tir/schedule/analysis/analysis.cc
##########
@@ -363,6 +363,26 @@ void CheckCompleteOrReductionBlock(const ScheduleState& 
self, const StmtSRef& bl
                                          reduction_block_error_code);
 }
 
+StmtSRef GetInnermostDominantSubBlockSRef(const ScheduleState& self, const 
StmtSRef& block_sref) {
+  // return the innermost dominant sub-block.
+  const BlockNode* block = TVM_SREF_TO_BLOCK(block, block_sref);
+  bool all_iter_vars_data_parallel = true;
+  for (const IterVar& iter_var : block->iter_vars) {
+    if (iter_var->iter_type != kDataPar) {
+      all_iter_vars_data_parallel = false;
+    }
+  }
+  Array<StmtSRef> child_block_srefs = GetChildBlockSRefOnSRefTree(self, 
block_sref);
+  if (!block->init.defined() && child_block_srefs.size() == 1 && 
all_iter_vars_data_parallel) {
+    const StmtSRef& child_block_sref = child_block_srefs[0];
+    if (IsDominantBlock(self->GetBlockScope(block_sref), child_block_sref)) {

Review comment:
       Okay... To avoid this stuff, `IsDominantBlock` doesn't work for sure, 
since `IsDominantBlock("inner")` checks “whether `inner` is the only block 
writing to `b` under `outer`,” while `b[vi, vj, 0] = b[vi, vj, 1] + b[vi, vj, 
2]` isn't wrapped by any sub-block.
   
   IMO an alternative is to require `outer` to have single child on the AST. 
What do you think of this idea?




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


Reply via email to