llama : fix K/V and recurrent state cleanup after failed restores (#27530)
* llama : add discard for deferred state writes * llama : add tensor zeroing helper for backends without tensor memset * llama : clear K/V data after failed sequence restore * llama : clear recurrent state data after failed sequence restore * llama : simplify discard and restore cleanup * llama : report error when abnormal cell count is found in state_read_meta * llama : clear attention state on hybrid restore failure * tests : cover failed state restore cleanup * llama : clear MLA state on dsa restore failure * tests : update test for rebased test suite * llama : clarify comment in llama_memory_recurrent::state_read
This commit is contained in:
1 parent
a1de614ba3
commit
08618ff8e7
11 files changed
+383
-17
No files matched your search
@@ -168,7 +168,15 @@ void llama_kv_cache_dsa::state_write(llama_io_write_i & io, llama_seq_id seq_id,
|
||||
|
||||
void llama_kv_cache_dsa::state_read(llama_io_read_i & io, llama_seq_id seq_id, llama_state_seq_flags flags) {
|
||||
kv_mla->state_read(io, seq_id, flags);
|
||||
kv_lid->state_read(io, seq_id, flags);
|
||||
|
||||
try {
|
||||
kv_lid->state_read(io, seq_id, flags);
|
||||
} catch (...) {
|
||||
// the MLA part is already restored - undo it, so that a failed restore leaves nothing behind
|
||||
kv_mla->state_clear(seq_id);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
llama_kv_cache * llama_kv_cache_dsa::get_mla() const {
|
||||
|
||||
Reference in new issue
Block a user