yincs-intellif commented on code in PR #12450:
URL: https://github.com/apache/tvm/pull/12450#discussion_r954440662


##########
src/tir/schedule/primitive/compute_at.cc:
##########
@@ -160,7 +174,57 @@ int FindInsertionPoint(
   // The valid indices are: (last_producer_position, first_consumer_position]
   ICHECK(split.last_producer_position < split.first_consumer_position);
   // Step 4. Return the last valid insertion point
-  return split.first_consumer_position;
+  int insert_position = split.first_consumer_position;
+  if (index == -1) {
+    return insert_position;
+  } else if (index == -2) {

Review Comment:
   1. For compute at primitive, most of time, we can just return 
last_producer_position + 1. When other blocks insert ahead of block B, block B 
maybe far way block C, this is why I add some code to adjust the position. But 
the adjustment scheme  is not good either. I agree return 
last_producer_position + 1.
   2. For reverse_compute_at, when last_producer_position=-1 we hope it insert 
the last position, which is mostly caused by parameters.



-- 
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-unsubscr...@tvm.apache.org

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

Reply via email to