|
KHkvHashTableInitCapacity = 1024 * 1024
KHkvHashTableMaxCapacity = 1024 * 1024
KHkvHashTableMaxHbmForValuesByBytes = 1024 * 1024 * 1024
__init__(
init_capacity=KHkvHashTableInitCapacity,
max_capacity=KHkvHashTableMaxCapacity,
max_hbm_for_values=KHkvHashTableMaxHbmForValuesByBytes,
evict_strategy=HkvEvictStrategy.LRU,
step_per_epoch=0,
gen_scores_fn=None,
reserved_key_start_bit=0,
):
HkvHashTableConfig contains three parameters to configure the HashTable, They all have default values.
init_capacity
: The initial capacity of the hash table.max_capacity
: The maximum capacity of the hash table.max_hbm_for_values
: The maximum HBM for values, in bytes.evict_strategy
: Select and set different evict strategies.step_per_epoch
: How many steps per epoch. This parameter must be set when you select EPOCHLRU or EPOCHLFU evict strategy.gen_scores_fn
: Custom method for generating scores. This must be set when you choose to use CUSTOMIZED evict strategy.reserved_key_start_bit
: The HKV Reserved Keys start bit, default is 0.
Pure HBM mode
: set the max_hbm_for_values >= sizeof(V) * dim * max_capacityHBM + HMEM mode
: set the max_hbm_for_values < sizeof(V) * dim * max_capacityPure HMEM mode
: set the max_hbm_for_values = 0- if max_capacity == init_capacity, the HBM + HMEM consumption = sizeof(V) * dim * max_capacity
reserved_key_start_bit
: If you don't use The keys of 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, and 0xFFFFFFFFFFFFFFFF as key, you don't need to change it.