Author Topic: Interest in Porting Wasmtime & Cranelift  (Read 3825 times)

rjzak

  • Newbie
  • *
  • Posts: 34
  • Karma: +6/-0
    • View Profile
    • Personal site
Interest in Porting Wasmtime & Cranelift
« on: October 05, 2022, 11:13:25 am »
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

  • Hero Member
  • *****
  • Posts: 588
  • Karma: +41/-1
    • View Profile
    • Twitter
Re: Interest in Porting Wasmtime & Cranelift
« Reply #1 on: October 05, 2022, 11:56:31 am »
Isn't ClassicHasClass already doing this, IIRC.

DrNo7

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Interest in Porting Wasmtime & Cranelift
« Reply #2 on: October 05, 2022, 11:56:35 pm »
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

  • Newbie
  • *
  • Posts: 34
  • Karma: +6/-0
    • View Profile
    • Personal site
Re: Interest in Porting Wasmtime & Cranelift
« Reply #3 on: October 07, 2022, 01:55:10 pm »
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

  • Sr. Member
  • ****
  • Posts: 467
  • Karma: +35/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: Interest in Porting Wasmtime & Cranelift
« Reply #4 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.

rjzak

  • Newbie
  • *
  • Posts: 34
  • Karma: +6/-0
    • View Profile
    • Personal site
Re: Interest in Porting Wasmtime & Cranelift
« Reply #5 on: October 08, 2022, 01:18:29 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

  • Sr. Member
  • ****
  • Posts: 467
  • Karma: +35/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: Interest in Porting Wasmtime & Cranelift
« Reply #6 on: October 08, 2022, 05:08:45 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.