tvm
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tvm::meta_schedule::PyDatabaseNode Class Reference

The database with customized methods on the python-side. More...

#include <database.h>

Inheritance diagram for tvm::meta_schedule::PyDatabaseNode:
Collaboration diagram for tvm::meta_schedule::PyDatabaseNode:

Public Types

using FHasWorkload = runtime::TypedPackedFunc< bool(const IRModule &)>
 The function type of HasWorkload method. More...
 
using FCommitWorkload = runtime::TypedPackedFunc< Workload(const IRModule &)>
 The function type of CommitWorkload method. More...
 
using FCommitTuningRecord = runtime::TypedPackedFunc< void(const TuningRecord &)>
 The function type of CommitTuningRecord method. More...
 
using FGetTopK = runtime::TypedPackedFunc< Array< TuningRecord >(const Workload &, int)>
 The function type of GetTopK method. More...
 
using FGetAllTuningRecords = runtime::TypedPackedFunc< Array< TuningRecord >()>
 The function type of GetAllTuningRecords method. More...
 
using FQueryTuningRecord = runtime::TypedPackedFunc< Optional< TuningRecord >(const IRModule &, const Target &, const String &)>
 The function type of QueryTuningRecord method. More...
 
using FQuerySchedule = runtime::TypedPackedFunc< Optional< tir::Schedule >(const IRModule &, const Target &, const String &)>
 The function type of QuerySchedule method. More...
 
using FQueryIRModule = runtime::TypedPackedFunc< Optional< IRModule >(const IRModule &, const Target &, const String &)>
 The function type of QueryIRModule method. More...
 
using FSize = runtime::TypedPackedFunc< int64_t()>
 The function type of Size method. More...
 
- Public Types inherited from tvm::runtime::Object
typedef void(* FDeleter) (Object *self)
 Object deleter. More...
 
using RefCounterType = std::atomic< int32_t >
 

Public Member Functions

 PyDatabaseNode (String mod_eq_name="structural")
 Constructor. More...
 
void VisitAttrs (tvm::AttrVisitor *v)
 
bool HasWorkload (const IRModule &mod) final
 Check if the database has the given workload. More...
 
Workload CommitWorkload (const IRModule &mod) final
 Look up or add workload to the database if missing. More...
 
void CommitTuningRecord (const TuningRecord &record) final
 Add a tuning record to the database. More...
 
Array< TuningRecordGetTopK (const Workload &workload, int top_k) final
 Get the top K valid tuning records of given workload from the database. More...
 
Array< TuningRecordGetAllTuningRecords () final
 Get all tuning records from the database. More...
 
Optional< TuningRecordQueryTuningRecord (const IRModule &mod, const Target &target, const String &workload_name) final
 Query the best record of the given workload from the database. More...
 
Optional< tir::ScheduleQuerySchedule (const IRModule &mod, const Target &target, const String &workload_name) final
 Query the best schedule of the given workload from the database. More...
 
Optional< IRModuleQueryIRModule (const IRModule &mod, const Target &target, const String &workload_name) final
 Query the best IRModule of the given workload from the database. More...
 
int64_t Size () final
 Get the size of the database. More...
 
 TVM_DECLARE_FINAL_OBJECT_INFO (PyDatabaseNode, DatabaseNode)
 
- Public Member Functions inherited from tvm::meta_schedule::DatabaseNode
 DatabaseNode (String mod_eq_name="structural")
 Constructor. More...
 
virtual ~DatabaseNode ()
 Default destructor. More...
 
void DumpPruned (Database destination)
 Prune the database and dump it a given database. More...
 
const ModuleEquality & GetModuleEquality () const
 Return a reference to the owned module equality method instance. More...
 
 TVM_DECLARE_BASE_OBJECT_INFO (DatabaseNode, runtime::Object)
 
- Public Member Functions inherited from tvm::runtime::Object
uint32_t type_index () const
 
std::string GetTypeKey () const
 
size_t GetTypeKeyHash () const
 
template<typename TargetType >
bool IsInstance () const
 
bool unique () const
 
 Object ()
 
 Object (const Object &other)
 
 Object (Object &&other)
 
Objectoperator= (const Object &other)
 
Objectoperator= (Object &&other)
 

Public Attributes

FHasWorkload f_has_workload
 The packed function to the HasWorkload function. More...
 
FCommitWorkload f_commit_workload
 The packed function to the CommitWorkload function. More...
 
FCommitTuningRecord f_commit_tuning_record
 The packed function to the CommitTuningRecord function. More...
 
FGetTopK f_get_top_k
 The packed function to the GetTopK function. More...
 
FGetAllTuningRecords f_get_all_tuning_records
 The packed function to the GetAllTuningRecords function. More...
 
FQueryTuningRecord f_query_tuning_record
 The packed function to the QueryTuningRecord function. More...
 
FQuerySchedule f_query_schedule
 The packed function to the QuerySchedule function. More...
 
FQueryIRModule f_query_ir_module
 The packed function to the QueryIRModule function. More...
 
FSize f_size
 The packed function to the Size function. More...
 

Static Public Attributes

static constexpr const char * _type_key = "meta_schedule.PyDatabase"
 
- Static Public Attributes inherited from tvm::meta_schedule::DatabaseNode
static constexpr const char * _type_key = "meta_schedule.Database"
 
- Static Public Attributes inherited from tvm::runtime::Object
static constexpr const char * _type_key = "runtime.Object"
 
static constexpr bool _type_final = false
 
static constexpr uint32_t _type_child_slots = 0
 
static constexpr bool _type_child_slots_can_overflow = true
 
static constexpr bool _type_has_method_visit_attrs = true
 
static constexpr bool _type_has_method_sequal_reduce = false
 
static constexpr bool _type_has_method_shash_reduce = false
 
static constexpr uint32_t _type_index = TypeIndex::kDynamic
 

Additional Inherited Members

- Static Public Member Functions inherited from tvm::runtime::Object
static std::string TypeIndex2Key (uint32_t tindex)
 Get the type key of the corresponding index from runtime. More...
 
static size_t TypeIndex2KeyHash (uint32_t tindex)
 Get the type key hash of the corresponding index from runtime. More...
 
static uint32_t TypeKey2Index (const std::string &key)
 Get the type index of the corresponding key from runtime. More...
 
static uint32_t _GetOrAllocRuntimeTypeIndex ()
 
static uint32_t RuntimeTypeIndex ()
 
- Protected Member Functions inherited from tvm::runtime::Object
void IncRef ()
 developer function, increases reference counter. More...
 
void DecRef ()
 developer function, decrease reference counter. More...
 
- Static Protected Member Functions inherited from tvm::runtime::Object
static uint32_t GetOrAllocRuntimeTypeIndex (const std::string &key, uint32_t static_tindex, uint32_t parent_tindex, uint32_t type_child_slots, bool type_child_slots_can_overflow)
 Get the type index using type key. More...
 
- Protected Attributes inherited from tvm::runtime::Object
uint32_t type_index_ {0}
 Type index(tag) that indicates the type of the object. More...
 
RefCounterType ref_counter_ {0}
 The internal reference counter. More...
 
FDeleter deleter_ = nullptr
 deleter of this object to enable customized allocation. If the deleter is nullptr, no deletion will be performed. The creator of the object must always set the deleter field properly. More...
 

Detailed Description

The database with customized methods on the python-side.

Member Typedef Documentation

◆ FCommitTuningRecord

The function type of CommitTuningRecord method.

Parameters
recordThe tuning record to be added.

◆ FCommitWorkload

The function type of CommitWorkload method.

Parameters
modThe IRModule to be searched for or added.
Returns
The workload corresponding to the given IRModule.

◆ FGetAllTuningRecords

The function type of GetAllTuningRecords method.

Returns
An Array of all the tuning records in the database.

◆ FGetTopK

The function type of GetTopK method.

Parameters
workloadThe workload to be searched for.
top_kThe number of top records to be returned.
Returns
An array of top K tuning records for the given workload.

◆ FHasWorkload

The function type of HasWorkload method.

Parameters
modThe IRModule to be searched for.
Returns
Whether the database has the given workload.

◆ FQueryIRModule

The function type of QueryIRModule method.

Parameters
modThe IRModule to be searched for.
targetThe target to be searched for.
workload_nameThe name of the workload to be searched for.
Returns
The IRModule in the best IRModule of the given workload; NullOpt if not found.

◆ FQuerySchedule

The function type of QuerySchedule method.

Parameters
modThe IRModule to be searched for.
targetThe target to be searched for.
workload_nameThe name of the workload to be searched for.
Returns
The schedule in the best schedule of the given workload; NullOpt if not found.

◆ FQueryTuningRecord

The function type of QueryTuningRecord method.

Parameters
modThe IRModule to be searched for.
targetThe target to be searched for.
workload_nameThe name of the workload to be searched for.
Returns
The best record of the given workload; NullOpt if not found.

◆ FSize

The function type of Size method.

Returns
The size of the database.

Constructor & Destructor Documentation

◆ PyDatabaseNode()

tvm::meta_schedule::PyDatabaseNode::PyDatabaseNode ( String  mod_eq_name = "structural")
explicit

Constructor.

Parameters
mod_eq_nameA string to specify the module equality testing and hashing method. It must be one of the followings:
  • "structural": Use StructuralEqual/Hash
  • "ignore-ndarray": Same as "structural", but ignore ndarray raw data during equality testing and hashing.
  • "anchor-block": Apply equality testing and hashing on the anchor block extracted from a given module. The "ignore-ndarray" varint is used for the extracted blocks or in case no anchor block is found. For the definition of the anchor block, see tvm/tir/analysis.h.

Member Function Documentation

◆ CommitTuningRecord()

void tvm::meta_schedule::PyDatabaseNode::CommitTuningRecord ( const TuningRecord record)
inlinefinalvirtual

Add a tuning record to the database.

Parameters
recordThe tuning record to be added.

Implements tvm::meta_schedule::DatabaseNode.

◆ CommitWorkload()

Workload tvm::meta_schedule::PyDatabaseNode::CommitWorkload ( const IRModule mod)
inlinefinalvirtual

Look up or add workload to the database if missing.

Parameters
modThe IRModule to be searched for or added.
Returns
The workload corresponding to the given IRModule.

Implements tvm::meta_schedule::DatabaseNode.

◆ GetAllTuningRecords()

Array<TuningRecord> tvm::meta_schedule::PyDatabaseNode::GetAllTuningRecords ( )
inlinefinalvirtual

Get all tuning records from the database.

Returns
An Array of all the tuning records in the database.

Implements tvm::meta_schedule::DatabaseNode.

◆ GetTopK()

Array<TuningRecord> tvm::meta_schedule::PyDatabaseNode::GetTopK ( const Workload workload,
int  top_k 
)
inlinefinalvirtual

Get the top K valid tuning records of given workload from the database.

Parameters
workloadThe workload to be searched for.
top_kThe number of top records to be returned.
Returns
An array of top K tuning records for the given workload.

Implements tvm::meta_schedule::DatabaseNode.

◆ HasWorkload()

bool tvm::meta_schedule::PyDatabaseNode::HasWorkload ( const IRModule mod)
inlinefinalvirtual

Check if the database has the given workload.

Parameters
modThe IRModule to be searched for.
Returns
Whether the database has the given workload.

Implements tvm::meta_schedule::DatabaseNode.

◆ QueryIRModule()

Optional<IRModule> tvm::meta_schedule::PyDatabaseNode::QueryIRModule ( const IRModule mod,
const Target target,
const String workload_name 
)
inlinefinalvirtual

Query the best IRModule of the given workload from the database.

Parameters
modThe IRModule to be searched for.
targetThe target to be searched for.
workload_nameThe name of the workload to be searched for.
Returns
The IRModule in the best IRModule of the given workload; NullOpt if not found.

Reimplemented from tvm::meta_schedule::DatabaseNode.

◆ QuerySchedule()

Optional<tir::Schedule> tvm::meta_schedule::PyDatabaseNode::QuerySchedule ( const IRModule mod,
const Target target,
const String workload_name 
)
inlinefinalvirtual

Query the best schedule of the given workload from the database.

Parameters
modThe IRModule to be searched for.
targetThe target to be searched for.
workload_nameThe name of the workload to be searched for.
Returns
The schedule in the best schedule of the given workload; NullOpt if not found.

Reimplemented from tvm::meta_schedule::DatabaseNode.

◆ QueryTuningRecord()

Optional<TuningRecord> tvm::meta_schedule::PyDatabaseNode::QueryTuningRecord ( const IRModule mod,
const Target target,
const String workload_name 
)
inlinefinalvirtual

Query the best record of the given workload from the database.

Parameters
modThe IRModule to be searched for.
targetThe target to be searched for.
workload_nameThe name of the workload to be searched for.
Returns
The best record of the given workload; NullOpt if not found.

Reimplemented from tvm::meta_schedule::DatabaseNode.

◆ Size()

int64_t tvm::meta_schedule::PyDatabaseNode::Size ( )
inlinefinalvirtual

Get the size of the database.

Returns
The size of the database.

Implements tvm::meta_schedule::DatabaseNode.

◆ TVM_DECLARE_FINAL_OBJECT_INFO()

tvm::meta_schedule::PyDatabaseNode::TVM_DECLARE_FINAL_OBJECT_INFO ( PyDatabaseNode  ,
DatabaseNode   
)

◆ VisitAttrs()

void tvm::meta_schedule::PyDatabaseNode::VisitAttrs ( tvm::AttrVisitor v)
inline

Member Data Documentation

◆ _type_key

constexpr const char* tvm::meta_schedule::PyDatabaseNode::_type_key = "meta_schedule.PyDatabase"
staticconstexpr

◆ f_commit_tuning_record

FCommitTuningRecord tvm::meta_schedule::PyDatabaseNode::f_commit_tuning_record

The packed function to the CommitTuningRecord function.

◆ f_commit_workload

FCommitWorkload tvm::meta_schedule::PyDatabaseNode::f_commit_workload

The packed function to the CommitWorkload function.

◆ f_get_all_tuning_records

FGetAllTuningRecords tvm::meta_schedule::PyDatabaseNode::f_get_all_tuning_records

The packed function to the GetAllTuningRecords function.

◆ f_get_top_k

FGetTopK tvm::meta_schedule::PyDatabaseNode::f_get_top_k

The packed function to the GetTopK function.

◆ f_has_workload

FHasWorkload tvm::meta_schedule::PyDatabaseNode::f_has_workload

The packed function to the HasWorkload function.

◆ f_query_ir_module

FQueryIRModule tvm::meta_schedule::PyDatabaseNode::f_query_ir_module

The packed function to the QueryIRModule function.

◆ f_query_schedule

FQuerySchedule tvm::meta_schedule::PyDatabaseNode::f_query_schedule

The packed function to the QuerySchedule function.

◆ f_query_tuning_record

FQueryTuningRecord tvm::meta_schedule::PyDatabaseNode::f_query_tuning_record

The packed function to the QueryTuningRecord function.

◆ f_size

FSize tvm::meta_schedule::PyDatabaseNode::f_size

The packed function to the Size function.


The documentation for this class was generated from the following file: