Skip to content

Commit ec22867

Browse files
committed
feat: Move layer_filter_cb up to llama_kv_cache
This will be needed by other cache types as well, so centralizing the definition will make it more reusable. Branch: HybridCache Signed-off-by: Gabe Goodhart <[email protected]>
1 parent 1c25994 commit ec22867

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/llama-kv-cache.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ struct llama_model;
1919
struct llama_context;
2020

2121
struct llama_kv_cache : public llama_memory_i {
22+
23+
// some child types need to perform different caching for each layer, so
24+
// this callback can be used to determine which layers a given cache should
25+
// be used for
26+
using layer_filter_cb = std::function<bool(int32_t il)>;
27+
2228
virtual ~llama_kv_cache() = default;
2329

2430
// call if batch processing fails - restores the cache state
@@ -99,9 +105,6 @@ class llama_kv_cache_unified : public llama_kv_cache {
99105
public:
100106
static uint32_t get_padding(const llama_cparams & cparams);
101107

102-
// this callback is used to filter out layers that should not be included in the cache
103-
using layer_filter_cb = std::function<bool(int32_t il)>;
104-
105108
llama_kv_cache_unified(
106109
const llama_model & model,
107110
layer_filter_cb && filter,

0 commit comments

Comments
 (0)