You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
isSupportMem64() returns true on Safari 27.2, but the Memory64 build fails to compile ("Memory64 is not enabled") #328
On Safari 27.2, isSupportMem64() returns true, but Safari's wasm compiler rejects Memory64 modules. WebAssembly.Suspending is there too, so needCompat() is false and wllama picks the Memory64 build (esm/wasm/wllama.wasm), which fails to compile:
CompileError: WebAssembly.Module doesn't parse at byte 4853: Memory64 is not enabled
After that loadModel() never settles. That part is not specific to Safari, so I'm filing it separately.
Where I saw it: wllama 3.13.0 from jsDelivr, Safari in the iOS 27.2 simulator (Version/27.2 Mobile/15E148 Safari/604.1), loading LFM2.5-350M-Q4_K_M.gguf from LiquidAI/LFM2.5-350M-GGUF. It is the same with and without COOP/COEP. #297 described the same thing on an iPhone with Safari 27.0.1; it was closed by its author less than a minute after it was opened.
Repro without wllama. The constructor check and the compiler disagree:
// (module (memory i64 1))constprobe=newUint8Array([0,97,115,109,1,0,0,0,5,3,1,4,1]);newWebAssembly.Memory({address: 'i64',initial: 1n});// no errorWebAssembly.validate(probe);// falsetypeofWebAssembly.Suspending;// "function"newWebAssembly.Module(probe);// CompileError: WebAssembly.Module doesn't parse at byte 12: Memory64 is not enabled
Those results are from the jsc shell of macOS 27.2 (26B123). In Safari 27.2 in the simulator, WebAssembly.validate() on a minimal Memory64 module also returned false. In Chromium 156 and Node 24 the constructor succeeds and WebAssembly.validate(probe) is true.
src/utils.ts:276-286: isSupportMem64() only constructs a WebAssembly.Memory with address: 'i64' and returns true when that does not throw. It never asks the compiler.
src/utils.ts:405: needCompat = () => !isSupportJSPI() || !isSupportMem64(), and isSupportJSPI() (src/utils.ts:262-264) is !!WebAssembly.Suspending. Both are true on Safari 27.2, so needCompat() is false.
src/wllama.ts:1598-1628: getWorkerResources() keeps the default wasm unless needCompat() is true.
What works: the compat build works on that Safari. When I patched WebAssembly.Memory in the page to throw for address: 'i64', wllama logged "Compatibility mode is activated", loaded wllama-compat@3.13.0/wasm/wllama.wasm, loaded the model, and createChatCompletion replied.
For reference, branch fix/safari-memory64 on my fork (https://github.com/daveycodez/wllama/tree/fix/safari-memory64, this was PR #320) makes isSupportMem64() also require WebAssembly.validate() to accept the 13-byte module above. With that build and the official 3.13.0 wasm files, Safari 27.2 went to compat mode by itself and replied, and Chrome 156 still used the Memory64 build.
Activity