tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Friends | List of all members
tvm::arith::RewriteSimplifier Class Reference

Rewrite-rule based simplifier. More...

#include <analyzer.h>

Collaboration diagram for tvm::arith::RewriteSimplifier:

Public Types

enum  Extension { kNone = 0, kTransitivelyProveInequalities = (1 << 0), kConvertBooleanToAndOfOrs = (1 << 1), kApplyConstraintsToBooleanBranches = (1 << 2) }
 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...
 

Friends

class Analyzer
 
class ConstraintContext
 
class CanonicalSimplifier
 

Detailed Description

Rewrite-rule based simplifier.

Member Enumeration Documentation

◆ Extension

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 

Member Function Documentation

◆ EnterConstraint()

std::function<void()> tvm::arith::RewriteSimplifier::EnterConstraint ( const PrimExpr constraint)

Update the internal state to enter constraint.

Parameters
constraintA constraint expression.
Returns
an exit function that must be called to cleanup the constraint can be nullptr.

◆ GetEnabledExtensions()

Extension tvm::arith::RewriteSimplifier::GetEnabledExtensions ( ) const

Return the currently enabled extensions.

◆ operator()()

PrimExpr tvm::arith::RewriteSimplifier::operator() ( const PrimExpr expr)

analyze the expr

Parameters
exprThe expression of interest.
Returns
the result of the analysis.

◆ SetEnabledExtensions()

void tvm::arith::RewriteSimplifier::SetEnabledExtensions ( Extension  flags)

Enable an optional extension or extensions.

Parameters
flagsA bitwise OR of all optional extensions that should be enabled.

◆ Update()

void tvm::arith::RewriteSimplifier::Update ( const Var var,
const PrimExpr new_expr,
bool  allow_override = false 
)

Update binding of var to a new expression.

Parameters
varThe variable of interest.
new_expr
allow_overrideWhether we allow override of existing information.

Friends And Related Function Documentation

◆ Analyzer

friend class Analyzer
friend

◆ CanonicalSimplifier

friend class CanonicalSimplifier
friend

◆ ConstraintContext

friend class ConstraintContext
friend

The documentation for this class was generated from the following file: