tvm
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tvm::s_tir::meta_schedule::PyDatabaseObj Class Reference

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

#include <database.h>

Inheritance diagram for tvm::s_tir::meta_schedule::PyDatabaseObj:
Collaboration diagram for tvm::s_tir::meta_schedule::PyDatabaseObj:

Public Types

using FHasWorkload = ffi::TypedFunction< bool(const IRModule &)>
 The function type of HasWorkload method.
 
using FCommitWorkload = ffi::TypedFunction< Workload(const IRModule &)>
 The function type of CommitWorkload method.
 
using FCommitTuningRecord = ffi::TypedFunction< void(const TuningRecord &)>
 The function type of CommitTuningRecord method.
 
using FGetTopK = ffi::TypedFunction< ffi::Array< TuningRecord >(const Workload &, int)>
 The function type of GetTopK method.
 
using FGetAllTuningRecords = ffi::TypedFunction< ffi::Array< TuningRecord >()>
 The function type of GetAllTuningRecords method.
 
using FQueryTuningRecord = ffi::TypedFunction< ffi::Optional< TuningRecord >(const IRModule &, const Target &, const ffi::String &)>
 The function type of QueryTuningRecord method.
 
using FQuerySchedule = ffi::TypedFunction< ffi::Optional< s_tir::Schedule >(const IRModule &, const Target &, const ffi::String &)>
 The function type of QuerySchedule method.
 
using FQueryIRModule = ffi::TypedFunction< ffi::Optional< IRModule >(const IRModule &, const Target &, const ffi::String &)>
 The function type of QueryIRModule method.
 
using FSize = ffi::TypedFunction< int64_t()>
 The function type of Size method.
 

Public Member Functions

 PyDatabaseObj (ffi::String mod_eq_name="structural")
 Constructor.
 
bool HasWorkload (const IRModule &mod) final
 Check if the database has the given workload.
 
Workload CommitWorkload (const IRModule &mod) final
 Look up or add workload to the database if missing.
 
void CommitTuningRecord (const TuningRecord &record) final
 Add a tuning record to the database.
 
ffi::Array< TuningRecord > GetTopK (const Workload &workload, int top_k) final
 Get the top K valid tuning records of given workload from the database.
 
ffi::Array< TuningRecord > GetAllTuningRecords () final
 Get all tuning records from the database.
 
ffi::Optional< TuningRecord > QueryTuningRecord (const IRModule &mod, const Target &target, const ffi::String &workload_name) final
 Query the best record of the given workload from the database.
 
ffi::Optional< s_tir::Schedule > QuerySchedule (const IRModule &mod, const Target &target, const ffi::String &workload_name) final
 Query the best schedule of the given workload from the database.
 
ffi::Optional< IRModule > QueryIRModule (const IRModule &mod, const Target &target, const ffi::String &workload_name) final
 Query the best IRModule of the given workload from the database.
 
int64_t Size () final
 Get the size of the database.
 
 TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("s_tir.meta_schedule.PyDatabase", PyDatabaseObj, DatabaseObj)
 
- Public Member Functions inherited from tvm::s_tir::meta_schedule::DatabaseObj
 DatabaseObj (ffi::String mod_eq_name="structural")
 Constructor.
 
virtual ~DatabaseObj ()
 Default destructor.
 
void DumpPruned (Database destination)
 Prune the database and dump it a given database.
 
const ModuleEquality & GetModuleEquality () const
 Return a reference to the owned module equality method instance.
 
 TVM_FFI_DECLARE_OBJECT_INFO ("s_tir.meta_schedule.Database", DatabaseObj, ffi::Object)
 

Static Public Member Functions

static void RegisterReflection ()
 

Public Attributes

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

Static Public Attributes

static constexpr const bool _type_mutable = true
 
- Static Public Attributes inherited from tvm::s_tir::meta_schedule::DatabaseObj
static constexpr const bool _type_mutable = true
 

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::s_tir::meta_schedule::PyDatabaseObj::FGetTopK = ffi::TypedFunction<ffi::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::s_tir::meta_schedule::PyDatabaseObj::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::s_tir::meta_schedule::PyDatabaseObj::FQueryIRModule = ffi::TypedFunction<ffi::Optional<IRModule>(const IRModule&, const Target&, const ffi::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::s_tir::meta_schedule::PyDatabaseObj::FQuerySchedule = ffi::TypedFunction<ffi::Optional<s_tir::Schedule>( const IRModule&, const Target&, const ffi::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::s_tir::meta_schedule::PyDatabaseObj::FQueryTuningRecord = ffi::TypedFunction<ffi::Optional<TuningRecord>( const IRModule&, const Target&, const ffi::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::s_tir::meta_schedule::PyDatabaseObj::FSize = ffi::TypedFunction<int64_t()>

The function type of Size method.

Returns
The size of the database.

Constructor & Destructor Documentation

◆ PyDatabaseObj()

tvm::s_tir::meta_schedule::PyDatabaseObj::PyDatabaseObj ( ffi::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-tensor": Same as "structural", but ignore tensor 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-tensor" varint is used for the extracted blocks or in case no anchor block is found. For the definition of the anchor block, see tvm/tirx/analysis.h.

Member Function Documentation

◆ CommitTuningRecord()

void tvm::s_tir::meta_schedule::PyDatabaseObj::CommitTuningRecord ( const TuningRecord &  record)
inlinefinalvirtual

Add a tuning record to the database.

Parameters
recordThe tuning record to be added.

Implements tvm::s_tir::meta_schedule::DatabaseObj.

◆ CommitWorkload()

Workload tvm::s_tir::meta_schedule::PyDatabaseObj::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::s_tir::meta_schedule::DatabaseObj.

◆ GetAllTuningRecords()

ffi::Array< TuningRecord > tvm::s_tir::meta_schedule::PyDatabaseObj::GetAllTuningRecords ( )
inlinefinalvirtual

Get all tuning records from the database.

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

Implements tvm::s_tir::meta_schedule::DatabaseObj.

◆ GetTopK()

ffi::Array< TuningRecord > tvm::s_tir::meta_schedule::PyDatabaseObj::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::s_tir::meta_schedule::DatabaseObj.

◆ HasWorkload()

bool tvm::s_tir::meta_schedule::PyDatabaseObj::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::s_tir::meta_schedule::DatabaseObj.

◆ QueryIRModule()

ffi::Optional< IRModule > tvm::s_tir::meta_schedule::PyDatabaseObj::QueryIRModule ( const IRModule &  mod,
const Target &  target,
const ffi::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::s_tir::meta_schedule::DatabaseObj.

◆ QuerySchedule()

ffi::Optional< s_tir::Schedule > tvm::s_tir::meta_schedule::PyDatabaseObj::QuerySchedule ( const IRModule &  mod,
const Target &  target,
const ffi::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::s_tir::meta_schedule::DatabaseObj.

◆ QueryTuningRecord()

ffi::Optional< TuningRecord > tvm::s_tir::meta_schedule::PyDatabaseObj::QueryTuningRecord ( const IRModule &  mod,
const Target &  target,
const ffi::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::s_tir::meta_schedule::DatabaseObj.

◆ RegisterReflection()

static void tvm::s_tir::meta_schedule::PyDatabaseObj::RegisterReflection ( )
inlinestatic

◆ Size()

int64_t tvm::s_tir::meta_schedule::PyDatabaseObj::Size ( )
inlinefinalvirtual

Get the size of the database.

Returns
The size of the database.

Implements tvm::s_tir::meta_schedule::DatabaseObj.

◆ TVM_FFI_DECLARE_OBJECT_INFO_FINAL()

tvm::s_tir::meta_schedule::PyDatabaseObj::TVM_FFI_DECLARE_OBJECT_INFO_FINAL ( "s_tir.meta_schedule.PyDatabase"  ,
PyDatabaseObj  ,
DatabaseObj   
)

Member Data Documentation

◆ _type_mutable

constexpr const bool tvm::s_tir::meta_schedule::PyDatabaseObj::_type_mutable = true
staticconstexpr

◆ f_commit_tuning_record

FCommitTuningRecord tvm::s_tir::meta_schedule::PyDatabaseObj::f_commit_tuning_record

The packed function to the CommitTuningRecord function.

◆ f_commit_workload

FCommitWorkload tvm::s_tir::meta_schedule::PyDatabaseObj::f_commit_workload

The packed function to the CommitWorkload function.

◆ f_get_all_tuning_records

FGetAllTuningRecords tvm::s_tir::meta_schedule::PyDatabaseObj::f_get_all_tuning_records

The packed function to the GetAllTuningRecords function.

◆ f_get_top_k

FGetTopK tvm::s_tir::meta_schedule::PyDatabaseObj::f_get_top_k

The packed function to the GetTopK function.

◆ f_has_workload

FHasWorkload tvm::s_tir::meta_schedule::PyDatabaseObj::f_has_workload

The packed function to the HasWorkload function.

◆ f_query_ir_module

FQueryIRModule tvm::s_tir::meta_schedule::PyDatabaseObj::f_query_ir_module

The packed function to the QueryIRModule function.

◆ f_query_schedule

FQuerySchedule tvm::s_tir::meta_schedule::PyDatabaseObj::f_query_schedule

The packed function to the QuerySchedule function.

◆ f_query_tuning_record

FQueryTuningRecord tvm::s_tir::meta_schedule::PyDatabaseObj::f_query_tuning_record

The packed function to the QueryTuningRecord function.

◆ f_size

FSize tvm::s_tir::meta_schedule::PyDatabaseObj::f_size

The packed function to the Size function.


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