tvm
Public Types | Public Member Functions | Static 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 = ffi::TypedFunction< bool(const IRModule &)>
 The function type of HasWorkload method. More...
 
using FCommitWorkload = ffi::TypedFunction< Workload(const IRModule &)>
 The function type of CommitWorkload method. More...
 
using FCommitTuningRecord = ffi::TypedFunction< void(const TuningRecord &)>
 The function type of CommitTuningRecord method. More...
 
using FGetTopK = ffi::TypedFunction< Array< TuningRecord >(const Workload &, int)>
 The function type of GetTopK method. More...
 
using FGetAllTuningRecords = ffi::TypedFunction< Array< TuningRecord >()>
 The function type of GetAllTuningRecords method. More...
 
using FQueryTuningRecord = ffi::TypedFunction< Optional< TuningRecord >(const IRModule &, const Target &, const String &)>
 The function type of QueryTuningRecord method. More...
 
using FQuerySchedule = ffi::TypedFunction< Optional< tir::Schedule >(const IRModule &, const Target &, const String &)>
 The function type of QuerySchedule method. More...
 
using FQueryIRModule = ffi::TypedFunction< Optional< IRModule >(const IRModule &, const Target &, const String &)>
 The function type of QueryIRModule method. More...
 
using FSize = ffi::TypedFunction< int64_t()>
 The function type of Size method. More...
 

Public Member Functions

 PyDatabaseNode (String mod_eq_name="structural")
 Constructor. More...
 
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)
 

Static Public Member Functions

static void RegisterReflection ()
 

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"
 

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

using tvm::meta_schedule::PyDatabaseNode::FGetTopK = ffi::TypedFunction<Array<TuningRecord>(const Workload&, int)>

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

using tvm::meta_schedule::PyDatabaseNode::FHasWorkload = ffi::TypedFunction<bool(const IRModule&)>

The function type of HasWorkload method.

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

◆ FQueryIRModule

using tvm::meta_schedule::PyDatabaseNode::FQueryIRModule = ffi::TypedFunction<Optional<IRModule>(const IRModule&, const Target&, const String&)>

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; std::nullopt if not found.

◆ FQuerySchedule

using tvm::meta_schedule::PyDatabaseNode::FQuerySchedule = ffi::TypedFunction<Optional<tir::Schedule>(const IRModule&, const Target&, const String&)>

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; std::nullopt if not found.

◆ FQueryTuningRecord

using tvm::meta_schedule::PyDatabaseNode::FQueryTuningRecord = ffi::TypedFunction<Optional<TuningRecord>(const IRModule&, const Target&, const String&)>

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; std::nullopt if not found.

◆ FSize

using tvm::meta_schedule::PyDatabaseNode::FSize = ffi::TypedFunction<int64_t()>

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; std::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; std::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; std::nullopt if not found.

Reimplemented from tvm::meta_schedule::DatabaseNode.

◆ RegisterReflection()

static void tvm::meta_schedule::PyDatabaseNode::RegisterReflection ( )
inlinestatic

◆ 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   
)

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: