tvm
Classes | Namespaces | Macros | Functions
map.h File Reference

Runtime Map container types. More...

#include <algorithm>
#include <unordered_map>
#include <utility>
#include "./base.h"
#include "./optional.h"
Include dependency graph for map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tvm::runtime::MapNode
 Shared content of all specializations of hash map. More...
 
class  tvm::runtime::MapNode::iterator
 
class  tvm::runtime::SmallMapNode
 A specialization of small-sized hash map. More...
 
class  tvm::runtime::DenseMapNode
 A specialization of hash map that implements the idea of array-based hash map. Another reference implementation can be found [1]. More...
 
class  tvm::runtime::Map< K, V, typename, typename >
 Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places. More...
 
class  tvm::runtime::Map< K, V, typename, typename >::iterator
 Iterator of the hash map. More...
 

Namespaces

 tvm
 runtime implementation for LibTorch/TorchScript.
 
 tvm::runtime
 

Macros

#define USE_FALLBACK_STL_MAP   0
 
#define TVM_MAP_FAIL_IF_CHANGED()
 
#define TVM_DISPATCH_MAP(base, var, body)
 
#define TVM_DISPATCH_MAP_CONST(base, var, body)
 

Functions

template<>
ObjectPtr< ArrayNode > tvm::runtime::make_object ()
 
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
Map< K, V > tvm::runtime::Merge (Map< K, V > lhs, const Map< K, V > &rhs)
 Merge two Maps. More...
 

Detailed Description

Runtime Map container types.

Macro Definition Documentation

◆ TVM_DISPATCH_MAP

#define TVM_DISPATCH_MAP (   base,
  var,
  body 
)
Value:
{ \
using TSmall = SmallMapNode*; \
using TDense = DenseMapNode*; \
uint64_t slots = base->slots_; \
if (slots <= SmallMapNode::kMaxSize) { \
TSmall var = static_cast<TSmall>(base); \
body; \
} else { \
TDense var = static_cast<TDense>(base); \
body; \
} \
}
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.

◆ TVM_DISPATCH_MAP_CONST

#define TVM_DISPATCH_MAP_CONST (   base,
  var,
  body 
)
Value:
{ \
using TSmall = const SmallMapNode*; \
using TDense = const DenseMapNode*; \
uint64_t slots = base->slots_; \
if (slots <= SmallMapNode::kMaxSize) { \
TSmall var = static_cast<TSmall>(base); \
body; \
} else { \
TDense var = static_cast<TDense>(base); \
body; \
} \
}

◆ TVM_MAP_FAIL_IF_CHANGED

#define TVM_MAP_FAIL_IF_CHANGED ( )

◆ USE_FALLBACK_STL_MAP

#define USE_FALLBACK_STL_MAP   0