1#ifndef FREE_TENSOR_HASH_H
2#define FREE_TENSOR_HASH_H
4#include <unordered_map>
5#include <unordered_set>
14 static constexpr size_t P = 2147483647;
15 static constexpr size_t K1 = 179424673, B1 = 275604541;
17 static constexpr size_t K2 = 373587883, B2 = 472882027;
21 static constexpr size_t K3 = 573259391, B3 = 674506081;
63 return op.
isValid() ? op->hash() : P;
78 bool compare(
const If &
lhs,
const If &
rhs)
const;
113template <
class K,
class V>
114using ASTHashMap = std::unordered_map<K, V, Hasher, HashComparator>;
117using ASTHashSet = std::unordered_set<K, Hasher, HashComparator>;
123template <
class K,
class V>
126 if (
lhs.size() !=
rhs.size()) {
129 for (
auto &&[k, v] :
lhs) {
130 if (!
rhs.count(k) ||
rhs.at(k) != v) {
139 if (
lhs.size() !=
rhs.size()) {
142 for (
auto &&k :
lhs) {
154template <
class T,
class U>
class hash<
std::pair<T, U>> {
164template <
class... Ts>
class hash<
std::tuple<Ts...>> {
166 template <
class T>
static size_t hashManyImpl(
const T &first) {
167 return std::hash<T>()(first);
170 template <
class T,
class... Args>
171 static size_t hashManyImpl(
const T &first,
const Args &...others) {
173 hashManyImpl(others...));
177 static size_t hashMany(
const Ts &...args) {
return hashManyImpl(args...); }
181 return std::apply(hashMany, t);
185template <
class T>
class hash<
std::vector<T>> {
192 size_t h = std::hash<size_t>()(vec.size());
194 for (
auto &&item : vec) {
bool operator()(const Ref< Tensor > &lhs, const Ref< Tensor > &rhs) const
Definition: hash.cc:575
size_t operator()(const Ref< ASTPart > &op) const
Definition: hash.h:62
static size_t compHash(const Tensor &t)
Definition: hash.cc:25
bool isValid() const
Definition: ref.h:89
size_t operator()(const std::pair< T, U > &pair) const
Definition: hash.h:159
size_t operator()(const std::tuple< Ts... > &t) const
Definition: hash.h:180
size_t operator()(const std::vector< T > &vec) const
Definition: hash.h:189
Definition: allocator.h:9
std::unordered_map< K, V, Hasher, HashComparator > ASTHashMap
Definition: hash.h:114
auto && lhs
Definition: const_fold.cc:70
bool operator==(const Allocator< T > &lhs, const Allocator< T > &rhs)
Definition: allocator.h:100
auto auto && rhs
Definition: const_fold.cc:70
size_t hashCombine(size_t seed, size_t other)
Definition: hash_combine.cc:5
std::unordered_set< K, Hasher, HashComparator > ASTHashSet
Definition: hash.h:117
Definition: cutlass_micro_kernel_property.h:9
Definition: for_property.h:38
Definition: for_property.h:11