llama: add opt-in SM75 recurrent state replay

This commit is contained in:
xrip committed 2026-09-21 20:56:53 +03:00
1 parent 5fe543b020
commit 3a90a98e7a
13 files changed
+440 -12

No files matched your search

+7
View File
@@ -340,6 +340,9 @@ void llm_graph_input_rs::set_input(const llama_ubatch * ubatch) {
// assuming copy destinations ALWAYS happen ONLY on the cells between head and head+n
for (uint32_t i = 0; i < n_rs; ++i) {
data[i] = mctx->s_copy(i);
if (txn_copy) {
((int32_t *) txn_copy->data)[i] = data[i] % mctx->get_size();
}
}
}
}
@@ -3589,6 +3592,10 @@ static std::unique_ptr<llm_graph_input_rs> build_rs_inp_impl(
inp->s_copy = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_rs);
ggml_set_input(inp->s_copy);
ggml_set_name(inp->s_copy, "rs_s_copy");
if (mctx_cur->txn_enabled()) {
inp->txn_copy = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_rs);
ggml_set_input(inp->txn_copy);
}
inp->s_copy_main = ggml_view_1d(ctx0, inp->s_copy, n_seqs, 0);
inp->s_copy_extra = ggml_view_1d(ctx0, inp->s_copy, n_rs - n_seqs, n_seqs * inp->s_copy->nb[0]);