model: mistral le chonk (#31376)
* llama: extend DSA and sdpark to new model * fix ci
This commit is contained in:
1 parent
0ac1a7fd35
commit
78feec062d
23 files changed
+1290
-35
No files matched your search
+14
-4
@@ -3429,13 +3429,20 @@ ggml_tensor * llm_graph_context::build_attn(
|
||||
// by doing so, the number of splits in the graph is reduced
|
||||
// expand k later to enable rope fusion which directly writes into k-v cache
|
||||
ggml_build_forward_expand(gf, q_cur);
|
||||
ggml_build_forward_expand(gf, v_cur);
|
||||
ggml_build_forward_expand(gf, k_cur);
|
||||
|
||||
if (v_cur) {
|
||||
ggml_build_forward_expand(gf, v_cur);
|
||||
}
|
||||
|
||||
if (k_cur) {
|
||||
ggml_build_forward_expand(gf, k_cur);
|
||||
}
|
||||
|
||||
const auto * mctx_cur = inp->mctx->get_mla();
|
||||
|
||||
// store to KV cache
|
||||
{
|
||||
// note: k_cur is null for layers that reuse the KV cache of another layer
|
||||
if (k_cur) {
|
||||
const auto & k_idxs = inp->get_k_idxs_mla();
|
||||
|
||||
ggml_build_forward_expand(gf, mctx_cur->cpy_k(ctx0, k_cur, k_idxs, il));
|
||||
@@ -3481,7 +3488,10 @@ ggml_tensor * llm_graph_context::build_attn(
|
||||
|
||||
ggml_tensor * q = q_cur;
|
||||
ggml_tensor * k = mctx_cur->get_k(ctx0, il);
|
||||
ggml_tensor * v = ggml_view_4d(ctx0, k, v_cur->ne[0], k->ne[1], k->ne[2], k->ne[3], k->nb[1], k->nb[2], k->nb[3], 0);
|
||||
|
||||
// MLA: V is a view of the first n_embd_v elements of K
|
||||
const int64_t n_embd_v = v_cur ? v_cur->ne[0] : v_mla->ne[0];
|
||||
ggml_tensor * v = ggml_view_4d(ctx0, k, n_embd_v, k->ne[1], k->ne[2], k->ne[3], k->nb[1], k->nb[2], k->nb[3], 0);
|
||||
|
||||
ggml_tensor * cur = build_attn_mha(q, k, v, kq_b, kq_mask_top_k, sinks, v_mla, top_k->ne[0], kq_scale, il);
|
||||
cb(cur, "kqv_out", il);
|
||||
|
||||
Reference in new issue
Block a user