tvm
Public Member Functions | Protected Types | List of all members
tvm::SEqualReducer::Handler Class Referenceabstract

Internal handler that defines custom behaviors.. More...

#include <structural_equal.h>

Collaboration diagram for tvm::SEqualReducer::Handler:

Public Member Functions

virtual bool SEqualReduce (const ObjectRef &lhs, const ObjectRef &rhs, bool map_free_vars, const Optional< ObjectPathPair > &current_paths)=0
 Reduce condition to equality of lhs and rhs. More...
 
virtual void DeferFail (const ObjectPathPair &mismatch_paths)=0
 Mark the comparison as failed, but don't fail immediately. More...
 
virtual ObjectRef MapLhsToRhs (const ObjectRef &lhs)=0
 Lookup the graph node equal map for vars that are already mapped. More...
 
virtual void MarkGraphNode ()=0
 Mark current comparison as graph node equal comparison. More...
 

Protected Types

using PathTracingData = SEqualReducer::PathTracingData
 

Detailed Description

Internal handler that defines custom behaviors..

Member Typedef Documentation

◆ PathTracingData

using tvm::SEqualReducer::Handler::PathTracingData = SEqualReducer::PathTracingData
protected

Member Function Documentation

◆ DeferFail()

virtual void tvm::SEqualReducer::Handler::DeferFail ( const ObjectPathPair mismatch_paths)
pure virtual

Mark the comparison as failed, but don't fail immediately.

This is useful for producing better error messages when comparing containers. For example, if two array sizes mismatch, it's better to mark the comparison as failed but compare array elements anyway, so that we could find the true first mismatch.

◆ MapLhsToRhs()

virtual ObjectRef tvm::SEqualReducer::Handler::MapLhsToRhs ( const ObjectRef lhs)
pure virtual

Lookup the graph node equal map for vars that are already mapped.

This is an auxiliary method to check the Map<Var, Value> equality.

Parameters
lhsan lhs value.
Returns
The corresponding rhs value if any, nullptr if not available.

◆ MarkGraphNode()

virtual void tvm::SEqualReducer::Handler::MarkGraphNode ( )
pure virtual

Mark current comparison as graph node equal comparison.

◆ SEqualReduce()

virtual bool tvm::SEqualReducer::Handler::SEqualReduce ( const ObjectRef lhs,
const ObjectRef rhs,
bool  map_free_vars,
const Optional< ObjectPathPair > &  current_paths 
)
pure virtual

Reduce condition to equality of lhs and rhs.

Parameters
lhsThe left operand.
rhsThe right operand.
map_free_varsWhether do we allow remap variables if possible.
current_pathsOptional paths to lhs and rhs objects, for error traceability.
Returns
false if there is an immediate failure, true otherwise.
Note
This function may save the equality condition of (lhs == rhs) in an internal stack and try to resolve later.

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