Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HelloWasm app is busted #8368

Open
alexreinking opened this issue Aug 6, 2024 · 6 comments
Open

HelloWasm app is busted #8368

alexreinking opened this issue Aug 6, 2024 · 6 comments
Assignees

Comments

@alexreinking
Copy link
Member

alexreinking commented Aug 6, 2024

The HelloWasm app isn't working right.

The build itself is broken and only happens to work. The core.cpp file uses the headers from a Halide filter library that it doesn't depend on. This can be observed by running cmake --build build --target wasm.

Then, the threaded versions don't work in-browser. Running Chrome with the following two flags enabled:

  1. chrome://flags/#enable-javascript-experimental-shared-memory
  2. chrome://flags/#enable-experimental-webassembly-features

shows an error in the generated emscripten code along the lines of TypeError: wait.value.then is not a function.

Emscripten error
Uncaught (in promise) TypeError: wait.value.then is not a function
    at __emscripten_thread_mailbox_await (index_threads.js:1:77532)
    at index_threads.wasm:0x3c555
    at callRuntimeCallbacks (index_threads.js:1:24660)
    at initRuntime (index_threads.js:1:7833)
    at doRun (index_threads.js:1:204130)
    at run (index_threads.js:1:204373)
    at runCaller (index_threads.js:1:203667)
    at removeRunDependency (index_threads.js:1:8897)
    at receiveInstance (index_threads.js:1:10976)
    at receiveInstantiationResult (index_threads.js:1:11116)
__emscripten_thread_mailbox_await @ index_threads.js:1
$Kd @ index_threads.wasm:0x3c555
callRuntimeCallbacks @ index_threads.js:1
initRuntime @ index_threads.js:1
doRun @ index_threads.js:1
run @ index_threads.js:1
runCaller @ index_threads.js:1
removeRunDependency @ index_threads.js:1
receiveInstance @ index_threads.js:1
receiveInstantiationResult @ index_threads.js:1

This is using the latest EMSDK, cloned from upstream as of this morning.

@abadams
Copy link
Member

abadams commented Aug 6, 2024

This threaded version works for me on linux chrome, but freezes on os x chrome: https://halide-lang.org/wasm_demo/index.html?simd&threads

It used to work on both.

@alexreinking
Copy link
Member Author

https://halide-lang.org/wasm_demo/index.html?simd&threads

I'm sure that was compiled with an older version of EMSDK, too.

@steven-johnson
Copy link
Contributor

Hmm, it works perfectly on my Mac using Chrome using today's EMCC and the wasm experimental features enabled in Chrome. What specific cmake configure command did you use? I did

mkdir build
cd build
Halide_DIR=~/halide-19-install/ cmake ..
ninja

@steven-johnson
Copy link
Contributor

This can be observed by running cmake --build build --target wasm.

What's with the --target wasm part? I don't see any target of that name.

@steven-johnson
Copy link
Contributor

FYI, I have Experimental JavaScript shared memory features set to default

@steven-johnson
Copy link
Contributor

(I built with today's EMCC, btw... maybe there was a temporary buggy version?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants