Skip to content

Commit 8d61607

Browse files
committed
ggml ; remove unused ggml_mul special case
It would otherwise conflict with the more general optimization coming with Mamba-2. * ggml : handle TQ1_0 and TQ2_0 in dequantization-based operators
1 parent 7f3a619 commit 8d61607

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Diff for: ggml/src/ggml.c

+11-10
Original file line numberDiff line numberDiff line change
@@ -9921,6 +9921,8 @@ static void ggml_compute_forward_add(
99219921
case GGML_TYPE_Q4_K:
99229922
case GGML_TYPE_Q5_K:
99239923
case GGML_TYPE_Q6_K:
9924+
case GGML_TYPE_TQ1_0:
9925+
case GGML_TYPE_TQ2_0:
99249926
case GGML_TYPE_IQ2_XXS:
99259927
case GGML_TYPE_IQ2_XS:
99269928
case GGML_TYPE_IQ3_XXS:
@@ -10299,6 +10301,8 @@ static void ggml_compute_forward_add1(
1029910301
case GGML_TYPE_Q4_K:
1030010302
case GGML_TYPE_Q5_K:
1030110303
case GGML_TYPE_Q6_K:
10304+
case GGML_TYPE_TQ1_0:
10305+
case GGML_TYPE_TQ2_0:
1030210306
case GGML_TYPE_IQ2_XXS:
1030310307
case GGML_TYPE_IQ2_XS:
1030410308
case GGML_TYPE_IQ3_XXS:
@@ -10427,6 +10431,8 @@ static void ggml_compute_forward_acc(
1042710431
case GGML_TYPE_Q4_K:
1042810432
case GGML_TYPE_Q5_K:
1042910433
case GGML_TYPE_Q6_K:
10434+
case GGML_TYPE_TQ1_0:
10435+
case GGML_TYPE_TQ2_0:
1043010436
case GGML_TYPE_IQ2_XXS:
1043110437
case GGML_TYPE_IQ2_XS:
1043210438
case GGML_TYPE_IQ3_XXS:
@@ -10562,16 +10568,7 @@ static void ggml_compute_forward_mul_f32(
1056210568
GGML_ASSERT( nb0 == sizeof(float));
1056310569
GGML_ASSERT(nb00 == sizeof(float));
1056410570

10565-
if (ggml_nelements(src1) == 1) {
10566-
float scale = ((float *) src1->data)[0];
10567-
for (int64_t ir = ith; ir < nr; ir += nth) {
10568-
if (dst->data != src0->data) {
10569-
// src0 is same shape as dst => same indices
10570-
memcpy((char *)dst->data + ir*nb1, (char *)src0->data + ir*nb01, ne0 * sizeof(float));
10571-
}
10572-
ggml_vec_scale_f32(ne0, (float *) ((char *) dst->data + ir*nb1), scale);
10573-
}
10574-
} else if (nb10 == sizeof(float)) {
10571+
if (nb10 == sizeof(float)) {
1057510572
for (int64_t ir = ith; ir < nr; ir += nth) {
1057610573
// src0 and dst are same shape => same indices
1057710574
const int64_t i03 = ir/(ne02*ne01);
@@ -13419,6 +13416,8 @@ static void ggml_compute_forward_out_prod(
1341913416
case GGML_TYPE_Q4_K:
1342013417
case GGML_TYPE_Q5_K:
1342113418
case GGML_TYPE_Q6_K:
13419+
case GGML_TYPE_TQ1_0:
13420+
case GGML_TYPE_TQ2_0:
1342213421
case GGML_TYPE_IQ2_XXS:
1342313422
case GGML_TYPE_IQ2_XS:
1342413423
case GGML_TYPE_IQ3_XXS:
@@ -13607,6 +13606,8 @@ static void ggml_compute_forward_set(
1360713606
case GGML_TYPE_Q4_K:
1360813607
case GGML_TYPE_Q5_K:
1360913608
case GGML_TYPE_Q6_K:
13609+
case GGML_TYPE_TQ1_0:
13610+
case GGML_TYPE_TQ2_0:
1361013611
case GGML_TYPE_IQ2_XXS:
1361113612
case GGML_TYPE_IQ2_XS:
1361213613
case GGML_TYPE_IQ3_XXS:

0 commit comments

Comments
 (0)