|
tvm
|
Rewrite-rule based simplifier. More...
#include <analyzer.h>
Public Types | |
| enum | Extension { kNone = 0 , kTransitivelyProveInequalities = (1 << 0) , kConvertBooleanToAndOfOrs = (1 << 1) , kApplyConstraintsToBooleanBranches = (1 << 2) , kComparisonOfProductAndSum = (1 << 3) } |
| Flags to enable more computationally-intensive simplifications. More... | |
Public Member Functions | |
| PrimExpr | operator() (const PrimExpr &expr) |
| analyze the expr More... | |
| void | Update (const Var &var, const PrimExpr &new_expr, bool allow_override=false) |
| Update binding of var to a new expression. More... | |
| std::function< void()> | EnterConstraint (const PrimExpr &constraint) |
| Update the internal state to enter constraint. More... | |
| void | SetEnabledExtensions (Extension flags) |
| Enable an optional extension or extensions. More... | |
| Extension | GetEnabledExtensions () const |
| Return the currently enabled extensions. More... | |
| ObjectRef | GetStatsCounters () const |
| Return the statistics counters. More... | |
| void | ResetStatsCounters () |
| Reset the statistics counters. More... | |
| void | SetMaximumRewriteSteps (int64_t maximum) |
| Set the maximum allowed number of rewrite steps. More... | |
Friends | |
| class | Analyzer |
| class | ConstraintContext |
| class | CanonicalSimplifier |
Rewrite-rule based simplifier.
Flags to enable more computationally-intensive simplifications.
These simplifications may be required for specific schedules, but would impose too high a compile-time cost to enable by default. They can be enabled on an as-needed basis by calling RewriteSimplifier::SetEnabledExtensions prior to using RewriteSimplifier::operator().
Flags are defined as powers of two to allow future expansion. To enable multiple extensions, a user should pass a bitwise OR of the flags for each desired extension.
| Enumerator | |
|---|---|
| kNone | |
| kTransitivelyProveInequalities | |
| kConvertBooleanToAndOfOrs | |
| kApplyConstraintsToBooleanBranches | |
| kComparisonOfProductAndSum | |
| std::function<void()> tvm::arith::RewriteSimplifier::EnterConstraint | ( | const PrimExpr & | constraint | ) |
Update the internal state to enter constraint.
| constraint | A constraint expression. |
| Extension tvm::arith::RewriteSimplifier::GetEnabledExtensions | ( | ) | const |
Return the currently enabled extensions.
| ObjectRef tvm::arith::RewriteSimplifier::GetStatsCounters | ( | ) | const |
Return the statistics counters.
analyze the expr
| expr | The expression of interest. |
| void tvm::arith::RewriteSimplifier::ResetStatsCounters | ( | ) |
Reset the statistics counters.
| void tvm::arith::RewriteSimplifier::SetEnabledExtensions | ( | Extension | flags | ) |
Enable an optional extension or extensions.
| flags | A bitwise OR of all optional extensions that should be enabled. |
| void tvm::arith::RewriteSimplifier::SetMaximumRewriteSteps | ( | int64_t | maximum | ) |
Set the maximum allowed number of rewrite steps.
By default, the simplifier may perform as many steps as are required. If a positive limit is set, then the simplifier will throw an exception when exceeding that number of rewrite steps. This allows tests to guard against performance regressions.
Note: To maintain accurate usage counters, Analyzer instances should be re-used wherever possible. For example, TIR transformations should declare a single Analyzer that is used throughout the pass, and utility functions should receive an Analyzer* from their calling scope.
| void tvm::arith::RewriteSimplifier::Update | ( | const Var & | var, |
| const PrimExpr & | new_expr, | ||
| bool | allow_override = false |
||
| ) |
Update binding of var to a new expression.
| var | The variable of interest. |
| new_expr | |
| allow_override | Whether we allow override of existing information. |
|
friend |
|
friend |
|
friend |