Skip to content

Commit 8a5c041

Browse files
ikawrakowIwan Kawrakow
andauthored
Fix DeepSeek q8_0 cache (#391)
Co-authored-by: Iwan Kawrakow <[email protected]>
1 parent 090eae4 commit 8a5c041

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ggml/src/iqk/iqk_flash_attn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extern "C" IQK_API bool iqk_flash_attn_noalibi(int type_q, int type_mask, float
8181

8282
int int_type_k = int_type_k_in;
8383
auto work_buffer = work_buffer_in;
84-
if (neq1 >= 8 || rk2 >= 8) {
84+
if (neq1 >= 8 || (rk2 >= 8 && nek2 > 1)) {
8585
uint64_t row_size = 0;
8686
work_buffer = iqk_repack_k(int_type_k, Dk, nek1, nek2, nek3, stride_k, nbk2, nbk3, k, work_buffer_in, ith, nth, int_type_k, row_size);
8787
if (int_type_k != int_type_k_in) {

ggml/src/iqk/iqk_mul_mat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18033,7 +18033,7 @@ bool iqk_flash_attn_impl(int int_type_k, // type of k
1803318033
auto type_v = ggml_type(int_type_v);
1803418034

1803518035
if (Dk == 576 && Dv == 512) {
18036-
GGML_ASSERT(type_k == type_v);
18036+
GGML_ASSERT(type_k == type_v || (type_k == GGML_TYPE_Q8_0_R8 && type_v == GGML_TYPE_Q8_0));
1803718037
stride_q /= sizeof(float); // q stride as float
1803818038
return iqk_deepseek_helper<32>(type_k, nq1, nk1, stride_q, stride_k, stride_v, stride_m, stride_qkv,
1803918039
q, (const char *)k, (const char *)v, (const char *)mask, scale, softcap, qkv, M, S);

0 commit comments

Comments
 (0)