Skip to content

Commit f35ea1c

Browse files
committed
correct test if vec_dot_type == GGML_TYPE_F32
1 parent 08b6344 commit f35ea1c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tests/test-quantize-fns.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@ static float dot_product_error(
8686
const auto * vdot = ggml_get_type_traits(qfns->vec_dot_type);
8787

8888
qfns->from_float(test_data1, tmp_q1.data(), test_size);
89-
vdot->from_float(test_data2, tmp_q2.data(), test_size);
89+
if (qfns->vec_dot_type != GGML_TYPE_F32)
90+
vdot->from_float(test_data2, tmp_q2.data(), test_size);
9091

9192
float result = INFINITY;
92-
qfns->vec_dot(test_size, &result, 0, tmp_q1.data(), 0, tmp_q2.data(), 0, 1);
93+
if (qfns->vec_dot_type != GGML_TYPE_F32) {
94+
qfns->vec_dot(test_size, &result, 0, tmp_q1.data(), 0, tmp_q2.data(), 0, 1);
95+
} else {
96+
qfns->vec_dot(test_size, &result, 0, tmp_q1.data(), 0, test_data2, 0, 1);
97+
}
9398

9499
const float dot_ref = dot_product(test_data1, test_data2, test_size);
95100

tests/test-quantize-perf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ int main(int argc, char * argv[]) {
323323
printf("\n");
324324
}
325325

326-
if (params.op_quantize_row_q_dot) {
326+
if (params.op_quantize_row_q_dot && ggml_get_type_traits(qfns->vec_dot_type)->from_float) {
327327
printf(" quantize_row_q_dot\n");
328328
for (size_t size : params.test_sizes) {
329329
printf(" %zu values (%.2f MB)\n", size, 4*size/(float)(1024*1024));

0 commit comments

Comments
 (0)