]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml-webgpu: Fix GGML_MEM_ALIGN to 8 for emscripten. (#18628)
authorMasashi Yoshimura <redacted>
Thu, 8 Jan 2026 16:36:42 +0000 (01:36 +0900)
committerGitHub <redacted>
Thu, 8 Jan 2026 16:36:42 +0000 (08:36 -0800)
* Fix GGML_MEM_ALIGN to 8 for emscripten.

* Add a comment explaining the need for GGML_MEM_ALIGN == 8 in 64-bit wasm with emscripten

ggml/include/ggml.h

index 20c912d0e9bbe888062dd16853d872ea173e1492..b69583dd3fdefd7c1fb48d64d9ce9a5010c749c3 100644 (file)
 
 #if UINTPTR_MAX == 0xFFFFFFFF
     #define GGML_MEM_ALIGN 4
+#elif defined(__EMSCRIPTEN__)
+// emscripten uses max_align_t == 8, so we need GGML_MEM_ALIGN == 8 for 64-bit wasm.
+// (for 32-bit wasm, the first conditional is true and GGML_MEM_ALIGN stays 4.)
+// ref: https://github.com/ggml-org/llama.cpp/pull/18628
+    #define GGML_MEM_ALIGN 8
 #else
     #define GGML_MEM_ALIGN 16
 #endif