This commit is contained in:
Ivan Chikish 2026-03-15 23:55:07 +02:00 committed by GitHub
commit 1f7ff32f94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 6 deletions

View File

@ -130,12 +130,14 @@ void llama_memory_hybrid::clear(bool data) {
}
bool llama_memory_hybrid::seq_rm(llama_seq_id seq_id, llama_pos p0, llama_pos p1) {
// Try removing from the recurrent cache first since it may fail. If it does
// fail, the cache will not have been mutated.
if (!mem_recr->seq_rm(seq_id, p0, p1)) {
return false;
}
return mem_attn->seq_rm(seq_id, p0, p1);
bool res = true;
// Allow partial success when only mem_attn is modified
// This permits making cheap checkpoints if only mem_recr is saved and restored
// In that case it would require mem_attn to be manually trimmed
res &= mem_recr->seq_rm(seq_id, p0, p1);
res &= mem_attn->seq_rm(seq_id, p0, p1);
return res;
}
void llama_memory_hybrid::seq_cp(llama_seq_id seq_id_src, llama_seq_id seq_id_dst, llama_pos p0, llama_pos p1) {