From d677c7f61d7c1697c8d4d3f334282d4db1685c9e Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 7 Jan 2023 09:31:42 +0200 Subject: [PATCH] tests : minor fixes for x86 --- examples/whisper/CMakeLists.txt | 2 +- tests/test-mul-mat2.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/whisper/CMakeLists.txt b/examples/whisper/CMakeLists.txt index bf9f12f..55dd1b4 100644 --- a/examples/whisper/CMakeLists.txt +++ b/examples/whisper/CMakeLists.txt @@ -1,7 +1,7 @@ # # whisper -add_library(whisper-cpp SHARED +add_library(whisper-cpp whisper.cpp ) diff --git a/tests/test-mul-mat2.c b/tests/test-mul-mat2.c index d025782..c43479c 100644 --- a/tests/test-mul-mat2.c +++ b/tests/test-mul-mat2.c @@ -1,5 +1,7 @@ // quantized matrix multiplication +#include "ggml.h" + #include #include #include @@ -59,6 +61,8 @@ void mul_mat_vec_f32_0( void quantize(const float * src, void * dst, int n, int k) { char * p0 = dst; + gq_t pp[QB]; + for (int j = 0; j < n; j++) { for (int i = 0; i < k/QK; i++) { float min = FLT_MAX; @@ -105,7 +109,7 @@ void quantize(const float * src, void * dst, int n, int k) { //printf("min/max/d/id: %f %f %f %f\n", min, max, d, id); for (int s = 0; s < QK/gq_t_bits; ++s) { - gq_t pp[QB] = {0}; + memset(pp, 0, sizeof(pp)); for (int l = 0; l < gq_t_bits; l++) { const float v = src[j*k + i*QK + s*gq_t_bits + l]; @@ -209,7 +213,7 @@ int main(int argc, const char ** argv) { void * src0_gq = calloc(1, (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*M); void * src1_gq = calloc(1, (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*N); - const size_t sizef16 = sizeof(__fp16)*M*K + sizeof(__fp16)*N*K; + const size_t sizef16 = sizeof(ggml_fp16_t)*M*K + sizeof(ggml_fp16_t)*N*K; const size_t sizegq = (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*M + (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*N; @@ -256,7 +260,7 @@ int main(int argc, const char ** argv) { const clock_t end = clock(); const uint64_t end_us = get_time_us(); printf("%s: elapsed ticks: %ld\n", __func__, end - start); - printf("%s: elapsed us: %llu / %f ms\n", __func__, end_us - start_us, (end_us - start_us) / 1000.0 / nIter); + printf("%s: elapsed us: %d / %f ms\n", __func__, (int)(end_us - start_us), (end_us - start_us) / 1000.0 / nIter); } printf("%f\n", sum);