tvm
Classes | Namespaces | Functions
analysis.h File Reference

Analysis utilities for Schedulable TensorIR (S-TIR). More...

#include <tvm/ir/module.h>
#include <tvm/ir/transform.h>
#include <tvm/target/target.h>
#include <tvm/tirx/function.h>
#include <tvm/tirx/stmt.h>
#include <optional>
Include dependency graph for analysis.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tvm::s_tir::MemCpyDetails
 Helper struct for return value of IdentifyMemCpy. More...
 

Namespaces

 tvm
 An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
 
 tvm::tirx
 
 tvm::arith
 namespace of arithmetic analysis.
 
 tvm::s_tir
 
 tvm::s_tir::transform
 

Functions

ffi::Array< ffi::Array< BufferRegion > > tvm::tirx::GetSBlockAccessRegion (const SBlock &block, const ffi::Map< Var, Buffer > &buffer_var_map)
 Auto detect the block access region according to its body stmt It will detect the access region as an array in order of appearance in AST. More...
 
ffi::Array< ffi::Array< BufferRegion > > tvm::tirx::GetSBlockReadWriteRegion (const SBlock &block, const ffi::Map< Var, Buffer > &buffer_var_map)
 Auto detect the block read/write region according to its body stmt. An opaque access will be counted as both a read and a write access. More...
 
ffi::Map< Buffer, ffi::Optional< Stmt > > tvm::tirx::DetectBufferAccessLCA (const PrimFunc &func)
 Detect the lowest common ancestor(LCA) of buffer access, including both high-level access(BufferLoad, BufferStore) and low-level access(Load, Store and opaque access). The LCA may be a For loop or a Block. More...
 
const tirx::SBlockNode * tvm::tirx::FindAnchorBlock (const IRModule &mod)
 Find the "anchor block" of the given module. We define the anchor block to be the block with (1) an init statement and (2) having the biggest flops count. The latter condition is only used when there are multiple blocks with an init statement. For example, if the input module is conv2d + fused spatial blocks, conv2d is the anchor block. The input module may not contain more than one such block. For example, a module having two conv2d is not allowed as an input. However, a module created from winograd convolution has multiple blocks with an init statement (input transform, batched GEMM, and output transform). We use the second condition, the flops count, to determine that the batched GEMM block is the anchor block. More...
 
double tvm::s_tir::EstimateTIRFlops (const Stmt &stmt)
 Estimate the FLOPs of a TIR fragment. More...
 
double tvm::s_tir::EstimateTIRFlops (const IRModule &mod)
 Estimate the FLOPs of TIRs in an IRModule. More...
 
bool tvm::s_tir::IsPureFunction (const PrimFunc &func, bool assert_on_error=false)
 Analyze the side effect of a function. More...
 
bool tvm::s_tir::VerifyGPUCode (const PrimFunc &func, ffi::Map< ffi::String, PrimExpr > constraints)
 Verify the correctness of a GPU code. More...
 
std::optional< MemCpyDetails > tvm::s_tir::IdentifyMemCpy (const For &loop, arith::Analyzer *analyzer)
 Identify whether a For loop is semantically equivalent to MemCpy. More...
 
ffi::Map< ffi::String, ffi::Map< ffi::String, Integer > > tvm::s_tir::CalculateAllocatedBytes (const PrimFunc &func)
 Calculate the allocated memory per scope in bytes needed inside the TIR PrimFunc. More...
 
ffi::Map< ffi::String, ffi::Map< ffi::String, Integer > > tvm::s_tir::CalculateAllocatedBytes (const IRModule &mod)
 Calculate the allocated memory per scope in bytes for each function inside the module. More...
 
ffi::Array< tvm::transform::Passtvm::s_tir::GetVTCMCompactionPasses ()
 Get the list of lowering passes to calculate the compacted VTCM allocation size. More...
 
bool tvm::s_tir::VerifyVTCMLimit (const IRModule &mod, Integer limit)
 Verifies that the VTCM usage for all prim_funcs in the given IRModule. More...
 
bool tvm::s_tir::VerifyVTCMLimit (const PrimFunc &func, Integer limit)
 Verifies that the VTCM usage of the given prim_func is within the provided limit. More...
 
Pass tvm::s_tir::transform::VerifyGPUCode (ffi::Map< ffi::String, PrimExpr > constraints)
 Pass to verify GPU code constraints. More...
 
Pass tvm::s_tir::transform::VerifyVTCMLimit (ffi::Optional< Target > default_target=std::nullopt)
 Pass to check if VTCM usage is within limit. More...
 
Pass tvm::s_tir::transform::OOBChecker ()
 Statically check TIR code for out of bounds array access. More...
 

Detailed Description

Analysis utilities for Schedulable TensorIR (S-TIR).