memory: refuse rollbacks past the snapshots of the last ubatch (#31368)
* memory: refuse rollbacks past the snapshots of the last ubatch The recurrent memory and the DSV4 cache accepted any rollback up to n_rs_seq, whether or not the last ubatch wrote that snapshot. Each now records the deepest rollback its last ubatch guarantees and seq_rm refuses anything past it: - recurrent: n - 1 for a ubatch of n <= n_rs_seq + 1 tokens, 0 for a longer one, which only guarantees the final state - DSV4: min(n, n_rs_seq), the snapshots are rebuilt from the state before the ubatch The dead rollback block of the rollback test becomes the assertion it asked for, and rollback_bound checks the exact bound of each memory after ubatches of 1, 2, n_rs_seq + 1 and n_rs_seq + 2 tokens. * tests: address review from ggerganov Detect architectures with llama_arch_from_string in comp_padding and arch_reserves_single_seq, as in rollback_bound.
This commit is contained in:
1 parent
e0f142d5dd
commit
ab3768cdc2
7 files changed
+128
-33
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "test-log.h"
|
||||
|
||||
#include "../../src/llama-ext.h" // llama_memory_get_buffers
|
||||
#include "../../src/llama-ext.h" // llama_memory_get_buffers, llama_arch_from_string
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@@ -368,10 +368,11 @@ llama_sampler_ptr make_dist_sampler(uint32_t seed) {
|
||||
}
|
||||
|
||||
bool arch_reserves_single_seq(const llama_model * model) {
|
||||
char arch_str[64] = {};
|
||||
llama_model_meta_val_str(model, "general.architecture", arch_str, sizeof(arch_str));
|
||||
char arch_name[64] = {};
|
||||
llama_model_meta_val_str(model, "general.architecture", arch_name, sizeof(arch_name));
|
||||
const llm_arch arch = llama_arch_from_string(arch_name);
|
||||
|
||||
return strcmp(arch_str, "kimi-linear") == 0 || strcmp(arch_str, "minimax-01") == 0;
|
||||
return arch == LLM_ARCH_KIMI_LINEAR || arch == LLM_ARCH_MINIMAX_01;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user