comaniac commented on a change in pull request #6187: URL: https://github.com/apache/incubator-tvm/pull/6187#discussion_r464178492
########## File path: include/tvm/auto_scheduler/cost_model.h ########## @@ -0,0 +1,160 @@ +/* + * 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 tvm/auto_scheduler/cost_model.h + * \brief Cost models that estimate the performance of programs + */ + +#ifndef TVM_AUTO_SCHEDULER_COST_MODEL_H_ +#define TVM_AUTO_SCHEDULER_COST_MODEL_H_ + +#include <tvm/auto_scheduler/compute_dag.h> +#include <tvm/auto_scheduler/measure.h> +#include <tvm/node/node.h> +#include <tvm/runtime/packed_func.h> + +#include <vector> + +namespace tvm { +namespace auto_scheduler { + +using runtime::PackedFunc; +using runtime::TypedPackedFunc; + +/*! \brief The base class for cost model */ +class CostModelNode : public Object { + public: + /*! + * \brief Update the cost model according to new measurement results (training data). + * \param inputs The measure inputs + * \param results The measure results + */ + virtual void Update(const Array<MeasureInput>& inputs, const Array<MeasureResult>& results) = 0; + + /*! + * \brief Predict the scores of states + * \param task The search task of states + * \param states The input states + * \param scores The predicted scores for all states + */ + virtual void Predict(const SearchTask& task, const std::vector<State>& states, + std::vector<float>* scores) = 0; + + /*! + * \brief Predict the scores of all stages in states + * \param task The search task + * \param states The input states + * \param state_scores The predicted scores for all states + * \param stage_scores The predicted scores for all stages in all stages + */ + virtual void PredictStages(const SearchTask& task, const std::vector<State>& states, Review comment: This is needed by crossover, and it should be useful for future developments IMO. ---------------------------------------------------------------- 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]
