You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "masahi (via GitHub)" <gi...@apache.org> on 2023/03/03 06:50:54 UTC

[GitHub] [tvm] masahi commented on a diff in pull request #14182: [Unity] Introduce Default Schedule Pass

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


##########
src/meta_schedule/utils.h:
##########
@@ -554,6 +554,68 @@ inline double Sum(const Array<FloatImm>& arr) {
   return sum;
 }
 
+/*! \brief Collecting all the blocks */
+class BlockCollector : public tir::StmtVisitor {
+ public:
+  static Array<tir::BlockRV> Collect(const tir::Schedule& sch,
+                                     const runtime::PackedFunc f_block_filter = nullptr) {  //
+    return BlockCollector(sch, f_block_filter).Run();
+  }
+
+ private:
+  /*! \brief Entry point */
+  Array<tir::BlockRV> Run() {
+    std::vector<tir::BlockRV> results;
+    for (const auto& kv : sch_->mod()->functions) {
+      const GlobalVar& gv = kv.first;         // `gv->name_hint` is the name of the function
+      const BaseFunc& base_func = kv.second;  // this can be PrimFunc or relay::Function

Review Comment:
   can use
   
   ```
   for (const auto& [gv, base_func]: ...
   ```



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