tvm
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
tvm::transform::PassContext Class Reference

PassContext that is used to configure the pass behavior. More...

#include <transform.h>

Inheritance diagram for tvm::transform::PassContext:
Collaboration diagram for tvm::transform::PassContext:

Public Types

using ContainerType = PassContextNode
 

Public Member Functions

 PassContext ()
 
 PassContext (ObjectPtr< Object > n)
 
const PassContextNodeoperator-> () const
 const accessor. More...
 
PassContextNodeoperator-> ()
 mutable accessor. More...
 
void InstrumentEnterPassContext ()
 Call instrument implementations' callbacks when entering PassContext. The callbacks are called in order, and if one raises an exception, the rest will not be called. More...
 
void InstrumentExitPassContext ()
 Call instrument implementations' callbacks when exiting PassContext. The callbacks are called in order, and if one raises an exception, the rest will not be called. More...
 
bool InstrumentBeforePass (const IRModule &mod, const PassInfo &info) const
 Call instrument implementations' callbacks before a pass run. The callbacks are called in order, and if one raises an exception, the rest will not be called. More...
 
void InstrumentAfterPass (const IRModule &mod, const PassInfo &info) const
 Call instrument implementations callbacks after a pass run. The callbacks are called in order, and if one raises an exception, the rest will not be called. More...
 
bool PassEnabled (const PassInfo &info) const
 Check whether a pass is enabled. More...
 

Static Public Member Functions

static PassContext Create ()
 Construct a PassContext containing the default configurations. More...
 
static PassContext Current ()
 Get the default pass context in the current scope. More...
 
static Map< String, Map< String, String > > ListConfigs ()
 Get all supported configuration names and metadata, registered within the PassContext. More...
 
template<typename ValueType >
static int32_t RegisterConfigOption (const char *key)
 Register a valid configuration option and its ValueType for validation. More...
 

Friends

class Internal
 
class With< PassContext >
 

Detailed Description

PassContext that is used to configure the pass behavior.

auto new_ctx = PassContext::Create();
ctx->opt_level = 2;
With<PassContext> scope(ctx);
// pass context in effect.
friend class With< PassContext >
Definition: transform.h:296
static PassContext Create()
Construct a PassContext containing the default configurations.
See also
PassContextNode

Member Typedef Documentation

◆ ContainerType

Constructor & Destructor Documentation

◆ PassContext() [1/2]

tvm::transform::PassContext::PassContext ( )
inline

◆ PassContext() [2/2]

tvm::transform::PassContext::PassContext ( ObjectPtr< Object >  n)
inlineexplicit

Member Function Documentation

◆ Create()

static PassContext tvm::transform::PassContext::Create ( )
static

Construct a PassContext containing the default configurations.

Returns
The new PassContext.

◆ Current()

static PassContext tvm::transform::PassContext::Current ( )
static

Get the default pass context in the current scope.

Returns
The pass context.

◆ InstrumentAfterPass()

void tvm::transform::PassContext::InstrumentAfterPass ( const IRModule mod,
const PassInfo info 
) const

Call instrument implementations callbacks after a pass run. The callbacks are called in order, and if one raises an exception, the rest will not be called.

Parameters
modThe module that an optimization pass runs on.
infoThe pass information.

◆ InstrumentBeforePass()

bool tvm::transform::PassContext::InstrumentBeforePass ( const IRModule mod,
const PassInfo info 
) const

Call instrument implementations' callbacks before a pass run. The callbacks are called in order, and if one raises an exception, the rest will not be called.

Parameters
modThe module that an optimization pass runs on.
infoThe pass information.
Returns
false: the pass is skipped; true: the pass runs.

◆ InstrumentEnterPassContext()

void tvm::transform::PassContext::InstrumentEnterPassContext ( )

Call instrument implementations' callbacks when entering PassContext. The callbacks are called in order, and if one raises an exception, the rest will not be called.

◆ InstrumentExitPassContext()

void tvm::transform::PassContext::InstrumentExitPassContext ( )

Call instrument implementations' callbacks when exiting PassContext. The callbacks are called in order, and if one raises an exception, the rest will not be called.

◆ ListConfigs()

static Map<String, Map<String, String> > tvm::transform::PassContext::ListConfigs ( )
static

Get all supported configuration names and metadata, registered within the PassContext.

Returns
Map indexed by the config name, pointing to the metadata map as key-value

◆ operator->() [1/2]

PassContextNode* tvm::transform::PassContext::operator-> ( )
inline

mutable accessor.

Returns
mutable access pointer.

◆ operator->() [2/2]

const PassContextNode* tvm::transform::PassContext::operator-> ( ) const
inline

const accessor.

Returns
const access pointer.

◆ PassEnabled()

bool tvm::transform::PassContext::PassEnabled ( const PassInfo info) const

Check whether a pass is enabled.

Parameters
infoThe pass information.
Returns
true if the pass is enabled. Otherwise, false.

◆ RegisterConfigOption()

template<typename ValueType >
static int32_t tvm::transform::PassContext::RegisterConfigOption ( const char *  key)
inlinestatic

Register a valid configuration option and its ValueType for validation.

Parameters
keyThe configuration key.
Template Parameters
ValueTypeThe value type to be registered

Friends And Related Function Documentation

◆ Internal

friend class Internal
friend

◆ With< PassContext >

friend class With< PassContext >
friend

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