Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Halide::Runtime::Internal::HashMap Struct Reference

`#include <hashmap.h>`

Inheritance diagram for Halide::Runtime::Internal::HashMap:

## Public Member Functions
bool | init (void *user_context, copy_value_func copy_value, destroy_value_func destroy_value)
void | prune ()
void | set_size (int64_t size)
int | lookup (void *user_context, const uint8_t *cache_key, int32_t size, uint8_t *cache_value, size_t cache_value_size)
void | store (void *user_context, const uint8_t *cache_key, int32_t size, const uint8_t *cache_value, size_t cache_value_size)
void | release (void *user_context, void *host)
void | cleanup ()

## Public Attributes
halide_mutex | memoization_lock
CacheEntry * | cache_entries [kHashTableSize]
CacheEntry * | most_recently_used
CacheEntry * | least_recently_used
uint64_t | kDefaultCacheSize
int64_t | max_cache_size
int64_t | current_cache_size
copy_value_func | copy_value
destroy_value_func | destroy_value
void * | user_context
bool | inited

## Static Public Attributes
static const size_t | kHashTableSize = 256

## Detailed Description

Definition at line 120 of file hashmap.h.

## Member Function Documentation

## ◆ init()

bool Halide::Runtime::Internal::HashMap::init | ( | void * | user_context,
|  | copy_value_func | copy_value,
|  | destroy_value_func | destroy_value
| ) |  |
| inline

Definition at line 150 of file hashmap.h.

References cache_entries, copy_value, current_cache_size, destroy_value, halide_debug_assert, inited, kDefaultCacheSize, least_recently_used, max_cache_size, memoization_lock, memset(), most_recently_used, and user_context.

Referenced by Halide::Runtime::Internal::THashMap< KeyType, ValueType >::init().

## ◆ prune()

void Halide::Runtime::Internal::HashMap::prune | ( |  | ) |
| inline

Definition at line 170 of file hashmap.h.

References cache_entries, current_cache_size, Halide::Runtime::Internal::CacheEntry::destroy(), destroy_value, halide_debug_assert, Halide::Runtime::Internal::CacheEntry::hash, hashmap_free, Halide::Runtime::Internal::CacheEntry::in_use_count, kHashTableSize, least_recently_used, Halide::Runtime::Internal::CacheEntry::less_recent, max_cache_size, Halide::Runtime::Internal::CacheEntry::more_recent, most_recently_used, Halide::Runtime::Internal::CacheEntry::next, user_context, and Halide::Runtime::Internal::CacheEntry::value_size.

Referenced by set_size(), and store().

## ◆ set_size()

void Halide::Runtime::Internal::HashMap::set_size | ( | int64_t | size | ) |
| inline

Definition at line 226 of file hashmap.h.

References kDefaultCacheSize, max_cache_size, memoization_lock, and prune().

## ◆ lookup()

int Halide::Runtime::Internal::HashMap::lookup | ( | void * | user_context,
|  | const uint8_t * | cache_key,
|  | int32_t | size,
|  | uint8_t * | cache_value,
|  | size_t | cache_value_size
| ) |  |
| inline

Definition at line 237 of file hashmap.h.

References cache_entries, copy_value, Halide::Runtime::Internal::djb_hash(), halide_debug_assert, Halide::Runtime::Internal::CacheEntry::hash, Halide::Runtime::Internal::CacheEntry::in_use_count, Halide::Runtime::Internal::CacheEntry::key, Halide::Runtime::Internal::CacheEntry::key_size, Halide::Runtime::Internal::keys_equal(), kHashTableSize, least_recently_used, Halide::Runtime::Internal::CacheEntry::less_recent, memoization_lock, Halide::Runtime::Internal::CacheEntry::more_recent, most_recently_used, Halide::Runtime::Internal::CacheEntry::next, user_context, Halide::Runtime::Internal::CacheEntry::value, and Halide::Runtime::Internal::CacheEntry::value_size.

Referenced by Halide::Runtime::Internal::THashMap< KeyType, ValueType >::lookup().

## ◆ store()

void Halide::Runtime::Internal::HashMap::store | ( | void * | user_context,
|  | const uint8_t * | cache_key,
|  | int32_t | size,
|  | const uint8_t * | cache_value,
|  | size_t | cache_value_size
| ) |  |
| inline

Definition at line 299 of file hashmap.h.

References cache_entries, copy_value, current_cache_size, debug, destroy_value, Halide::Runtime::Internal::djb_hash(), halide_debug_assert, hashmap_malloc, Halide::Runtime::Internal::CacheEntry::in_use_count, Halide::Runtime::Internal::CacheEntry::init(), inited, Halide::Runtime::Internal::keys_equal(), kHashTableSize, least_recently_used, Halide::Runtime::Internal::CacheEntry::less_recent, memoization_lock, Halide::Runtime::Internal::CacheEntry::more_recent, most_recently_used, Halide::Runtime::Internal::CacheEntry::next, prune(), and user_context.

Referenced by Halide::Runtime::Internal::THashMap< KeyType, ValueType >::store().

## ◆ release()

void Halide::Runtime::Internal::HashMap::release | ( | void * | user_context,
|  | void * | host
| ) |  |
| inline

Definition at line 364 of file hashmap.h.

References debug, halide_debug_assert, and user_context.

## ◆ cleanup()

void Halide::Runtime::Internal::HashMap::cleanup | ( |  | ) |
| inline

Definition at line 371 of file hashmap.h.

References cache_entries, current_cache_size, debug, Halide::Runtime::Internal::CacheEntry::destroy(), destroy_value, hashmap_free, least_recently_used, most_recently_used, Halide::Runtime::Internal::CacheEntry::next, and user_context.

## Member Data Documentation

## ◆ memoization_lock

halide_mutex Halide::Runtime::Internal::HashMap::memoization_lock

Definition at line 121 of file hashmap.h.

Referenced by init(), lookup(), set_size(), and store().

## ◆ kHashTableSize

const size_t Halide::Runtime::Internal::HashMap::kHashTableSize = 256
| static

Definition at line 123 of file hashmap.h.

Referenced by lookup(), prune(), and store().

## ◆ cache_entries

CacheEntry* Halide::Runtime::Internal::HashMap::cache_entries[kHashTableSize]

Definition at line 125 of file hashmap.h.

Referenced by cleanup(), init(), lookup(), prune(), and store().

## ◆ most_recently_used

CacheEntry* Halide::Runtime::Internal::HashMap::most_recently_used

Definition at line 127 of file hashmap.h.

Referenced by cleanup(), init(), lookup(), prune(), and store().

## ◆ least_recently_used

CacheEntry* Halide::Runtime::Internal::HashMap::least_recently_used

Definition at line 128 of file hashmap.h.

Referenced by cleanup(), init(), lookup(), prune(), and store().

## ◆ kDefaultCacheSize

uint64_t Halide::Runtime::Internal::HashMap::kDefaultCacheSize

Definition at line 130 of file hashmap.h.

Referenced by init(), and set_size().

## ◆ max_cache_size

int64_t Halide::Runtime::Internal::HashMap::max_cache_size

Definition at line 131 of file hashmap.h.

Referenced by init(), prune(), and set_size().

## ◆ current_cache_size

int64_t Halide::Runtime::Internal::HashMap::current_cache_size

Definition at line 132 of file hashmap.h.

Referenced by cleanup(), init(), prune(), and store().

## ◆ copy_value

copy_value_func Halide::Runtime::Internal::HashMap::copy_value

Definition at line 134 of file hashmap.h.

Referenced by init(), lookup(), and store().

## ◆ destroy_value

destroy_value_func Halide::Runtime::Internal::HashMap::destroy_value

Definition at line 135 of file hashmap.h.

Referenced by cleanup(), init(), prune(), and store().

## ◆ user_context

void* Halide::Runtime::Internal::HashMap::user_context

Definition at line 137 of file hashmap.h.

Referenced by cleanup(), Halide::Runtime::Internal::THashMap< KeyType, ValueType >::init(), init(), Halide::Runtime::Internal::THashMap< KeyType, ValueType >::lookup(), lookup(), prune(), release(), Halide::Runtime::Internal::THashMap< KeyType, ValueType >::store(), and store().

## ◆ inited

bool Halide::Runtime::Internal::HashMap::inited

Definition at line 139 of file hashmap.h.

Referenced by init(), and store().

The documentation for this struct was generated from the following file:

- src/runtime/hashmap.h