Skip to content

Commit 5c2552b

Browse files
authored
Fix #2093 (#2095)
1 parent da41565 commit 5c2552b

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/graphs/build_deepseek2.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,6 @@ static inline int dsa_n_top_k(const llama_context & lctx) {
331331
static inline bool dsa_should_use(const llama_context & lctx) {
332332
return lctx.cparams.mtp_op_type == MTP_OP_NONE && lctx.cparams.dsa && lctx.model.arch == LLM_ARCH_GLM_DSA && !lctx.kv_self.kr_l.empty();
333333
}
334-
static inline bool dsa_should_use(const llama_context & lctx, int il) {
335-
return dsa_should_use(lctx) && lctx.model.layers[il].indexer_attn_q_b && lctx.kv_self.kr_l.size() > (size_t) il && lctx.kv_self.kr_l[il];
336-
}
337334
static inline bool dsa_can_use_fast_path(const llama_context & lctx, int n_tokens, int n_kv) {
338335
auto n_top_k = dsa_n_top_k(lctx);
339336
if (n_tokens == 1 && n_top_k < n_kv && n_top_k%256 == 0 && lctx.cparams.flash_attn && (lctx.cparams.mla_attn == 1 || lctx.cparams.mla_attn == 3)) {
@@ -754,7 +751,7 @@ ggml_tensor * llm_build_context::build_deepseek2_layer_attention(
754751
ggml_tensor * sparse_mask = KQ_mask;
755752
ggml_tensor * sparse_mask_fa = KQ_mask;
756753

757-
bool use_dsa = dsa_should_use(lctx, il);
754+
bool use_dsa = dsa_should_use(lctx);
758755
bool dsa_fast_path = use_dsa && dsa_can_use_fast_path(lctx, n_tokens, n_kv);
759756

760757
// self_attention

0 commit comments

Comments
 (0)