You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Hzfengsy (via GitHub)" <gi...@apache.org> on 2024/01/23 04:28:03 UTC

Re: [PR] [Schedule] Loop-Partition Scheduling Primitive [tvm]

Hzfengsy commented on code in PR #16431:
URL: https://github.com/apache/tvm/pull/16431#discussion_r1462709310


##########
src/tir/schedule/concrete_schedule.cc:
##########
@@ -500,6 +500,143 @@ Array<LoopRV> ConcreteScheduleNode::Split(const LoopRV& loop_rv,
   return CreateRV<LoopRV>(results);
 }
 
+Array<LoopRV> ConcreteScheduleNode::LoopPartition(const LoopRV& loop_rv,
+                                                  const Array<Optional<ExprRV>>& factor_rvs,
+                                                  bool preserve_unit_iters) {
+  class SymbolicShapeError : public ScheduleError {
+   public:
+    explicit SymbolicShapeError(IRModule mod, For loop) : mod_(mod), loop_(std::move(loop)) {}
+
+    String FastErrorString() const final {
+      return "ScheduleError: The min and extent values of the loop are required to be known at "
+             "compile time. However, dynamic shape has been detected.";
+    }
+
+    String DetailRenderTemplate() const final {
+      return "Detected dynamic shape in either min or extent of a loop {0}";
+    }
+
+    IRModule mod() const final { return mod_; }
+    Array<ObjectRef> LocationsOfInterest() const final { return {loop_}; }
+
+    IRModule mod_;
+    For loop_;
+  };
+
+  class NotSingleInferFactorError : public ScheduleError {
+   public:
+    explicit NotSingleInferFactorError(IRModule mod) : mod_(mod) {}
+
+    String FastErrorString() const final {
+      return "ScheduleError: only one factor can be specified as -1 or none";
+    }
+
+    String DetailRenderTemplate() const final {
+      return "Only one factor can be specified as -1 or none";
+    }
+
+    IRModule mod() const final { return mod_; }
+    Array<ObjectRef> LocationsOfInterest() const final { return {}; }
+
+    IRModule mod_;
+  };
+
+  class WrongFactorSumError : public ScheduleError {
+   public:
+    explicit WrongFactorSumError(IRModule mod, For loop) : mod_(mod), loop_(std::move(loop)) {}
+
+    String FastErrorString() const final {
+      return "ScheduleError: The sum of factors is larger than or equal to the extent of "
+             "loop";
+    }
+
+    String DetailRenderTemplate() const final {
+      return "The sum of factors is not larger than or equal to the extent of loop {0}";
+    }
+
+    IRModule mod() const final { return mod_; }
+    Array<ObjectRef> LocationsOfInterest() const final { return {loop_}; }
+
+    IRModule mod_;
+    For loop_;
+  };
+
+  class NonPositiveFactorError : public ScheduleError {

Review Comment:
   Would be great to reuse the same error class as Split. 



##########
src/tir/schedule/primitive/get_block_loop.cc:
##########
@@ -238,7 +238,7 @@ struct GetOutputBlocksTraits : public UnpackedInstTraits<GetOutputBlocksTraits>
 
   static String UnpackedAsPython(Array<String> outputs, String block_rv) {
     PythonAPICall py("get_output_blocks");
-    py.Input("block", block_rv);
+    py.Input("scope_block", block_rv);

Review Comment:
   I'm not sure what the purpose of this change. Maybe a typo?



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