Skip to content

Commit 939ad2d

Browse files
authored
Fix undefined variables in debug build, remove unused variables (#531)
1 parent 8c2ec5e commit 939ad2d

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

ggml.c

+19-28
Original file line numberDiff line numberDiff line change
@@ -1698,8 +1698,6 @@ inline static void ggml_vec_dot_q4_0(const int n, float * restrict s, const void
16981698
// Horizontal sum of all lanes of the accumulator
16991699
sumf = _mm512_reduce_add_ps( acc0 ) + _mm512_reduce_add_ps( acc1 );
17001700
#elif defined(__AVX2__)
1701-
const size_t countBlocks = nb;
1702-
17031701
// Initialize accumulator with zeros
17041702
__m256 acc = _mm256_setzero_ps();
17051703

@@ -5806,23 +5804,28 @@ static void ggml_compute_forward_mul_mat_f32(
58065804
const int ne02 = src0->ne[2];
58075805
const int ne03 = src0->ne[3];
58085806

5807+
#if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_OPENBLAS)
58095808
const int ne10 = src1->ne[0];
5809+
#endif
58105810
const int ne11 = src1->ne[1];
5811-
//const int ne12 = src1->ne[2];
5812-
//const int ne13 = src1->ne[3];
5811+
#ifndef NDEBUG
5812+
const int ne12 = src1->ne[2];
5813+
const int ne13 = src1->ne[3];
58135814

5814-
//const int ne0 = dst->ne[0];
5815-
//const int ne1 = dst->ne[1];
5816-
//const int ne2 = dst->ne[2];
5817-
//const int ne3 = dst->ne[3];
5818-
//const int ne = ne0*ne1*ne2*ne3;
5815+
const int ne0 = dst->ne[0];
5816+
const int ne1 = dst->ne[1];
5817+
const int ne2 = dst->ne[2];
5818+
const int ne3 = dst->ne[3];
58195819

5820-
//const int nb00 = src0->nb[0];
5820+
const int nb00 = src0->nb[0];
5821+
#endif
58215822
const int nb01 = src0->nb[1];
58225823
const int nb02 = src0->nb[2];
58235824
const int nb03 = src0->nb[3];
58245825

5826+
#ifndef NDEBUG
58255827
const int nb10 = src1->nb[0];
5828+
#endif
58265829
const int nb11 = src1->nb[1];
58275830
const int nb12 = src1->nb[2];
58285831
const int nb13 = src1->nb[3];
@@ -5840,8 +5843,9 @@ static void ggml_compute_forward_mul_mat_f32(
58405843
assert(ne2 == ne12);
58415844
assert(ne3 == ne13);
58425845

5843-
// TODO: we don't support permuted src0
5846+
// we don't support permuted src0 or src1
58445847
assert(nb00 == sizeof(float));
5848+
assert(nb10 == sizeof(float));
58455849

58465850
// dst cannot be transposed or permuted
58475851
assert(nb0 == sizeof(float));
@@ -5859,8 +5863,6 @@ static void ggml_compute_forward_mul_mat_f32(
58595863

58605864
#if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_OPENBLAS)
58615865
if (ggml_compute_forward_mul_mat_use_blas(src0, src1, dst)) {
5862-
GGML_ASSERT(nb10 == sizeof(float));
5863-
58645866
if (params->ith != 0) {
58655867
return;
58665868
}
@@ -5903,9 +5905,6 @@ static void ggml_compute_forward_mul_mat_f32(
59035905
return;
59045906
}
59055907

5906-
// TODO: do not support transposed src1
5907-
assert(nb10 == sizeof(float));
5908-
59095908
// parallelize by src0 rows using ggml_vec_dot_f32
59105909

59115910
// total rows in src0
@@ -6169,7 +6168,6 @@ static void ggml_compute_forward_mul_mat_q4_0_f32(
61696168
const int ne1 = dst->ne[1];
61706169
const int ne2 = dst->ne[2];
61716170
const int ne3 = dst->ne[3];
6172-
//const int ne = ne0*ne1*ne2*ne3;
61736171

61746172
const int nb00 = src0->nb[0];
61756173
const int nb01 = src0->nb[1];
@@ -6194,8 +6192,9 @@ static void ggml_compute_forward_mul_mat_q4_0_f32(
61946192
GGML_ASSERT(ne2 == ne12);
61956193
GGML_ASSERT(ne3 == ne13);
61966194

6197-
// TODO: we don't support permuted src0
6195+
// we don't support permuted src0 or src1
61986196
GGML_ASSERT(nb00 == (int) GGML_TYPE_SIZE[GGML_TYPE_Q4_0]);
6197+
GGML_ASSERT(nb10 == sizeof(float));
61996198

62006199
// dst cannot be transposed or permuted
62016200
GGML_ASSERT(nb0 == sizeof(float));
@@ -6213,8 +6212,6 @@ static void ggml_compute_forward_mul_mat_q4_0_f32(
62136212

62146213
#if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_OPENBLAS)
62156214
if (ggml_compute_forward_mul_mat_use_blas(src0, src1, dst)) {
6216-
GGML_ASSERT(nb10 == sizeof(float));
6217-
62186215
if (params->ith != 0) {
62196216
return;
62206217
}
@@ -6278,8 +6275,6 @@ static void ggml_compute_forward_mul_mat_q4_0_f32(
62786275
return;
62796276
}
62806277

6281-
// TODO: do not support transposed src1
6282-
62836278
// parallelize by src0 rows using ggml_vec_dot_q4_0
62846279

62856280
// total rows in src0
@@ -6354,7 +6349,6 @@ static void ggml_compute_forward_mul_mat_q4_1_f32(
63546349
const int ne1 = dst->ne[1];
63556350
const int ne2 = dst->ne[2];
63566351
const int ne3 = dst->ne[3];
6357-
//const int ne = ne0*ne1*ne2*ne3;
63586352

63596353
const int nb00 = src0->nb[0];
63606354
const int nb01 = src0->nb[1];
@@ -6379,8 +6373,9 @@ static void ggml_compute_forward_mul_mat_q4_1_f32(
63796373
GGML_ASSERT(ne2 == ne12);
63806374
GGML_ASSERT(ne3 == ne13);
63816375

6382-
// TODO: we don't support permuted src0
6376+
// we don't support permuted src0 or src1
63836377
GGML_ASSERT(nb00 == (int) GGML_TYPE_SIZE[GGML_TYPE_Q4_1]);
6378+
GGML_ASSERT(nb10 == sizeof(float));
63846379

63856380
// dst cannot be transposed or permuted
63866381
GGML_ASSERT(nb0 == sizeof(float));
@@ -6398,8 +6393,6 @@ static void ggml_compute_forward_mul_mat_q4_1_f32(
63986393

63996394
#if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_OPENBLAS)
64006395
if (ggml_compute_forward_mul_mat_use_blas(src0, src1, dst)) {
6401-
GGML_ASSERT(nb10 == sizeof(float));
6402-
64036396
if (params->ith != 0) {
64046397
return;
64056398
}
@@ -6466,8 +6459,6 @@ static void ggml_compute_forward_mul_mat_q4_1_f32(
64666459
return;
64676460
}
64686461

6469-
// TODO: do not support transposed src1
6470-
64716462
// parallelize by src0 rows using ggml_vec_dot_q4_1
64726463

64736464
// total rows in src0

0 commit comments

Comments
 (0)