Skip to content

Commit d677c7f

Browse files
committed
tests : minor fixes for x86
1 parent 446ccf3 commit d677c7f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/whisper/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# whisper
33

4-
add_library(whisper-cpp SHARED
4+
add_library(whisper-cpp
55
whisper.cpp
66
)
77

tests/test-mul-mat2.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// quantized matrix multiplication
22

3+
#include "ggml.h"
4+
35
#include <float.h>
46
#include <stdint.h>
57
#include <stdio.h>
@@ -59,6 +61,8 @@ void mul_mat_vec_f32_0(
5961
void quantize(const float * src, void * dst, int n, int k) {
6062
char * p0 = dst;
6163

64+
gq_t pp[QB];
65+
6266
for (int j = 0; j < n; j++) {
6367
for (int i = 0; i < k/QK; i++) {
6468
float min = FLT_MAX;
@@ -105,7 +109,7 @@ void quantize(const float * src, void * dst, int n, int k) {
105109
//printf("min/max/d/id: %f %f %f %f\n", min, max, d, id);
106110

107111
for (int s = 0; s < QK/gq_t_bits; ++s) {
108-
gq_t pp[QB] = {0};
112+
memset(pp, 0, sizeof(pp));
109113

110114
for (int l = 0; l < gq_t_bits; l++) {
111115
const float v = src[j*k + i*QK + s*gq_t_bits + l];
@@ -209,7 +213,7 @@ int main(int argc, const char ** argv) {
209213
void * src0_gq = calloc(1, (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*M);
210214
void * src1_gq = calloc(1, (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*N);
211215

212-
const size_t sizef16 = sizeof(__fp16)*M*K + sizeof(__fp16)*N*K;
216+
const size_t sizef16 = sizeof(ggml_fp16_t)*M*K + sizeof(ggml_fp16_t)*N*K;
213217
const size_t sizegq = (2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*M +
214218
(2*sizeof(float) + (QK/gq_t_bits)*QB*sizeof(gq_t))*(K/QK)*N;
215219

@@ -256,7 +260,7 @@ int main(int argc, const char ** argv) {
256260
const clock_t end = clock();
257261
const uint64_t end_us = get_time_us();
258262
printf("%s: elapsed ticks: %ld\n", __func__, end - start);
259-
printf("%s: elapsed us: %llu / %f ms\n", __func__, end_us - start_us, (end_us - start_us) / 1000.0 / nIter);
263+
printf("%s: elapsed us: %d / %f ms\n", __func__, (int)(end_us - start_us), (end_us - start_us) / 1000.0 / nIter);
260264
}
261265

262266
printf("%f\n", sum);

0 commit comments

Comments
 (0)