tvm
Public Types | Public Member Functions | Public Attributes | List of all members
tvm::s_tir::meta_schedule::PyCostModelNode Class Reference

The cost model with customized methods on the python-side. More...

#include <cost_model.h>

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

Public Types

using FLoad = ffi::TypedFunction< void(ffi::String)>
 Load the cost model from given file location. More...
 
using FSave = ffi::TypedFunction< void(ffi::String)>
 Save the cost model to given file location. More...
 
using FUpdate = ffi::TypedFunction< void(const TuneContext &, const ffi::Array< MeasureCandidate > &, const ffi::Array< RunnerResult > &)>
 Update the cost model given running results. More...
 
using FPredict = ffi::TypedFunction< void(const TuneContext &, const ffi::Array< MeasureCandidate > &, void *p_addr)>
 Predict the running results of given measure candidates. More...
 

Public Member Functions

void Load (const ffi::String &path)
 Load the cost model from given file location. More...
 
void Save (const ffi::String &path)
 Save the cost model to given file location. More...
 
void Update (const TuneContext &context, const ffi::Array< MeasureCandidate > &candidates, const ffi::Array< RunnerResult > &results)
 Update the cost model given running results. More...
 
std::vector< double > Predict (const TuneContext &context, const ffi::Array< MeasureCandidate > &candidates)
 Predict the normalized score (the larger the better) of given measure candidates. More...
 
 TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("s_tir.meta_schedule.PyCostModel", PyCostModelNode, CostModelNode)
 
- Public Member Functions inherited from tvm::s_tir::meta_schedule::CostModelNode
virtual ~CostModelNode ()=default
 Virtual destructor. More...
 
 TVM_FFI_DECLARE_OBJECT_INFO ("s_tir.meta_schedule.CostModel", CostModelNode, ffi::Object)
 

Public Attributes

FLoad f_load
 The packed function to the Load function. More...
 
FSave f_save
 The packed function to the Save function. More...
 
FUpdate f_update
 The packed function to the Update function. More...
 
FPredict f_predict
 The packed function to the Predict function. More...
 

Additional Inherited Members

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

Detailed Description

The cost model with customized methods on the python-side.

Member Typedef Documentation

◆ FLoad

using tvm::s_tir::meta_schedule::PyCostModelNode::FLoad = ffi::TypedFunction<void(ffi::String)>

Load the cost model from given file location.

Parameters
pathThe file path.

◆ FPredict

using tvm::s_tir::meta_schedule::PyCostModelNode::FPredict = ffi::TypedFunction<void(const TuneContext&, const ffi::Array<MeasureCandidate>&, void* p_addr)>

Predict the running results of given measure candidates.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
p_addrThe address to save the estimated running results.

◆ FSave

using tvm::s_tir::meta_schedule::PyCostModelNode::FSave = ffi::TypedFunction<void(ffi::String)>

Save the cost model to given file location.

Parameters
pathThe file path.

◆ FUpdate

using tvm::s_tir::meta_schedule::PyCostModelNode::FUpdate = ffi::TypedFunction<void(const TuneContext&, const ffi::Array<MeasureCandidate>&, const ffi::Array<RunnerResult>&)>

Update the cost model given running results.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
resultsThe running results of the measure candidates.
Returns
Whether cost model was updated successfully.

Member Function Documentation

◆ Load()

void tvm::s_tir::meta_schedule::PyCostModelNode::Load ( const ffi::String &  path)
virtual

Load the cost model from given file location.

Parameters
pathThe file path.

Implements tvm::s_tir::meta_schedule::CostModelNode.

◆ Predict()

std::vector<double> tvm::s_tir::meta_schedule::PyCostModelNode::Predict ( const TuneContext context,
const ffi::Array< MeasureCandidate > &  candidates 
)
virtual

Predict the normalized score (the larger the better) of given measure candidates.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
Returns
The predicted normalized score.

Implements tvm::s_tir::meta_schedule::CostModelNode.

◆ Save()

void tvm::s_tir::meta_schedule::PyCostModelNode::Save ( const ffi::String &  path)
virtual

Save the cost model to given file location.

Parameters
pathThe file path.

Implements tvm::s_tir::meta_schedule::CostModelNode.

◆ TVM_FFI_DECLARE_OBJECT_INFO_FINAL()

tvm::s_tir::meta_schedule::PyCostModelNode::TVM_FFI_DECLARE_OBJECT_INFO_FINAL ( "s_tir.meta_schedule.PyCostModel"  ,
PyCostModelNode  ,
CostModelNode   
)

◆ Update()

void tvm::s_tir::meta_schedule::PyCostModelNode::Update ( const TuneContext context,
const ffi::Array< MeasureCandidate > &  candidates,
const ffi::Array< RunnerResult > &  results 
)
virtual

Update the cost model given running results.

Parameters
contextThe tuning context.
candidatesThe measure candidates.
resultsThe running results of the measure candidates.

Implements tvm::s_tir::meta_schedule::CostModelNode.

Member Data Documentation

◆ f_load

FLoad tvm::s_tir::meta_schedule::PyCostModelNode::f_load

The packed function to the Load function.

◆ f_predict

FPredict tvm::s_tir::meta_schedule::PyCostModelNode::f_predict

The packed function to the Predict function.

◆ f_save

FSave tvm::s_tir::meta_schedule::PyCostModelNode::f_save

The packed function to the Save function.

◆ f_update

FUpdate tvm::s_tir::meta_schedule::PyCostModelNode::f_update

The packed function to the Update function.


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