tvm
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | 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 = PassContextObj
 

Public Member Functions

 PassContext (ffi::UnsafeInit tag)
 constructor with UnsafeInit
 
 PassContext (ffi::UnsafeInit tag, ffi::ObjectPtr< PassContextObj > n)
 constructor with ffi::ObjectPtr
 
const PassContextObj * operator-> () const
 const accessor.
 
PassContextObj * operator-> ()
 mutable accessor.
 
TVM_TIRX_DLL 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.
 
TVM_TIRX_DLL 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.
 
TVM_TIRX_DLL 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.
 
TVM_TIRX_DLL 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.
 
TVM_TIRX_DLL bool PassEnabled (const PassInfo &info) const
 Check whether a pass is enabled.
 

Static Public Member Functions

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

Static Public Attributes

static constexpr bool _type_is_nullable = false
 

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.
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
static TVM_TIRX_DLL PassContext Create()
Construct a PassContext containing the default configurations.
See also
PassContextObj

Member Typedef Documentation

◆ ContainerType

Constructor & Destructor Documentation

◆ PassContext() [1/2]

tvm::transform::PassContext::PassContext ( ffi::UnsafeInit  tag)
inlineexplicit

constructor with UnsafeInit

◆ PassContext() [2/2]

tvm::transform::PassContext::PassContext ( ffi::UnsafeInit  tag,
ffi::ObjectPtr< PassContextObj >  n 
)
inlineexplicit

constructor with ffi::ObjectPtr

Member Function Documentation

◆ Create()

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

Construct a PassContext containing the default configurations.

Returns
The new PassContext.

◆ Current()

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

Get the default pass context in the current scope.

Returns
The pass context.

◆ InstrumentAfterPass()

TVM_TIRX_DLL 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()

TVM_TIRX_DLL 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()

TVM_TIRX_DLL 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()

TVM_TIRX_DLL 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 TVM_TIRX_DLL ffi::Map< ffi::String, ffi::Map< ffi::String, ffi::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]

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

mutable accessor.

Returns
mutable access pointer.

◆ operator->() [2/2]

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

const accessor.

Returns
const access pointer.

◆ PassEnabled()

TVM_TIRX_DLL 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 void 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 Symbol Documentation

◆ Internal

friend class Internal
friend

◆ With< PassContext >

friend class With< PassContext >
friend

Member Data Documentation

◆ _type_is_nullable

constexpr bool tvm::transform::PassContext::_type_is_nullable = false
staticconstexpr

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