24 #ifndef TVM_TIR_ANALYSIS_H_
25 #define TVM_TIR_ANALYSIS_H_
68 template <
class FLambda>
70 for (
const auto& kv :
mod->functions) {
71 const BaseFunc& base_func = kv.second;
72 if (
const auto* prim_func = base_func.as<
PrimFuncNode>()) {
216 namespace transform {
255 bool device_func =
false);
265 bool device_func =
false);
Managed reference to BaseFuncNode.
Definition: function.h:250
Managed reference to GlobalVarNode.
Definition: expr.h:303
Managed reference class to IRModuleNode.
Definition: module.h:255
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition: base_expr.h:354
Primitive functions that contains TIR statements.
Definition: function.h:49
Managed reference to PrimFuncNode.
Definition: function.h:154
Container of all statements.
Definition: stmt.h:64
A variable node in the IR.
Definition: var.h:49
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:
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,...
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.
ffi::Array< Var > UndefinedVars(const Stmt &stmt, const ffi::Array< Var > &defs)
Find undefined vars in the statement.
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
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:310
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.