TVM  0.9.4
probe.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <functional>
6 #include <typeindex>
7 #include <utility>
8 
10 {
15 template<typename T>
16 inline void hash_combine(std::size_t & seed, const T & v) noexcept
17 {
18  std::hash<T> hasher;
19  seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
20 }
21 
26 struct PairHasher
27 {
28  template<typename T, typename U>
29  std::size_t operator()(const std::pair<T, U> & p) const noexcept
30  {
31  std::size_t hash = 0;
32  hash_combine(hash, p.first);
33  hash_combine(hash, p.second);
34  return hash;
35  }
36 };
37 
38 } // namespace tvm::diagnostic::internal
39 
40 // Specialization
41 #include <tvm/graph/internal/Log.h>
42 
43 namespace std
44 {
45 #ifdef _MSC_VER
47 template<>
48 struct hash<std::size_t>
49 {
50  // identity function for this type
51  std::size_t operator()(const std::size_t & i) const noexcept { return i; }
52 };
53 #endif
54 
56 template<>
57 struct hash<tvm::graph::internal::Log::EnumValue>
58 {
59  std::size_t operator()(const tvm::graph::internal::Log::EnumValue & e) const noexcept
60  {
61  std::size_t hash = 0;
64  return hash;
65  }
66 };
67 } // namespace std
Definition: probe.h:44
Definition: details.h:8
void hash_combine(std::size_t &seed, const T &v) noexcept
Definition: probe.h:16
Definition: Clock.h:12
std::size_t operator()(const tvm::graph::internal::Log::EnumValue &e) const noexcept
Definition: probe.h:59
std::size_t operator()(const std::pair< T, U > &p) const noexcept
Definition: probe.h:29