merrymercy commented on a change in pull request #5962: URL: https://github.com/apache/incubator-tvm/pull/5962#discussion_r449743165
########## File path: src/ansor/transform_step.h ########## @@ -0,0 +1,225 @@ +/* + * 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. + */ + +/*! + * \file ansor/transform_step.h + * \brief Transformation steps. For each schedule primitive, there is a corresponding transform + * step. The implementation of each step consists of 2 parts: + * - transform_step.cc: How each step interact with TVM system + * - loop_state.cc: How each step reflect on LoopState + * + * \note Adding a new transform step. + * Take fuse step for example: + * 1. Define class `FuseStepNode`, `FuseStep` in `transform_steps.h`, and implement its construction + * function `FuseStep::FuseStep(...)` in `transform_steps.cc` + * 2. Implement `FuseStepNode::ApplyToSchedule` and `FuseStepNode::PrintAsPythonAPI`. + * - In these two functions you need to lower this step with tvm's te schedule API + * 3. Implement `State::fuse` and `State::DoFuseStep`. + * - In these two functions you need to incrementally update all data structures in State with + * CopyOnWrite style + * 4. Add you step to `ComputeDAG::ApplySteps` and make sure it works. + * 5. Add serialization support in `struct Handler<Array<::tvm::ansor::Step> >` + * in `serialization.cc`. + * 6. Add its corresponding Python API to `loop_state.py` and necessary unit test. + */ + +#ifndef TVM_ANSOR_TRANSFORM_STEP_H_ +#define TVM_ANSOR_TRANSFORM_STEP_H_ + +#include <dmlc/common.h> +#include <tvm/node/node.h> +#include <tvm/te/schedule.h> + +#include "utils.h" + +namespace tvm { +namespace ansor { + +typedef Map<tvm::te::Stage, Array<tir::IterVar>, ObjectHash, ObjectEqual> StageToAxesMap; + +/*! + * \brief The base class of transformation steps. Each step has its corresponding tvm.te + * schedule primitives. + */ +class StepNode : public Object { + public: + /*! \brief The index of the target stage. */ Review comment: Remove all "target" in this file ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
