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 2022/09/26 20:18:19 UTC

[GitHub] [tvm] junrushao commented on a diff in pull request #12910: [TIR] Fix GetProducer/Consumer for duplicating dep edges

junrushao commented on code in PR #12910:
URL: https://github.com/apache/tvm/pull/12910#discussion_r980463447


##########
src/tir/schedule/primitive/get_block_loop.cc:
##########
@@ -80,27 +80,27 @@ Array<StmtSRef> GetChildBlocks(const ScheduleState& self, const StmtSRef& parent
 Array<StmtSRef> GetProducers(const ScheduleState& self, const StmtSRef& block_sref) {
   StmtSRef scope_root = GetScopeRoot(self, block_sref, /*require_stage_pipeline=*/false);
   Array<Dependency> edges = self->GetBlockScope(scope_root)->GetDepsByDst(block_sref);
-  Array<StmtSRef> results;
+  std::unordered_set<StmtSRef, ObjectPtrHash, ObjectPtrEqual> results;
   results.reserve(edges.size());
   for (const Dependency& edge : edges) {
     if (edge->kind == DepKind::kRAW || edge->kind == DepKind::kWAW) {
-      results.push_back(edge->src);
+      results.emplace(edge->src);
     }
   }
-  return results;
+  return Array<StmtSRef>(results.begin(), results.end());

Review Comment:
   Note: `std::unordered_set` doesn't guarantee proper ordering, which makes scheduling traces not strictly reproducible



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