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 Types inherited from tvm::runtime::ObjectRef
using ContainerType = Object
 type indicate the container type. More...
 

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...
 
- Public Member Functions inherited from tvm::runtime::ObjectRef
 ObjectRef ()=default
 default constructor More...
 
 ObjectRef (ObjectPtr< Object > data)
 Constructor from existing object ptr. More...
 
bool same_as (const ObjectRef &other) const
 Comparator. More...
 
bool operator== (const ObjectRef &other) const
 Comparator. More...
 
bool operator!= (const ObjectRef &other) const
 Comparator. More...
 
bool operator< (const ObjectRef &other) const
 Comparator. More...
 
bool defined () const
 
const Objectget () const
 
const Objectoperator-> () const
 
bool unique () const
 
int use_count () const
 
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>>
const ObjectType * as () const
 Try to downcast the internal Object to a raw pointer of a corresponding type. More...
 
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>>
Optional< ObjectRefType > as () const
 Try to downcast the ObjectRef to a Optional<T> of the requested type. 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 uint32_t RegisterConfigOption (const char *key)
 Register a valid configuration option and its ValueType for validation. More...
 

Friends

class Internal
 
class With< PassContext >
 

Additional Inherited Members

- Static Public Attributes inherited from tvm::runtime::ObjectRef
static constexpr bool _type_is_nullable = true
 
- Protected Member Functions inherited from tvm::runtime::ObjectRef
Objectget_mutable () const
 
- Static Protected Member Functions inherited from tvm::runtime::ObjectRef
template<typename T >
static T DowncastNoCheck (ObjectRef ref)
 Internal helper function downcast a ref without check. More...
 
static void FFIClearAfterMove (ObjectRef *ref)
 Clear the object ref data field without DecRef after we successfully moved the field. More...
 
template<typename ObjectType >
static ObjectPtr< ObjectType > GetDataPtr (const ObjectRef &ref)
 Internal helper function get data_ as ObjectPtr of ObjectType. More...
 
- Protected Attributes inherited from tvm::runtime::ObjectRef
ObjectPtr< Objectdata_
 Internal pointer that backs the reference. More...
 

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:292
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 uint32_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: