24#ifndef TVM_TIR_ANALYSIS_H_
25#define TVM_TIR_ANALYSIS_H_
68template <
class FLambda>
70 for (
const auto&
kv : mod->functions) {
Managed reference to BaseFuncNode.
Definition function.h:250
Managed reference to GlobalVarNode.
Definition expr.h:429
Managed reference class to IRModuleNode.
Definition module.h:255
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:401
A local variable in the IR.
Definition expr.h:355
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Primitive functions that contains TIR statements.
Definition function.h:49
Managed reference to PrimFuncNode.
Definition function.h:105
Container of all statements.
Definition stmt.h:67
PassContext that is used to configure the pass behavior.
Definition transform.h:151
IRModule that holds the functions and type definitions.
size_t CalculateExprComplexity(const PrimExpr &expr)
Calculate the expression complexity based on number of symbols it contains.
size_t CalculateConstantBytes(const PrimFunc &func, int64_t constant_byte_alignment)
Calculate the constants size in bytes needed by the TIR allocates inside the TIR PrimFunc.
bool VerifyMemory(const PrimFunc &func)
Verify if memory accesses are legal for a specific target device type.
bool VerifyWellFormed(const PrimFunc &func, bool assert_mode=true)
Verify if the given TIR is well-formed. The verification includes:
ffi::Array< Var > UndefinedVars(const Stmt &stmt, const ffi::Array< Var > &defs)
Find undefined vars in the statement.
bool VerifySSA(const PrimFunc &func)
Verifies whether the IR stmt or Expr is in SSA form. That is: each Var is defined and assigned once(i...
CallEffectKind SideEffect(const PrimExpr &expr)
Analyze the side effect of an expression.
size_t CalculateWorkspaceBytes(const PrimFunc &func, int64_t workspace_byte_alignment)
Calculate the workspace size in bytes needed by the TIR allocates inside the TIR PrimFunc.
bool UsesVar(const Stmt &stmt, std::function< bool(const VarNode *)> vset_contains)
Whether the given Stmt uses any var in the given variable set.
CallEffectKind
The effect type of the call.
Definition op_attr_types.h:105
void VisitPrimFuncs(const IRModule &mod, FLambda fvisit)
Visit the PrimFuncs in the IRModule.
Definition analysis.h:69
const PrimFuncNode * FindEntryFunc(const IRModule &mod, GlobalVar *result_g_var)
Find the entry function of the given IRModule, i.e, functions marked by tirx::attr::kIsEntryFunc,...
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
Analysis utilities for Schedulable TensorIR (S-TIR).
Compare two expressions recursively and check if they are equal to each other without var remapping.
Definition analysis.h:57
bool operator()(const PrimExpr &lhs, const PrimExpr &rhs) const
Compilation target object.
Attribute types in the Op registry for TIR ops.