tvm
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
tvm::sym::RewriteSimplifier Class Reference

Rewrite-rule based simplifier. More...

#include <analyzer.h>

Collaboration diagram for tvm::sym::RewriteSimplifier:

Public Member Functions

TVM_TIRX_DLL PrimExpr operator() (const PrimExpr &expr)
 Simplify an expression under the current premises.
 
TVM_TIRX_DLL CompareResult TryCompare (const PrimExpr &lhs, const PrimExpr &rhs)
 Compare signed integer expressions using active premises and constant offsets.
 
TVM_TIRX_DLL ffi::ObjectRef GetStatsCounters () const
 Read cumulative rewrite statistics.
 
TVM_TIRX_DLL void ResetStatsCounters ()
 Clear cumulative rewrite counters without changing facts or the rewrite limit.
 
TVM_TIRX_DLL void SetMaximumRewriteSteps (int64_t maximum)
 Set the maximum allowed cumulative number of successful rewrites.
 

Friends

class AnalyzerObj
 
class CanonicalSimplifier
 

Detailed Description

Rewrite-rule based simplifier.

Member Function Documentation

◆ GetStatsCounters()

TVM_TIRX_DLL ffi::ObjectRef tvm::sym::RewriteSimplifier::GetStatsCounters ( ) const

Read cumulative rewrite statistics.

Returns
A snapshot of the current counters.

◆ operator()()

TVM_TIRX_DLL PrimExpr tvm::sym::RewriteSimplifier::operator() ( const PrimExpr &  expr)

Simplify an expression under the current premises.

Parameters
exprThe expression to simplify.
Returns
An equivalent expression under those premises.

◆ ResetStatsCounters()

TVM_TIRX_DLL void tvm::sym::RewriteSimplifier::ResetStatsCounters ( )

Clear cumulative rewrite counters without changing facts or the rewrite limit.

◆ SetMaximumRewriteSteps()

TVM_TIRX_DLL void tvm::sym::RewriteSimplifier::SetMaximumRewriteSteps ( int64_t  maximum)

Set the maximum allowed cumulative number of successful rewrites.

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. Internal helpers may borrow its AnalyzerObj*.

The limit applies to the cumulative counter, not separately to each query. ResetStatsCounters starts a new accounting interval.

Parameters
maximumPositive rewrite limit, or a nonpositive value for no limit.

◆ TryCompare()

TVM_TIRX_DLL CompareResult tvm::sym::RewriteSimplifier::TryCompare ( const PrimExpr &  lhs,
const PrimExpr &  rhs 
)

Compare signed integer expressions using active premises and constant offsets.

Parameters
lhsThe left-hand side of the comparison.
rhsThe right-hand side of the comparison.
Returns
The directly known ordering, or kUnknown when it cannot be established.

Friends And Related Symbol Documentation

◆ AnalyzerObj

friend class AnalyzerObj
friend

◆ CanonicalSimplifier

friend class CanonicalSimplifier
friend

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