tvm
Classes | Functions
tvm::transform Namespace Reference

Classes

class  PassContextNode
 PassContextNode contains the information that a pass can rely on, such as analysis results. More...
 
class  PassContext
 PassContext that is used to configure the pass behavior. More...
 
class  PassInfoNode
 Meta data that will be used to help optimization and analysis. More...
 
class  PassInfo
 Managed reference class for PassInfoNode. More...
 
class  PassNode
 PassNode 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  Pass
 
class  SequentialNode
 The SequentialNode contains a set of passes that transform Relax programs from one AST to another semantically equivalent one. More...
 
class  Sequential
 

Functions

template<typename TConfig >
TConfig PassConfigWithDefaults ()
 Create a pass-config object with all default values, using the reflection defaults. More...
 
Pass CreateModulePass (std::function< IRModule(IRModule, PassContext)> pass_func, int opt_level, ffi::String name, ffi::Array< ffi::String > required, bool traceable=false)
 
Pass PrintIR (ffi::String header="")
 A special trace pass that prints the header and IR to LOG(INFO). More...
 
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. More...
 

Function Documentation

◆ CreateModulePass()

Pass tvm::transform::CreateModulePass ( std::function< IRModule(IRModule, PassContext)>  pass_func,
int  opt_level,
ffi::String  name,
ffi::Array< ffi::String >  required,
bool  traceable = false 
)

◆ EnrichPassErrorWithContext()

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

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.