From b9080074718ef37153f83d82d9ae7031b716d059 Mon Sep 17 00:00:00 2001 From: xaedes Date: Mon, 24 Apr 2023 04:13:33 +0200 Subject: [PATCH] norm & rms_norm can not be threaded: after investigation rms norm for quite some time I come to the conclusion that neither norm, nor rms_norm can be threaded, because we need mean over all items, not just of the slices each thread sees. --- ggml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggml.c b/ggml.c index 5c22e2a3b..5522b4fa2 100644 --- a/ggml.c +++ b/ggml.c @@ -13288,8 +13288,8 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph) case GGML_OP_RMS_NORM: case GGML_OP_RMS_NORM_BACK: { - // i think this must not be threaded, because we need mean over all items, not just the slices each thread sees - node->n_tasks = n_threads; + // i think this cannot be threaded, because we need mean over all items, not just the slices each thread sees. + node->n_tasks = 1; } break; case GGML_OP_MUL_MAT: {