masahi commented on code in PR #13734:
URL: https://github.com/apache/tvm/pull/13734#discussion_r1066396579


##########
src/meta_schedule/trace_apply.cc:
##########
@@ -175,16 +175,30 @@ std::vector<BlockRV> ApplyAnchorTrace(Schedule sch, Trace 
anchor_trace) {
     Array<ObjectRef> outputs = inst->kind->f_apply_to_schedule(sch, inputs, 
inst->attrs, decision);
 
     if (inst->kind.same_as(kind_get_child_blocks)) {
-      // We want to allow a trace generated for a single conv2d block to be 
applied to
-      // conv2d -> elemwise blocks, where two conv2d are the same workload.
-      // GetChildBlocks returns a different number of blocks for the two cases 
above, which
-      // violates the assumption made by TranslateAddOutputRVs: 
old_outputs.size() ==
-      // new_outputs.size(). We workaround this problem by assuming that the 
prefix of the "new"
-      // outputs matches with the "old" outputs, and truncating the new 
outputs accordingly.
-      ICHECK(inst->outputs.size() <= outputs.size());
-      TranslateAddOutputRVs(
-          inst->outputs, Array<ObjectRef>(outputs.begin(), outputs.begin() + 
inst->outputs.size()),
-          &rv_map);
+      if (inst->outputs.size() == outputs.size()) {
+        TranslateAddOutputRVs(inst->outputs, outputs, &rv_map);
+      } else if (inst->outputs.size() < outputs.size()) {
+        // We want to allow a trace generated for a single conv2d block to be 
applied to

Review Comment:
   Yeah, this is necessary since `get_child_blocks`, `get_consumers` etc can 
return different number of results depending on the post ops, even if the 
anchor op is the same.



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