tvm
Public Member Functions | Protected Member Functions | List of all members
tvm::SHashHandlerDefault Class Reference

The default handler for hash key computation. More...

#include <structural_hash.h>

Inheritance diagram for tvm::SHashHandlerDefault:
Collaboration diagram for tvm::SHashHandlerDefault:

Public Member Functions

 SHashHandlerDefault ()
 
virtual ~SHashHandlerDefault ()
 
void SHashReduceHashedValue (uint64_t hashed_value) override
 Append hashed_value to the current sequence of hashes. More...
 
void SHashReduce (const ObjectRef &key, bool map_free_vars) override
 Append hash value of key to the current sequence of hashes. More...
 
void SHashReduceFreeVar (const runtime::Object *var, bool map_free_vars) override
 Append a hash value of free variable to the current sequence of hashes. More...
 
bool LookupHashedValue (const ObjectRef &key, uint64_t *hashed_value) override
 Lookup a hash value for key. More...
 
void MarkGraphNode () override
 Mark current comparison as graph node in hashing. Graph node hash will depends on the graph structure. More...
 
virtual uint64_t Hash (const ObjectRef &object, bool map_free_vars)
 The entry point for hashing. More...
 

Protected Member Functions

virtual void DispatchSHash (const ObjectRef &object, bool map_free_vars)
 The dispatcher for hashing of intermediate objects. More...
 

Detailed Description

The default handler for hash key computation.

Users can derive from this class and override the DispatchSHash method, to customize hashing.

Constructor & Destructor Documentation

◆ SHashHandlerDefault()

tvm::SHashHandlerDefault::SHashHandlerDefault ( )

◆ ~SHashHandlerDefault()

virtual tvm::SHashHandlerDefault::~SHashHandlerDefault ( )
virtual

Member Function Documentation

◆ DispatchSHash()

virtual void tvm::SHashHandlerDefault::DispatchSHash ( const ObjectRef object,
bool  map_free_vars 
)
protectedvirtual

The dispatcher for hashing of intermediate objects.

Parameters
objectAn intermediate object to be hashed.
map_free_varsWhether or not to remap variables if possible.

◆ Hash()

virtual uint64_t tvm::SHashHandlerDefault::Hash ( const ObjectRef object,
bool  map_free_vars 
)
virtual

The entry point for hashing.

Parameters
objectThe object to be hashed.
map_free_varsWhether or not to remap variables if possible.
Returns
The hash result.

◆ LookupHashedValue()

bool tvm::SHashHandlerDefault::LookupHashedValue ( const ObjectRef key,
uint64_t *  hashed_value 
)
overridevirtual

Lookup a hash value for key.

Parameters
keyThe hash key.
hashed_valuethe result hash value
Returns
Whether there is already a pre-computed hash value.

Implements tvm::SHashReducer::Handler.

◆ MarkGraphNode()

void tvm::SHashHandlerDefault::MarkGraphNode ( )
overridevirtual

Mark current comparison as graph node in hashing. Graph node hash will depends on the graph structure.

Implements tvm::SHashReducer::Handler.

◆ SHashReduce()

void tvm::SHashHandlerDefault::SHashReduce ( const ObjectRef key,
bool  map_free_vars 
)
overridevirtual

Append hash value of key to the current sequence of hashes.

Parameters
keyThe object to compute hash from.
map_free_varsWhether to map free variables by their occurrence number.

Implements tvm::SHashReducer::Handler.

◆ SHashReduceFreeVar()

void tvm::SHashHandlerDefault::SHashReduceFreeVar ( const runtime::Object var,
bool  map_free_vars 
)
overridevirtual

Append a hash value of free variable to the current sequence of hashes.

Parameters
varThe var of interest.
map_free_varsWhether to map free variables by their occurrence number.
Note
If map_free_vars is set to be true, internally the handler can maintain a counter to encode free variables by their order of occurrence. This helps to resolve variable mapping of function parameters and let binding variables.

If map_free_vars is set to be false, the address of the variable will be used.

Implements tvm::SHashReducer::Handler.

◆ SHashReduceHashedValue()

void tvm::SHashHandlerDefault::SHashReduceHashedValue ( uint64_t  hashed_value)
overridevirtual

Append hashed_value to the current sequence of hashes.

Parameters
hashed_valueThe hashed value

Implements tvm::SHashReducer::Handler.


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