MCPcopy
hub / github.com/apache/tvm / Analyzer

Class Analyzer

python/tvm/arith/analyzer.py:120–426  ·  view source on GitHub ↗

Integer arithmetic analyzer This is a stateful analyzer class that can be used to perform various symbolic integer analysis. The same analyzer instance can be passed to FFI APIs to share accumulated facts across calls.

Source from the content-addressed store, hash-verified

118
119@tvm_ffi.register_object("arith.Analyzer")
120class Analyzer(Object):
121 """Integer arithmetic analyzer
122
123 This is a stateful analyzer class that can be used to perform
124 various symbolic integer analysis. The same analyzer instance can
125 be passed to FFI APIs to share accumulated facts across calls.
126 """
127
128 def __init__(self):
129 self.__init_handle_by_constructor__(_ffi_api.Analyzer)
130
131 def const_int_bound(self, expr: tirx.PrimExpr) -> ConstIntBound:
132 """Find constant integer bound for expr.
133
134 Parameters
135 ----------
136 expr : PrimExpr
137 The expression.
138
139 Returns
140 -------
141 bound : ConstIntBound
142 The result bound
143 """
144 return _ffi_api.AnalyzerConstIntBound(self, expr)
145
146 def const_int_bound_is_bound(self, var: tirx.Var) -> bool:
147 """Check if a variable is bound to a range.
148
149 Parameters
150 ----------
151 var : tvm.tirx.Var
152 The variable.
153
154 Returns
155 -------
156 result : bool
157 Whether the variable is bound to a range.
158 """
159 return _ffi_api.AnalyzerConstIntBoundIsBound(self, var)
160
161 def modular_set(self, expr: tirx.PrimExpr) -> ModularSet:
162 """Find a modular set that expr belongs to.
163
164 Parameters
165 ----------
166 expr : PrimExpr
167 The expression.
168
169 Returns
170 -------
171 result : ModularSet
172 The result.
173 """
174 return _ffi_api.AnalyzerModularSet(self, expr)
175
176 def simplify(self, expr: tirx.PrimExpr, steps: int = 2) -> tirx.PrimExpr:
177 """Simplify expression via both rewrite and canonicalization.

Callers 15

_check_matmulFunction · 0.90
_check_shape_equalFunction · 0.90
init_analyzerFunction · 0.90
validate_gemm_opFunction · 0.90
get_local_regionFunction · 0.90
validate_copy_opFunction · 0.90
get_vec_lenFunction · 0.90
tma_atom_compatibleFunction · 0.90
gemm_cuda_mma_dispatchFunction · 0.90
_r_side_layout_validFunction · 0.90
_tensor_shape_ofFunction · 0.90

Calls

no outgoing calls

Tested by 3

check_region_boundFunction · 0.72
case1Function · 0.72
verify_sliceFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…