MCPcopy Create free account
hub / github.com/UbiquitousLearning/mllm / CpuPrefixCache

Method CpuPrefixCache

mllm/nn/lmcache/PrefixCache.cpp:56–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56CpuPrefixCache::CpuPrefixCache(const PrefixCacheOptions& options) : PrefixCache(options) {
57 if (options.hybrid_sliding_window_cache.value_or(false)) {
58 _initSlidingWindowAttention();
59 } else {
60 _initFullAttention();
61 }
62 prefix_cache::RadixTreeOptions radix_tree_options = {.enable_lru_eviction = false, // Not support yet
63 .eviction_threshold = 0.9f, // Not support yet
64 .enable_path_compression = false, // Not support yet
65 .min_compression_length = 2, // Not support yet
66 .transformer_blocks_num = options_.total_layers};
67 tree_ = std::make_shared<prefix_cache::RadixTree>(radix_tree_options);
68}
69
70prefix_cache::vp_addr_t CpuPrefixCache::allocKey(int layer_idx) { return caches_[layer_idx].first->alloc(); }
71

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected