tvm
apply_history_best.h
Go to the documentation of this file.
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 #ifndef TVM_META_SCHEDULE_APPLY_HISTORY_BEST_H_
20 #define TVM_META_SCHEDULE_APPLY_HISTORY_BEST_H_
21 
22 #include <tvm/ir/module.h>
24 #include <tvm/node/reflection.h>
28 #include <tvm/runtime/object.h>
30 #include <tvm/target/target.h>
31 #include <tvm/te/tensor.h>
32 
33 namespace tvm {
34 namespace meta_schedule {
35 
41  public:
43  using FTEFilterFunc =
47 
49  Database database{nullptr};
54 
56  v->Visit("database", &database);
57  // `te_filter_func` is not visited
58  // `logging_func` is not visited
59  }
70  Optional<Array<IRModule>> dispatched,
71  FTakeTuningRecord f_take_tuning_record);
72 
73  static constexpr const char* _type_key = "meta_schedule.ApplyHistoryBest";
75 };
76 
82  public:
95  static Optional<ApplyHistoryBest> Current();
96 
99 
100  protected:
101  friend class ApplyHistoryBestInternal;
103  void EnterWithScope();
105  void ExitWithScope();
106 };
107 
108 } // namespace meta_schedule
109 } // namespace tvm
110 
111 #endif // TVM_META_SCHEDULE_APPLY_HISTORY_BEST_H_
Runtime Optional container types.
#define TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:758
Runtime String container types.
IRModule that holds the functions and type definitions.
PackedFunc logging_func
The logging function to be used.
Definition: apply_history_best.h:53
Database database
The database to be queried from.
Definition: apply_history_best.h:49
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Managed reference to ApplyHistoryBestNode.
Definition: apply_history_best.h:81
base class of all object containers.
Definition: object.h:167
Runtime Array container types.
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Dataflow tensor object.
Optional< IRModule > Query(runtime::String task_name, IRModule mod, Target target, Optional< Array< IRModule >> dispatched, FTakeTuningRecord f_take_tuning_record)
Query the best entry from the database.
Managed reference to DatabaseNode.
Definition: database.h:314
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:270
void VisitAttrs(tvm::AttrVisitor *v)
Definition: apply_history_best.h:55
Reference to string objects.
Definition: string.h:124
Managed reference class to TargetNode.
Definition: target.h:141
Base class of all object reference.
Definition: object.h:511
A managed object in the TVM runtime.
static constexpr const char * _type_key
Definition: apply_history_best.h:73
Managed reference class to IRModuleNode.
Definition: module.h:360
Compilation target object.
An integration context that allows application of historically best records from a database...
Definition: apply_history_best.h:40
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:138
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
TVM_DECLARE_FINAL_OBJECT_INFO(ApplyHistoryBestNode, runtime::Object)
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
Reflection and serialization of compiler IR/AST nodes.
FTEFilterFunc te_filter_func
The filtering function for TE computation.
Definition: apply_history_best.h:51
Type-erased function used across TVM API.