From 4ef3398e8fe0c426de038b8c3816c6791a34a5ae Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 8 Jan 2023 12:35:56 +0200 Subject: [PATCH] ggml : remove obsolete zeroing + comment fixes (#390) --- ggml.c | 6 +----- whisper.cpp | 1 + whisper.h | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ggml.c b/ggml.c index 3ea1e61..c59ee64 100644 --- a/ggml.c +++ b/ggml.c @@ -3724,8 +3724,6 @@ static void ggml_compute_forward_sum_f32( assert(ggml_is_scalar(dst)); assert(src0->nb[0] == sizeof(float)); - *(float *) (dst->data) = 0.0f; - const int ne00 = src0->ne[0]; const int ne01 = src0->ne[1]; const int ne02 = src0->ne[2]; @@ -3811,8 +3809,6 @@ static void ggml_compute_forward_mean_f32( for (int i03 = 0; i03 < ne03; i03++) { for (int i02 = 0; i02 < ne02; i02++) { for (int i01 = 0; i01 < ne01; i01++) { - *(float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3) = 0.0f; - ggml_vec_sum_f32(ne00, (float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3), (float *) ((char *) src0->data + i01*nb01 + i02*nb02 + i03*nb03)); @@ -4791,7 +4787,7 @@ static void ggml_compute_forward_mul_mat_f16_f32( } } } else { - // parallelize by src1 columns using ggml_vec_mad_f32 + // parallelize by src1 columns using ggml_vec_mad_f16 // each thread has its own work data // during FINALIZE we accumulate all work data into dst diff --git a/whisper.cpp b/whisper.cpp index f1985a4..a645056 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -1471,6 +1471,7 @@ static bool whisper_encode( } ggml_graph_compute(ctx0, &gf); + //ggml_graph_print(&gf); } //////////////////////////////////////////////////////////////////////////// diff --git a/whisper.h b/whisper.h index 582138f..63f61af 100644 --- a/whisper.h +++ b/whisper.h @@ -93,8 +93,8 @@ extern "C" { void (*close)(void * ctx); } whisper_model_loader; - // Various function to load a ggml whisper model. - // Allocates (almost) all memory needed for the model. + // Various functions for loading a ggml whisper model. + // Allocate (almost) all memory needed for the model. // Return NULL on failure WHISPER_API struct whisper_context * whisper_init_from_file(const char * path_model); WHISPER_API struct whisper_context * whisper_init_from_buffer(void * buffer, size_t buffer_size);