1 | /* |
2 | * Licensed to the Apache Software Foundation (ASF) under one |
3 | * or more contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. The ASF licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, |
13 | * software distributed under the License is distributed on an |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | * KIND, either express or implied. See the License for the |
16 | * specific language governing permissions and limitations |
17 | * under the License. |
18 | */ |
19 | |
20 | #ifndef TVM_META_SCHEDULE_MEASURE_CANDIDATE_H_ |
21 | #define TVM_META_SCHEDULE_MEASURE_CANDIDATE_H_ |
22 | |
23 | #include <tvm/meta_schedule/arg_info.h> |
24 | #include <tvm/node/reflection.h> |
25 | #include <tvm/runtime/container/array.h> |
26 | #include <tvm/runtime/object.h> |
27 | #include <tvm/tir/schedule/schedule.h> |
28 | |
29 | namespace tvm { |
30 | namespace meta_schedule { |
31 | |
32 | /*! \brief The schedule (with input shapes) to be measured. */ |
33 | class MeasureCandidateNode : public runtime::Object { |
34 | public: |
35 | /*! \brief The schedule for measurement. */ |
36 | tir::Schedule sch; |
37 | /*! \brief The argument information, e.g., (shape, dtype) for tensors. */ |
38 | Array<ArgInfo> args_info; |
39 | |
40 | void VisitAttrs(tvm::AttrVisitor* v) { |
41 | v->Visit("sch" , &sch); |
42 | v->Visit("args_info" , &args_info); |
43 | } |
44 | |
45 | static constexpr const char* _type_key = "meta_schedule.MeasureCandidate" ; |
46 | TVM_DECLARE_FINAL_OBJECT_INFO(MeasureCandidateNode, Object); |
47 | }; |
48 | |
49 | /*! |
50 | * \brief Managed reference to MeasureCandidateNode. |
51 | * \sa MeasureCandidateNode |
52 | */ |
53 | class MeasureCandidate : public runtime::ObjectRef { |
54 | public: |
55 | /*! |
56 | * \brief Constructor of MeasureCandidate. |
57 | * \param sch The schedule for measurement. |
58 | * \param args_info The argument information, e.g., (shape, dtype) for tensors. |
59 | */ |
60 | TVM_DLL MeasureCandidate(tir::Schedule sch, Array<ArgInfo> args_info); |
61 | TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(MeasureCandidate, ObjectRef, MeasureCandidateNode); |
62 | }; |
63 | |
64 | } // namespace meta_schedule |
65 | } // namespace tvm |
66 | |
67 | #endif // TVM_META_SCHEDULE_MEASURE_CANDIDATE_H_ |
68 | |