MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_hash_find

Function ggml_hash_find

ggml.c:15175–15188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15173}
15174
15175size_t ggml_hash_find(const struct ggml_hash_set hash_set, struct ggml_tensor * key) {
15176 size_t h = ggml_hash(key) % hash_set.size;
15177
15178 // linear probing
15179 size_t i = h;
15180 while (hash_set.keys[i] != NULL && hash_set.keys[i] != key) {
15181 i = (i + 1) % hash_set.size;
15182 if (i == h) {
15183 // visited all hash table entries -> not found
15184 return GGML_HASHTABLE_FULL;
15185 }
15186 }
15187 return i;
15188}
15189
15190bool ggml_hash_contains(struct ggml_hash_set hash_set, struct ggml_tensor * key) {
15191 size_t i = ggml_hash_find(hash_set, key);

Callers 5

ggml_hash_containsFunction · 0.70
ggml_hash_insertFunction · 0.70
ggml_hash_find_or_insertFunction · 0.70

Calls 1

ggml_hashFunction · 0.70

Tested by

no test coverage detected