You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "wrongtest-intellif (via GitHub)" <gi...@apache.org> on 2023/03/28 05:43:12 UTC

[GitHub] [tvm] wrongtest-intellif commented on a diff in pull request #14398: [TIR] Add merge primitive for TIR schedule

wrongtest-intellif commented on code in PR #14398:
URL: https://github.com/apache/tvm/pull/14398#discussion_r1150034787


##########
src/tir/schedule/primitive/loop_transformation.cc:
##########
@@ -451,6 +451,165 @@ Array<StmtSRef> Split(ScheduleState self, const StmtSRef& loop_sref, const Array
   return result_srefs;
 }
 
+class LoopReconstructor : private StmtMutator {
+ public:
+  explicit LoopReconstructor(Block scope_root, std::vector<std::vector<const ForNode*>> loops)

Review Comment:
   std::vector<>&



##########
src/tir/schedule/primitive/loop_transformation.cc:
##########
@@ -451,6 +451,165 @@ Array<StmtSRef> Split(ScheduleState self, const StmtSRef& loop_sref, const Array
   return result_srefs;
 }
 
+class LoopReconstructor : private StmtMutator {
+ public:
+  explicit LoopReconstructor(Block scope_root, std::vector<std::vector<const ForNode*>> loops)
+      : scope_root_(scope_root), loops_(loops) {}
+
+  using StmtMutator::operator();
+
+  /*!
+   * \brief Create the new nest loops induced by the given loops
+   */
+  void MakeNewLoop() {
+    Array<Var> new_loop_vars;
+    Array<PrimExpr> new_loop_extents;
+    Array<Stmt> new_stmts;
+    for (size_t i = 0; i < loops_.size(); i++) {
+      Map<Var, PrimExpr> var_map;
+      for (size_t j = 0; j < loops_[i].size(); j++) {
+        if (i == 0) {
+          std::string suffix = loops_[i][j]->loop_var->name_hint;

Review Comment:
   Here we could use `Var::copy_with_suffix` utility :)



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