tvm
Loading...
Searching...
No Matches
Classes | Functions
tvm::transform Namespace Reference

Classes

class  Pass
 
class  PassContext
 PassContext that is used to configure the pass behavior. More...
 
class  PassContextObj
 PassContextObj contains the information that a pass can rely on, such as analysis results. More...
 
class  PassInfo
 Managed reference class for PassInfoObj. More...
 
class  PassInfoObj
 Meta data that will be used to help optimization and analysis. More...
 
class  PassInstrument
 Managed reference class for PassInstrumentObj. More...
 
class  PassInstrumentObj
 PassInstrumentObj forms an instrument implementation. It provides API for users to register callbacks at different instrumentation points. More...
 
class  PassObj
 PassObj is the base type of differnt types of optimization passes. It is designed as a pure class and implemented by different pass subclasses at different granularity of Relax nodes. More...
 
class  Sequential
 
class  SequentialObj
 The SequentialObj contains a set of passes that transform Relax programs from one AST to another semantically equivalent one. More...
 

Functions

template<typename TConfig >
TConfig PassConfigWithDefaults ()
 Create a pass-config object with all default values, using the reflection defaults.
 
TVM_TIRX_DLL Pass CreateModulePass (std::function< IRModule(IRModule, PassContext)> pass_func, int opt_level, ffi::String name)
 
TVM_TIRX_DLL Pass PrintIR (ffi::String header="")
 A special trace pass that prints the header and IR to LOG(INFO).
 
TVM_TIRX_DLL ffi::Error EnrichPassErrorWithContext (const ffi::Error &err, const IRModule &mod, ffi::String pass_name, ffi::Optional< GlobalVar > func=ffi::Optional< GlobalVar >(std::nullopt))
 Enrich a pass-time error with a TVMScript-rendered, underlined source location derived from the error's embedded VisitErrorContext.
 

Function Documentation

◆ CreateModulePass()

TVM_TIRX_DLL Pass tvm::transform::CreateModulePass ( std::function< IRModule(IRModule, PassContext)>  pass_func,
int  opt_level,
ffi::String  name 
)

◆ EnrichPassErrorWithContext()

TVM_TIRX_DLL ffi::Error tvm::transform::EnrichPassErrorWithContext ( const ffi::Error &  err,
const IRModule &  mod,
ffi::String  pass_name,
ffi::Optional< GlobalVar >  func = ffi::Optional< GlobalVar >(std::nullopt) 
)

Enrich a pass-time error with a TVMScript-rendered, underlined source location derived from the error's embedded VisitErrorContext.

Returns an ffi::Error that preserves err's kind, original message, and backtrace, and appends the failing pass name plus the offending location rendered as TVMScript (the whole mod, or local to func when provided). The returned error drops the VisitErrorContext payload, so an outer catch that re-enriches finds no context and returns the error unchanged.

Pure and total: never throws; returns err unchanged when there is no context, the path is unresolvable, or rendering fails.

Parameters
errThe error thrown by the pass body.
modThe IRModule the pass ran on (the access-path root, or the container of func when func is provided).
pass_nameThe name of the failing pass, shown in the message.
funcWhen set, resolve and render the location local to mod->functions[func]; otherwise use the whole module.
Returns
The enriched (or, on any fallback, the original) error.

◆ PassConfigWithDefaults()

template<typename TConfig >
TConfig tvm::transform::PassConfigWithDefaults ( )
inline

Create a pass-config object with all default values, using the reflection defaults.

Template Parameters
TConfigthe ObjectRef type to be created.
Returns
An instance with all reflection-defined default values applied.

◆ PrintIR()

TVM_TIRX_DLL Pass tvm::transform::PrintIR ( ffi::String  header = "")

A special trace pass that prints the header and IR to LOG(INFO).

Parameters
headerThe header to be attached to the output.
Returns
The pass.