Skip to content

Commit

Permalink
ggml : remove obsolete zeroing + comment fixes (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Jan 8, 2023
1 parent 5e9f335 commit 4ef3398
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ static bool whisper_encode(
}

ggml_graph_compute(ctx0, &gf);
//ggml_graph_print(&gf);
}

////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions whisper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4ef3398

Please sign in to comment.