adstraw commented on code in PR #13721:
URL: https://github.com/apache/tvm/pull/13721#discussion_r1113070937


##########
src/meta_schedule/schedule_rule/multi_level_tiling_hexagon.cc:
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "../../tir/schedule/analysis.h"
+#include "../../tir/schedule/transform.h"
+#include "../utils.h"
+#include "multi_level_tiling_with_intrin.h"
+
+namespace tvm {
+namespace meta_schedule {
+
+using tir::BlockRV;
+using tir::LoopRV;
+using tir::Schedule;
+
+class MultiLevelTilingHexagonNode : public MultiLevelTilingWithIntrinNode {
+ private:
+  // Subrule: Add software pipeline
+  inline std::vector<State> AddSoftwarePipeline(State state) const;
+
+  // Override ApplySubRules to apply tensorization-specific sub-rules
+  std::vector<State> ApplySubRules(std::vector<State> states) final;
+
+  // Inherited from ScheduleRuleNode
+  ScheduleRule Clone() const override {
+    ObjectPtr<MultiLevelTilingHexagonNode> n = 
make_object<MultiLevelTilingHexagonNode>(*this);
+    return ScheduleRule(n);
+  }
+
+ public:
+  /*! \brief Whether to use software pipeline */
+  bool use_software_pipeline = false;
+  static constexpr const char* _type_key = 
"meta_schedule.MultiLevelTilingHexagon";
+  TVM_DECLARE_FINAL_OBJECT_INFO(MultiLevelTilingHexagonNode, 
MultiLevelTilingNode);
+};
+
+std::vector<State> 
MultiLevelTilingHexagonNode::ApplySubRules(std::vector<State> states) {
+  states = MultiLevelTilingWithIntrinNode::ApplySubRules(states);
+  states = SubRule(std::move(states), [&](State state) { return 
AddSoftwarePipeline(state); });

Review Comment:
   My comment may be naïve.  My read of the code was that the only connection 
between `MultiLevelTilingWithIntrin` and `AddSoftwarePipeline` schedule rules 
was the order in which they were applied.  And that we were using inheritance 
to ensure that order was maintained.  And that there was no further value to 
the inheritance beyond maintaining that order.  If any of that is wrong, let me 
know and we can scrap this comment.  If I am correct, perhaps there is a way to 
create two separate passes ... one for software pipeline and one for 
multi-level tiling.



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