nverke commented on code in PR #13721: URL: https://github.com/apache/tvm/pull/13721#discussion_r1110182294
########## 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: I am not sure I follow. If we don't inherit we would have to copy all of the logic needed over from MLT with intrin. But we don't want to add software pipelines to all usages of MLT with intrin as this will try to optimize for hexagon. -- 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]
