From f9ba81953b4dd1ac9103baf1222fc3a6de1462b5 Mon Sep 17 00:00:00 2001 From: Reese Levine Date: Mon, 17 Nov 2025 13:53:00 -0800 Subject: [PATCH] Disable multiple threads for emscripten single-thread builds in ggml_graph_plan --- ggml/src/ggml-cpu/ggml-cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ggml/src/ggml-cpu/ggml-cpu.c b/ggml/src/ggml-cpu/ggml-cpu.c index c7348cc26c..45b4292677 100644 --- a/ggml/src/ggml-cpu/ggml-cpu.c +++ b/ggml/src/ggml-cpu/ggml-cpu.c @@ -2701,6 +2701,11 @@ struct ggml_cplan ggml_graph_plan( n_threads = threadpool ? threadpool->n_threads_max : GGML_DEFAULT_N_THREADS; } +#if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__) + // Emscripten without pthreads support can only use a single thread + n_threads = 1; +#endif + size_t work_size = 0; struct ggml_cplan cplan;