Skip to content

Commit 6b93b37

Browse files
reeselevineXXjcontiniXXNeha Abbasabhijitramesh
committed
Squashed commit of the following:
commit b3c6bf4 Author: Abhijit Ramesh <abhijitramesh2k@gmail.com> Date: Mon Dec 1 18:29:00 2025 -0800 ggml webgpu: fix xielu parameter passing (#11) The XIELU operation was incorrectly using static_cast to convert float parameters to uint32_t, which converted numeric values instead of preserving IEEE 754 bit patterns. This caused incorrect values to be interpreted by the GPU shader. * Use reinterpret_cast to preserve float bit patterns when passing through uint32_t params buffer * Update WGSL shader parameter types from u32 to f32 * Re-enable XIELU support (was disabled due to numerical issues) Fixes NMSE test failures for XIELU operation on WebGPU backend. commit 5ca9b5e Author: neha-ha <137219201+neha-ha@users.noreply.github.com> Date: Tue Nov 18 12:17:00 2025 -0800 Refactored pipelines and workgroup calculations (#10) * refactored pipelines * refactored workgroup calculation * removed commented out block of prior maps * Clean up ceiling division pattern --------- Co-authored-by: Neha Abbas <nehaabbas@eduroam-169-233-141-223.ucsc.edu> Co-authored-by: Reese Levine <reeselevine1@gmail.com> Author: James Contini <jamescontini@gmail.com> Date: Wed Oct 29 23:13:06 2025 -0700 formatted embed wgsl and ggml-webgpu.cpp commit e1f6bae Author: James Contini <jamescontini@gmail.com> Date: Wed Oct 29 23:08:37 2025 -0700 implemented REPL_Template support and removed bug in unary operators kernel commit 8c70b8f Author: James Contini <jamescontini@gmail.com> Date: Wed Oct 15 16:14:20 2025 -0700 responded and dealt with PR comments commit f9282c6 Author: James Contini <jamescontini@gmail.com> Date: Sun Oct 12 13:41:41 2025 -0700 removed unnecesarry checking if node->src[1] exists for unary operators commit 4cf28d7 Author: James Contini <jamescontini@gmail.com> Date: Sun Oct 12 13:32:45 2025 -0700 All operators (inlcluding xielu) working commit 74c6add Author: James Contini <jamescontini@gmail.com> Date: Fri Oct 10 13:16:48 2025 -0700 fixed autoconfig commit 3627499 Author: James Contini <jamescontini@gmail.com> Date: Fri Oct 10 13:10:46 2025 -0700 removed vestigial files commit cb08583 Author: James Contini <jamescontini@gmail.com> Date: Fri Oct 10 12:59:32 2025 -0700 abides by editor-config commit 5360e28 Author: James Contini <jamescontini@gmail.com> Date: Fri Oct 10 12:45:57 2025 -0700 rms_norm double declaration bug atoned commit 7b09baa Merge: 8a6ec84 74b8fc1 Author: James Contini <jamescontini@gmail.com> Date: Fri Oct 10 11:50:03 2025 -0700 resolving merge conflicts commit 8a6ec84 Author: James Contini <jamescontini@gmail.com> Date: Wed Oct 8 18:06:47 2025 -0700 unary operators pass ggml tests commit c3ae382 Author: James Contini <jamescontini@gmail.com> Date: Wed Oct 1 16:22:40 2025 -0700 neg passes backend test commit aa1c9b2 Author: James Contini <jamescontini@gmail.com> Date: Tue Sep 30 23:55:27 2025 -0700 neg f16xf32xip builds and runs, havent actually ran a model that uses neg kernel yet though Co-authored-by: James Contini <jamescontini@gmail.com> Co-authored-by: Neha Abbas <neabbas@ucsc.edu> Co-authored-by: Abhijit Ramesh <abhijitramesh2k@gmail.com>
1 parent dea9ba2 commit 6b93b37

File tree

6 files changed

+1099
-365
lines changed

6 files changed

+1099
-365
lines changed

ggml/include/ggml.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,13 @@
225225
# define GGML_MAX_NAME 64
226226
#endif
227227

228+
// For single-thread WASM builds, only use 1 thread
229+
#if !defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__)
228230
#define GGML_DEFAULT_N_THREADS 4
231+
#else
232+
#define GGML_DEFAULT_N_THREADS 1
233+
#endif
234+
229235
#define GGML_DEFAULT_GRAPH_SIZE 2048
230236

231237
#if UINTPTR_MAX == 0xFFFFFFFF

ggml/src/ggml-cpu/ggml-cpu.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,11 @@ bool ggml_backend_is_cpu(ggml_backend_t backend) {
246246
void ggml_backend_cpu_set_n_threads(ggml_backend_t backend_cpu, int n_threads) {
247247
GGML_ASSERT(ggml_backend_is_cpu(backend_cpu));
248248

249+
// For single-thread WASM builds, do not allow changing the number of threads
250+
#if !defined(_EMSCRIPTEN_) || defined(__EMSCRIPTEN_PTHREADS__)
249251
struct ggml_backend_cpu_context * ctx = (struct ggml_backend_cpu_context *)backend_cpu->context;
250252
ctx->n_threads = n_threads;
253+
#endif
251254
}
252255

253256
void ggml_backend_cpu_set_threadpool(ggml_backend_t backend_cpu, ggml_threadpool_t threadpool) {
@@ -622,10 +625,14 @@ static ggml_backend_feature * ggml_backend_cpu_get_features(ggml_backend_reg_t r
622625
}
623626

624627
static void * ggml_backend_cpu_get_proc_address(ggml_backend_reg_t reg, const char * name) {
628+
629+
// For single-thread WASM builds, do not expose a set_n_threads function
630+
#if !defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__)
625631
if (strcmp(name, "ggml_backend_set_n_threads") == 0) {
626632
ggml_backend_set_n_threads_t fct = ggml_backend_cpu_set_n_threads;
627633
return (void *)fct;
628634
}
635+
#endif
629636
if (strcmp(name, "ggml_backend_dev_get_extra_bufts") == 0) {
630637
ggml_backend_dev_get_extra_bufts_t fct = ggml_backend_cpu_device_get_extra_buffers_type;
631638
return (void *)fct;

0 commit comments

Comments
 (0)