Skip to content

Commit 60aab95

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 29be51d commit 60aab95

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
@@ -20,6 +20,12 @@ struct llama_model;
2020
struct llama_context;
2121

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

2531
// call if batch processing fails - restores the cache state
@@ -101,9 +107,6 @@ class llama_kv_cache_unified : public llama_kv_cache {
101107
public:
102108
static uint32_t get_padding(const llama_cparams & cparams);
103109

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

0 commit comments

Comments
 (0)