tvm
|
Classes | |
class | AssertDoc |
Reference type of AssertDocNode. More... | |
class | AssertDocNode |
Doc that represents assert statement. More... | |
class | AssignDoc |
Reference type of AssignDocNode. More... | |
class | AssignDocNode |
Doc that represents assign statement. More... | |
class | AttrAccessDoc |
Reference type of AttrAccessDocNode. More... | |
class | AttrAccessDocNode |
Doc that represents attribute access on another expression. More... | |
class | CallDoc |
Reference type of CallDocNode. More... | |
class | CallDocNode |
Doc that represents function call. More... | |
class | ClassDoc |
Reference type of ClassDocNode. More... | |
class | ClassDocNode |
Doc that represents class definition. More... | |
class | DictDoc |
Reference type of DictDocNode. More... | |
class | DictDocNode |
Doc that represents dictionary literal. More... | |
class | Doc |
Reference type of DocNode. More... | |
class | DocNode |
The base class of all Doc. More... | |
class | ExprDoc |
Reference type of ExprDocNode. More... | |
class | ExprDocNode |
The base class of expression doc. More... | |
class | ExprStmtDoc |
Reference type of ExprStmtDocNode. More... | |
class | ExprStmtDocNode |
Doc that represents an expression as statement. More... | |
class | ForDoc |
Reference type of ForDocNode. More... | |
class | ForDocNode |
Doc that represents for statement. More... | |
class | Frame |
Reference type of FrameNode. More... | |
class | FrameNode |
class | FunctionDoc |
Reference type of FunctionDocNode. More... | |
class | FunctionDocNode |
Doc that represents function definition. More... | |
class | IdDoc |
Reference type of IdDocNode. More... | |
class | IdDocNode |
Doc that represents identifier. More... | |
class | IfDoc |
Reference type of IfDocNode. More... | |
class | IfDocNode |
Doc that represent if-then-else statement. More... | |
class | IndexDoc |
Reference type of IndexDocNode. More... | |
class | IndexDocNode |
Doc that represents index access on another expression. More... | |
class | IRDocsifier |
Reference type of IRDocsifierNode. More... | |
class | IRDocsifierNode |
IRDocsifier is the top-level interface in the IR->Doc process. More... | |
class | LambdaDoc |
Reference type of LambdaDocNode. More... | |
class | LambdaDocNode |
Doc that represents anonymous function. More... | |
class | ListDoc |
Reference type of ListDocNode. More... | |
class | ListDocNode |
Doc that represents list literal. More... | |
class | LiteralDoc |
Reference type of LiteralDocNode. More... | |
class | LiteralDocNode |
Doc that represents literal value. More... | |
class | MetadataFrame |
Reference type of MetadataFrameNode. More... | |
class | MetadataFrameNode |
MetadataFrame contains information like contant parameter array. More... | |
class | OperationDoc |
Reference type of OperationDocNode. More... | |
class | OperationDocNode |
Doc that represents operation. More... | |
class | ReturnDoc |
Reference type of ReturnDocNode. More... | |
class | ReturnDocNode |
Doc that represents return statement. More... | |
class | RootNodeContainer |
class | RootNodeContainerNode |
A wrapper object to provide injection point for printer of each IR. More... | |
class | ScopeDoc |
Reference type of ScopeDocNode. More... | |
class | ScopeDocNode |
Doc that represents special scopes. More... | |
class | SliceDoc |
Reference type of SliceDocNode. More... | |
class | SliceDocNode |
Doc that represents slice in Index expression. More... | |
class | StmtBlockDoc |
Reference type of StmtBlockDocNode. More... | |
class | StmtBlockDocNode |
The container doc that holds a list of StmtDoc. More... | |
class | StmtDoc |
Reference type of StmtDocNode. More... | |
class | StmtDocNode |
The base class of statement doc. More... | |
class | TracedObjectFunctor |
Dynamic dispatch functor based on TracedObject. More... | |
class | TupleDoc |
Reference type of TupleDocNode. More... | |
class | TupleDocNode |
Doc that represents tuple literal. More... | |
class | VarDefFrame |
Reference type of VarDefFrameNode. More... | |
class | VarDefFrameNode |
VarDefFrame contains information about the free variables that needs to be defined at the beginning of the printed snippet. More... | |
class | VarTable |
Reference type of VarTableNode. More... | |
class | VarTableNode |
Variable Table manages mapping from variable object to ExprDoc during the process of printing TVMScript. More... | |
class | WhileDoc |
Reference type of WhileDocNode. More... | |
class | WhileDocNode |
Doc that represents while statement. More... | |
Typedefs | |
using | WithCtx = With< ContextManager > |
using | DispatchTable = std::unordered_map< std::string, std::vector< runtime::PackedFunc > > |
Functions | |
String | DocToPythonScript (Doc doc, int indent_spaces=4, bool print_line_numbers=false, int num_context_lines=-1, Optional< ObjectPath > path_to_underline=NullOpt) |
Convert Doc into Python script. More... | |
const runtime::PackedFunc & | GetDispatchFunction (const DispatchTable &dispatch_table, const String &token, uint32_t type_index) |
Get function from dispatch table. More... | |
void | SetDispatchFunction (DispatchTable *dispatch_table, const String &token, uint32_t type_index, runtime::PackedFunc f) |
Set function in dispatch table. More... | |
void | RemoveDispatchFunction (DispatchTable *dispatch_table, const String &token, uint32_t type_index) |
Remove function from dispatch table. More... | |
String | Script (const ObjectRef &root_node, String ir_name, Map< String, String > ir_prefix, int indent_spaces=4, bool print_line_numbers=false, int num_context_lines=-1, Optional< ObjectPath > path_to_underline=NullOpt) |
Print IR graph as TVMScript code. More... | |
Variables | |
constexpr const char * | kDefaultDispatchToken = "" |
using tvm::script::printer::DispatchTable = typedef std::unordered_map<std::string, std::vector<runtime::PackedFunc> > |
using tvm::script::printer::WithCtx = typedef With<ContextManager> |
String tvm::script::printer::DocToPythonScript | ( | Doc | doc, |
int | indent_spaces = 4 , |
||
bool | print_line_numbers = false , |
||
int | num_context_lines = -1 , |
||
Optional< ObjectPath > | path_to_underline = NullOpt |
||
) |
Convert Doc into Python script.
This function unpacks the DocPrinterOptions into function arguments to be FFI friendly.
doc | Doc to be converted |
indent_spaces | Number of spaces used for indentation |
print_line_numbers | Whether to print line numbers |
num_context_lines | Number of context lines to print around the underlined text |
path_to_underline | Object path to be underlined |
const runtime::PackedFunc& tvm::script::printer::GetDispatchFunction | ( | const DispatchTable & | dispatch_table, |
const String & | token, | ||
uint32_t | type_index | ||
) |
Get function from dispatch table.
dispatch_table | The dispatch table. |
token | The dispatch token. |
type_index | The type index of the Object type to be dispatched. |
void tvm::script::printer::RemoveDispatchFunction | ( | DispatchTable * | dispatch_table, |
const String & | token, | ||
uint32_t | type_index | ||
) |
Remove function from dispatch table.
dispatch_table | The dispatch table. |
token | The dispatch token. |
type_index | The TVM object type index for the dispatch function to be removed. |
String tvm::script::printer::Script | ( | const ObjectRef & | root_node, |
String | ir_name, | ||
Map< String, String > | ir_prefix, | ||
int | indent_spaces = 4 , |
||
bool | print_line_numbers = false , |
||
int | num_context_lines = -1 , |
||
Optional< ObjectPath > | path_to_underline = NullOpt |
||
) |
Print IR graph as TVMScript code.
root_node | The root node to print. |
ir_name | The dispatch token of the target IR, e.g., "tir", "relax". |
ir_prefix | The symbol name for TVMScript IR namespaces. For example, {"tir": "T"}. |
indent_spaces | Number of spaces used for indentation |
print_line_numbers | Whether to print line numbers |
num_context_lines | Number of context lines to print around the underlined text |
path_to_underline | Object path to be underlined |
void tvm::script::printer::SetDispatchFunction | ( | DispatchTable * | dispatch_table, |
const String & | token, | ||
uint32_t | type_index, | ||
runtime::PackedFunc | f | ||
) |
Set function in dispatch table.
dispatch_table | The dispatch table. |
token | The dispatch token. |
type_index | The type index of the Object type to be dispatched. |
f | The dispatch function. |
constexpr const char* tvm::script::printer::kDefaultDispatchToken = "" |