#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "xnnpack.h"
#include "xnnpack/allocator.h"
#include "xnnpack/cache.h"
#include "xnnpack/common.h"
#include "xnnpack/log.h"
#include "xnnpack/math.h"
#include "xnnpack/memory.h"
#include "xnnpack/mutex.h"
#define XNN_CACHE_HASH_SEED …
#define XNN_CACHE_INITIAL_BUCKETS …
#define XNN_CACHE_MAX_LOAD …
#define XNN_CACHE_MAX_LOAD_ENTRIES_MULTIPLIER …
#define XNN_CACHE_MAX_LOAD_BUCKETS_MULTIPLIER …
#define XNN_CACHE_GROWTH_FACTOR …
static inline uint32_t fmix32(uint32_t h)
{ … }
uint32_t murmur_hash3(const void* key, size_t len, uint32_t seed)
{ … }
#ifndef NDEBUG
static inline size_t cache_size(struct xnn_cache* cache) { … }
#endif
static inline void* cache_start(struct xnn_cache* cache) { … }
enum xnn_status xnn_init_cache_with_size(struct xnn_cache* cache, size_t num_buckets, enum xnn_cache_type cache_type)
{ … }
enum xnn_status xnn_init_code_cache_with_size(struct xnn_code_cache* cache, size_t num_buckets)
{ … }
enum xnn_status xnn_init_code_cache(struct xnn_code_cache* cache)
{ … }
static bool cache_buckets_grow(struct xnn_cache* cache)
{ … }
static inline bool bytes_equal(struct xnn_cache* cache, void* ptr, size_t size, size_t offset)
{ … }
static bool lookup(struct xnn_cache* cache, void* ptr, size_t size, uint32_t hash, size_t* index)
{ … }
static bool insert(struct xnn_cache* cache, void* ptr, size_t size)
{ … }
static size_t lookup_cache(struct xnn_cache* cache, void* ptr, size_t size)
{ … }
size_t xnn_get_or_insert_cache(struct xnn_cache* cache, void* ptr, size_t size)
{ … }
size_t xnn_get_or_insert_code_cache(struct xnn_code_cache* cache, void* ptr, size_t size)
{ … }
enum xnn_status xnn_release_code_cache(struct xnn_code_cache* cache)
{ … }
enum xnn_status xnn_internal_init_weights_cache(
struct xnn_internal_weights_cache* cache,
size_t num_buckets,
size_t buffer_size)
{ … }
enum xnn_status xnn_internal_init_weights_cache_with_size(struct xnn_internal_weights_cache* cache, size_t size)
{ … }
enum xnn_status xnn_internal_finalize_weights_cache(
struct xnn_internal_weights_cache* cache, enum xnn_weights_cache_finalization_kind finalization_kind)
{ … }
enum xnn_status xnn_internal_release_weights_cache(struct xnn_internal_weights_cache* cache)
{ … }
static inline bool cache_has_space(
struct xnn_internal_weights_cache* cache, size_t n)
{ … }
void* xnn_internal_reserve_space_in_weights_cache(struct xnn_internal_weights_cache* cache, size_t n)
{ … }
size_t xnn_internal_get_or_insert_weights_cache(
struct xnn_internal_weights_cache* cache, const struct xnn_weights_cache_look_up_key* cache_key, void* ptr, size_t size)
{ … }
bool xnn_internal_weights_cache_is_finalized(struct xnn_internal_weights_cache* cache)
{ … }
size_t xnn_internal_weights_cache_look_up(
struct xnn_internal_weights_cache* cache, const struct xnn_weights_cache_look_up_key* cache_key)
{ … }
void* xnn_internal_weights_cache_offset_to_addr(struct xnn_internal_weights_cache* weights_cache, size_t offset)
{ … }
enum xnn_status xnn_internal_delete_weights_cache(struct xnn_internal_weights_cache* weights_cache)
{ … }
bool xnn_weights_cache_is_finalized(xnn_weights_cache_t cache)
{ … }
size_t xnn_look_up_or_insert_weights_cache(
xnn_weights_cache_t cache, const struct xnn_weights_cache_look_up_key* cache_key, void* ptr, size_t size)
{ … }
enum xnn_status xnn_finalize_weights_cache(
xnn_weights_cache_t weights_cache, enum xnn_weights_cache_finalization_kind finalization_kind)
{ … }
size_t xnn_weights_cache_look_up(
xnn_weights_cache_t cache, const struct xnn_weights_cache_look_up_key* cache_key)
{ … }