-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Roadmap for asm.js support in emscripten #5827
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
Comments
It would be interesting if wasm2asm could help here. I'm not certain of its status, but if we had this as a fallback for exceptional cases it would likely make removing the asm.js backend more viable. |
wasm2asm could help, yeah, but it would depend on key features like the emterpreter working on wasm2asm output, which is probably not trivial. But, that could be worth doing if wasm threads don't arrive soon enough to make the emterpreter not necessary. |
Please don't drop asm.js support too early. I think it will be important as fallback for quite a while, and it's good to have a 'second opinion' for testing wasm performance and correctness, and to be somewhat safe against regression bugs. A few things I stumbled over:
Cheers! |
I agree @floooh , we'll likely support asm.js for many years for those reasons. Hopefully we can minimize the support burden by using wasm2asm or other things, but if that has a limited featureset then it might not be enough by itself. |
Yeah I think having a good wasm2asm will go a long way toward simplifying emscripten without much cost in terms of capabilities that emscripten users get. I do think though that for use cases like "edge's wasm is buggy" that wasm->wasm workarounds might make more sense than falling all the way back to asm.js. |
It seems like these days (thanks to Binaryen) that |
@jakirkham there is a lot more work that would need to be done there. One one side, wasm2asm is missing a bunch of wasm features, and also does not emit very efficient code yet. On the other side, we have features in emscripten that are not yet supported without the asm.js backend, like the emterpreter, so wasm2asm wouldn't be enough anyhow. I think we can get there, but there's a lot more to do. |
We just updated Rust's emscripten backend and noticed that the Is there a time frame for the LLVM6 targets to be updated to a more recent LLVM ? |
@gnzlbg I don't think anyone is currently working on undating fastcomp's LLVM/clang. But if someone were interested that would be great of course. I think most of our focus in emscripten is on the upstream wasm backend at this point, as it is getting close to be a suitable replacement for the fastcomp path. We'll still support asm.js for a long time, though (but things like updating LLVM in fastcomp will not be a high priority). For rust, I'd guess it may also make sense to focus on the upstream wasm32 target for your emscripten support, parallel to the non-emscripten wasm32 support. But that does leave the issue of asm.js support open, though. |
KaiOS, the mobile platform system, cannot launch WebAssembly applications. |
Does KaiOS specifically optimize for asm.js? Or would the wasm2js be just as good? |
KaiOS is aware of asm.js subset optimizations.. |
What JS engine does KaiOS use? I think its unlikely that we are going to keep fastcomp/asm.js support in the long term. If there are users such as KaiOS for which wasm2js is not good enough it may be that pinning to fixed release of emscripten is that only way to go. Hopefully we can make wasm2js good enough for everyone though. |
KaiOS is obviously a fork of the good old B2G (Boot to Gecko) and it uses SpiderMonkey, but the source https://github.com/kaiostech/gecko-b2g is based on Gecko 48. |
Can we reach a conclusion here? It seems like once we drop fastcomp support from mainline emscripten then we will for sure loose pure asm.js support. That leaves KaiOS with two choices:
It seems like (2) is the most rational choice. What do other think? |
Also I should ask @hummeleBop, are you still in the same state today.. being stuck on Gecko 48? |
cc @fabricedesre for KaiOS status |
Current KaiOS devices are still on Gecko 48, yes. This will change but I can't comment on the timeline. |
Thanks @fabricedesre ! Then option 2 that @sbc100 mentioned sounds best in the meantime (to use an emscripten version that has asm.js support, which currently means using fastcomp instead of the default upstream, and after fastcomp is removed will also mean to use an older version). |
OK I'm gonna close this out for now since it sounds like we have a plan |
Now that all the browser vendors (and Node LTS) have shipped wasm, the number of systems that developers will want to target that do not support it will rapidly get smaller. Today, most new emscripten development focuses on wasm, and most projects that use emscripten also want to target wasm [citation needed]. We are close to replacing fastcomp/asm2wasm with the upstream wasm backend as the default way to generate wasm code (#5488).
Once this happens, we will have several opportunities. Well, I call them "opportunities" for the emscripten developers because we can stop maintaining a lot of code and considerably simplify what remains. But there is of course a cost for developers that still want to target asm.js, so we should take it into account.
We should consider what level of support we want to give non-wasm use cases (which would include asm.js and "almost asm"/plain-JS) and for how long.
I think there are a couple of options in this space. I think we do eventually want to drop asm.js support from the mainline development branch of emscripten. This would allow removal of fastcomp, and a lot of code paths in emscripten that go with the asm2wasm pipeline. It would make emscripten much simpler and would especially help serving the goal of smaller JS module glue that we are discussing in #5794. It would also allow us to update the style of JavaScript code we use in emscripten, since modern wasm-supporting engines have good ES6+ language support and performance.
If we do this sooner rather than later, we could think of it more as a fork and maintain a branch of emscripten with asm.js support, where we could make bug fixes and accept patches from contributors who have specific use cases for targeting older engines.
The primary question is when this would happen, and if we want to have intermediate milestones where we keep asm2wasm or asm.js support even while developing features that won't benefit those users.
I think we should think of things in terms of requirements: i.e. what are our requirements/blockers for removing asm2wasm, and for asm.js? (browser install penetration? developers asking for support? missing emscripten features?) What are current use cases for those? (identical language or Module support for both targets? sharing JS glue?)
It's early to be talking about this, but we should be talking about it early, so we can get plenty of feedback.
The text was updated successfully, but these errors were encountered: