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.
| 118 | |
| 119 | @tvm_ffi.register_object("arith.Analyzer") |
| 120 | class 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. |
no outgoing calls
searching dependent graphs…