-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Build regression: "STANDALONE_WASM does not support memory growth yet" #9587
Comments
This is because we are moving to a more robust approach for Did the output you got before actually work, including memory growth? How did you run it, and with what support code (specifically, what handled the growth)? If there was stuff that worked before that the assertions now prevent, we should remove them, but would be good to understand what that was. |
Yeah the output before worked without issues; the memory growth support code I used was simply resizing the Memory object - note that the C++ code in question doesn't do any memory allocations, so this function is called from JS: https://github.com/zeux/meshoptimizer/blob/master/js/meshopt_decoder.js#L13-L21 Just removing this check in the new emscripten build isn't sufficient for getting this to work though - not sure why yet. |
…le it isn't 100% standalone (there is an import to grow the memory), it is usable for people that implement that import, so don't break them. fixes #9587
I see, thanks! My guess is it doesn't work now because you provide Another difference is that the wasm will create the memory itself, you don't need to create it on the outside and import it (again, this makes the wasm more standalone). Sorry for the confusion, but this is an internal ABI detail that we don't guarantee won't change, and we had to optimize now. That assertion was definitely unnecessary though, I'll remove it in #9588. |
Yeah - I figured out how to adjust my code to make it work. It looks like before, I understand that I'm playing fast & loose here and I'm happy to adjust my code a bit after Emscripten releases - I couldn't find another way to get a small compact binary. |
Interestingly I no longer need to supply "emscripten_memcpy_big" anymore either - I am assuming that the standalone version of libc now handles the copy internally without calling out to JS? |
Correct, in standalone mode we don't expect JS to be able to do a super-fast memcpy for us, so it's all internal in the wasm. |
Ok - thanks! The .wasm file is a touch bigger with the new standalone mode, but it evens out with the reductions in the JS blob (.wasm is embedded into .js here): -rwxrwxrwx 1 zeux zeux 8407 Oct 6 19:06 meshopt_decoder.js My code did depend on memcpy but the sizes were below the old JS threshold so performance isn't affected here either, which is great. |
... in fact, it looks like with the new runtime I can even export sbrk via |
The following command line used to work a few months ago - I think this was with 1.38.40:
emcc src/vertexcodec.cpp src/indexcodec.cpp -O3 -DNDEBUG -s EXPORTED_FUNCTIONS='["_meshopt_decodeVertexBuffer", "_meshopt_decodeIndexBuffer"]' -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=24576 -s TOTAL_MEMORY=65536 -o build/meshopt_decoder.wasm
After uprading to 1.38.47, I now get the following error:
shared:ERROR: STANDALONE_WASM does not support memory growth yet
Memory growth worked correctly before the update. Any pointers as to how to fix this would be appreciated.
The text was updated successfully, but these errors were encountered: