Skip to content

Commit a225e35

Browse files
committed
fix: Only call apply on child caches in the success state
There are conditions where the two child conditions can end up with different status values based on the logic in the init_update constructor for llama_kv_cache_unified_context which can conditionally set status to either LLAMA_MEMORY_STATUS_SUCCESS or LLAMA_MEMORY_STATUS_NO_UPDATE. See full discussion: #13550 (comment) Branch: HybridCacheApplyLogic Signed-off-by: Gabe Goodhart <[email protected]>
1 parent 4367806 commit a225e35

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/llama-memory-hybrid.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,12 @@ bool llama_memory_hybrid_context::apply() {
222222

223223
bool res = true;
224224

225-
res = res & ctx_attn->apply();
226-
res = res & ctx_recr->apply();
225+
if (ctx_attn->get_status() == LLAMA_MEMORY_STATUS_SUCCESS) {
226+
res = res & ctx_attn->apply();
227+
}
228+
if (ctx_recr->get_status() == LLAMA_MEMORY_STATUS_SUCCESS) {
229+
res = res & ctx_recr->apply();
230+
}
227231

228232
return res;
229233
}

0 commit comments

Comments
 (0)