Emscripten 2.0.12 Upstream backend#1102
Conversation
Because WASM and hence upstream emscripten has strict return types
|
I need to fix the tests, will do it later if I have a chance |
rth
left a comment
There was a problem hiding this comment.
Thank you @joemarshall, really looking forward to this!
|
|
||
|
|
||
| class EnvironmentRewritingArgument(argparse.Action): | ||
| def __call__(self, parser, namespace, values, option_string=None): |
There was a problem hiding this comment.
Some type annotations would help readability.
dalcde
left a comment
There was a problem hiding this comment.
Thanks a lot! I'm really excited about this. I've left some minor comments
|
We should try not reviewing simultaneously :). Glad that we mostly caught distinct things though. |
|
Current status on this - I've commited some of the changes suggested above. In doing so I had to move to emscripten 2.0.12 to get that packager fix in. It needed some more fixes to emscripten dynamic linking to make the tests there work (plus some modifying of the fpcast test so that it actually tried calling something with the wrong signature!). Right now there's a bunch of tests in src that I need to work through to see what is broken. Updating seems to have broken python output (at least from print in console.html), I suspect this is causing a bunch of the fails. |
|
Fixed a bunch of tests now, but there's some stuff in scipy that I think is to do with yet more fortran return types being inconsistent which causes some test fails when sub modules don't import. This also breaks astropy and some things that use scipy submodules. Also, wasm in new emscripten breaks sometimes on access to uninitialised variables I discover, whereas it appears asm.js initializes to zero. There was one in the jsproxy that caused all sort of weird intermittent errors. |
BTW, apparently there are a number of known issues around it #72 (comment) and scipy/scipy#10335
Was or is? As there are lots of core (and package) test are still failing with Could you also please merge upstream master in to resolve conflicts? |
|
Oops, didn't push the unreachable thing, which was that uninitialized variable in jsproxy. There's still weirdness with function parameters to lapack code in scipy which I am debugging by building it with function parameter and implicit function definition warnings set to error |
|
Looking into this, at a first glance these all seem to be assertion errors fairly deep inside of CPython. I took a look at the core-chrome tests. Most failures (380) are coming from In 5 cases it fails inside of the I think this is happening at 3 times it fails in |
|
Anyways, there's a clear first thing to look into since |
|
I'll try to reproduce one of those errors in browser, there's probably something similar to the proxy error that I pushed a patch for, some kind of assumption that function types don't matter because they don't in C, or that things are initialized to zero... |
|
In the firefox version, it gives unreadable stack traces (no function name symbols) so you can't tell that it's inside of |
Co-authored-by: Dexter Chua <[email protected]>
rth
left a comment
There was a problem hiding this comment.
Generally LGTM. I think we can merge the rest in this PR. Thanks again for all you work @joemarshall !
| for (let name of imports) { | ||
| if (name in packageNames) { | ||
| packages.add(name); | ||
| packages.add(packageNames[name]); |
There was a problem hiding this comment.
Looks like we didn't have enough tests for this. (No action needed in this PR).
|
The only thing is that pillow on chrome seems to frequently timeout (or there are timeouts in other packages as well). Though I have also seen time outs on master recently, so I would be OK merging this as is, and try to iron out unreliable tests in follow up PRs. |
|
I pushed a few commits to fix review comments as I'm very much looking forward to see this merged :) |
|
BTW it looks like with the upstream backend in this PR pure Python code in pyodide code runs 25 to 30% faster on average (ref #1120) Below are benchmark results for Firefox aggregated over 3 CI runs in this PR and on master. Chrome is comparable. Benchmarks on the top are mostly pure python code, and at the bottom mostly using numpy, |
|
The only concern is that Chrome does seem to time out more often here and we removed the custom timeout in |
|
The current timeout should be 30 seconds, aiui.
|
|
Also actually timeouts for packages in Chrome might have something to do with the fact that this removes xfail on scipy dependent packages. Previously it's not that they weren't working, but had a non negligible change of failing (or I guess now time out) hence the xfail. Maybe it's just more about RAM usage when a few of such packages are loaded in parallel. |
|
Thanks again for your work on this @joemarshall and @dalcde for improving the build setup earlier to make it possible! This fixed a number of scipy related issues (linked above) and reduced the scipy size significantly #240 (comment), which was a blocker for a long time. |

What it says. Emscripten 2.0.9 upstream (non-fastcomp, compiles straight to wasm), plus patches for binaryen and emscripten so that dynamic linking and passing of function pointers between side modules and main modules works.
I'm part way through pull requests for binaryen and emscripten so that the patches there aren't needed.
All other patches to emscripten and binaryen have been dropped - I'm not sure if they were all things that are fixed in the new backend - none of them worked with new backend anyway
Closes #531
Closes #476