forked from extern/whisper.cpp
ggml : multi-thread the ggml_add operator
This commit is contained in:
parent
a2eeb941f6
commit
75171c2b79
7
ggml.c
7
ggml.c
@ -3150,7 +3150,10 @@ void ggml_compute_forward_add_f32(
|
|||||||
GGML_ASSERT(nb00 == sizeof(float));
|
GGML_ASSERT(nb00 == sizeof(float));
|
||||||
|
|
||||||
if (nb10 == sizeof(float)) {
|
if (nb10 == sizeof(float)) {
|
||||||
for (int j = ith; j < n; j += nth) {
|
const int j0 = (n/nth)*ith;
|
||||||
|
const int j1 = ith == nth - 1 ? n : (n/nth)*(ith + 1);
|
||||||
|
|
||||||
|
for (int j = j0; j < j1; j++) {
|
||||||
ggml_vec_add_f32(nc,
|
ggml_vec_add_f32(nc,
|
||||||
(float *) ((char *) dst->data + j*nb1),
|
(float *) ((char *) dst->data + j*nb1),
|
||||||
(float *) ((char *) src0->data + j*nb01),
|
(float *) ((char *) src0->data + j*nb01),
|
||||||
@ -6857,7 +6860,7 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph)
|
|||||||
} break;
|
} break;
|
||||||
case GGML_OP_ADD:
|
case GGML_OP_ADD:
|
||||||
{
|
{
|
||||||
node->n_tasks = 1;
|
node->n_tasks = n_threads;
|
||||||
} break;
|
} break;
|
||||||
case GGML_OP_SUB:
|
case GGML_OP_SUB:
|
||||||
case GGML_OP_MUL:
|
case GGML_OP_MUL:
|
||||||
|
Loading…
Reference in New Issue
Block a user