wpan11nv commented on a change in pull request #5551:
URL: https://github.com/apache/incubator-tvm/pull/5551#discussion_r425288053



##########
File path: src/te/operation/cross_thread_reduction.cc
##########
@@ -48,9 +97,18 @@ Stmt MakeCrossThreadReduction(const ComputeOpNode* self, 
const Stage& stage,
     CHECK(reduce);
     reduces[i] = reduce;
   }
-  PrimExpr cond = reduces[0]->condition;
-  for (PrimExpr v : conds) {
-    cond = cond && v;
+
+  // This computes the bound checking predicates in normal reduction.
+  auto normal_preds =
+      MakeBoundCheck(stage, dom_map, value_map, false, 
std::unordered_set<IterVar>());
+
+  // The existing reduction predicate (only from the first one one?)
+  PrimExpr input_pred = reduces[0]->condition;
+
+  // normal_pred = input_pred && normal_pred
+  normal_preds.push_back(input_pred);
+  for (PrimExpr v : normal_preds) {
+    if (v.defined()) normal_preds.push_back(v);
   }

Review comment:
       Thanks for catching this! normal_preds may contain null  expressions, so 
we need to filter them out.  I just fixed it.




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

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


Reply via email to