Interest in Porting Wasmtime & Cranelift

Started by rjzak, October 05, 2022, 11:13:25 AM

Previous topic - Next topic

rjzak

I'm interested in getting Wasmtime (WebAssembly Wasi runtime library and program) and Cranelift (JIT used by Wasmtime, others) working on ppc64le. One thing that's interesting is that Power seems to be the only modern platform missing (RISC-V support was merged in recently, and they also support s390x, ARM, and of course, x86_64). As visible in the RISC-V PR, the amount of code required for such an undertaking is massive, and requires extensive knowledge of assembly. I'm interested in doing this work, and have been reading IBM's ISA and ELF ABI documentation, but could use a hand.

It would benefit Firefox, since Cranelift is used by Firefox for WebAssembly JIT compilation, I believe. It would help with some random apps, such as the text editor Lapce, which use Cranelift & Wasmtime for plugins.

Also relevant: https://forums.raptorcs.com/index.php/topic,27.msg3125.html#msg3125

MPC7500

Isn't ClassicHasClass already doing this, IIRC.

DrNo7

Quote from: MPC7500 on October 05, 2022, 11:56:31 AM
Isn't ClassicHasClass already doing this, IIRC.

Here is the GitHub repo link to jump in and help with the remaining bits missing: https://github.com/chmeeedalf/gecko-dev/tree/t102

And here is the latest blog post that mentions the JIT status and some todo: https://www.talospace.com/2022/09/firefox-105-on-power.html?m=1

rjzak

I don't see cranelift in there, or anywhere under the chmeeedalf user name.

Cranelift: https://github.com/bytecodealliance/wasmtime/tree/main/cranelift

Specifically, where the ppc64le code would be, if it existed: https://github.com/bytecodealliance/wasmtime/tree/main/cranelift/codegen/meta/src/isa

ClassicHasClass

There's no work on Cranelift yet because I haven't gotten wasm fully working. It passes the tests but some apps inexplicably fail, and I suspect it's not handling int32s correctly which will require a non-trivial refactor.

rjzak

Quote from: ClassicHasClass on October 07, 2022, 11:24:16 PM
There's no work on Cranelift yet because I haven't gotten wasm fully working. It passes the tests but some apps inexplicably fail, and I suspect it's not handling int32s correctly which will require a non-trivial refactor.

What aspect of Wasm are you working on? Something in the browser? Another WebAssembly library?

One thing I was thinking of doing with Wasmtime & Cranelift was to start with Wasmtime FIber. It has assembly code for context switching, and of course lacks ppc64le support. I also figured it would be easier for me to get started on, since it's smaller and presumably has unit tests so I can know if I did it right. This is the code for x86_64: https://github.com/bytecodealliance/wasmtime/blob/main/crates/fiber/src/unix/x86_64.rs

ClassicHasClass

Quote from: rjzak on October 08, 2022, 01:18:29 PM
Quote from: ClassicHasClass on October 07, 2022, 11:24:16 PM
There's no work on Cranelift yet because I haven't gotten wasm fully working. It passes the tests but some apps inexplicably fail, and I suspect it's not handling int32s correctly which will require a non-trivial refactor.

What aspect of Wasm are you working on?

Well, "it." The Firefox code generator.