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
Today I have been playing with wasm-tools and hitting a number of limits/corner cases, I'd like to share what I have found and any help is highly appreciated.
I try to summarize the main issues I have encountered so far:
wasm-opt takes a very long time to process the module, I'm on a 16 cores x86 machine:
$ time wasm-opt -Oz wasm-tools.wasm -o wasm-tools-opt.wasm
wasm-opt -Oz wasm-tools.wasm -o wasm-tools-opt.wasm 296.77s user 1.06s system 540% cpu 55.132 total
after the optimization, it generates a function type with 680 parameters (type 90) the maximum expressible in Java is 255 and this is the first time we hit this limit
I attempted to use wasm-split but I'm failing to find documentation about the "profile", do you have a link to spare?
What I would like to achieve:
split out the wasm module into more easily processable modules
reduce the functions size so that we don't hit JVM limits
As said, any help is very welcome!
The text was updated successfully, but these errors were encountered:
I ran this optimization with BINARYEN_PASS_DEBUG=1 to get timings for each of the passes, and it looks like the longest-running pass by far is inlining-optimizing. Using -Os instead of -Oz makes this a little faster, but also shrinks the module a little less. The -Os version does not have that function with hundreds of parameters.
I also ran with BINARYEN_PASS_DEBUG=3 to dump the intermediate state after each pass is run and found that the pass that introduces the functions with hundreds of parameters is merge-similar-functions. We should update that pass to avoid situations like that. On the Web, the limit on the number of function parameters is 1000, but perhaps we can have Binaryen use the 255 limit or make it configurable.
You can read more about the workflow of using wasm-split here: https://emscripten.org/docs/optimizing/Module-Splitting.html. Some of that documentation is Emscripten-specific, but it should give you an idea of how to use wasm-split directly. You can also look at the commands run by our wasm-split tests to get an idea of how it works.
Hi 👋 and thanks for the awesome project!
Today I have been playing with wasm-tools and hitting a number of limits/corner cases, I'd like to share what I have found and any help is highly appreciated.
The wasm file to reproduce the steps is here.
I try to summarize the main issues I have encountered so far:
wasm-opt
takes a very long time to process the module, I'm on a 16 cores x86 machine:wasm-split
but I'm failing to find documentation about the "profile", do you have a link to spare?What I would like to achieve:
As said, any help is very welcome!
The text was updated successfully, but these errors were encountered: