I'm new to cranelift - but not new to Rust. I have some experience writing POWER64 assembly am wondering about where I should start poking if I wanted to add the ability to emit power64 to cranelift?
Hi @Yehowshua Immanuel -- adding a ppc64 backend would be fantastic and we'd be happy to give any help we can!
Eventually we want to write a "how to write a backend" tutorial but for now the best reference is the other backends, I think. The s390x backend is probably the simplest right now, and covers some other issues you'll hit too I think (big endian?). If you start by looking at cranelift/codegen/src/isa/s390x
and duplicate what's there (and the various other places you see s390x
in the codebase, around buildscripts and Cargo features at least) that should get you on the right track, at least. To get wasmtime running on top of Cranelift will be a bit more work (the fibers library, trap handling) but Cranelift itself can be exercised with runtests at least.
Let me know if you have any other questions!
Thanks. I'm sure I'll have more questions soon!
I'm starting to wonder where on earth you guys were able to test an s390x!!
On second thought, I'm wondering if I were to loan out a POWER desktop to somebody - would they be interested in writing a backend for POWER64
The s390x backend is probably the simplest right now, and covers some other issues you'll hit too I think (big endian?).
In practice - I don't think anybody actually uses big endian on POWER64...
Yehowshua Immanuel said:
I'm starting to wonder where on earth you guys were able to test an s390x!!
Well, that work has been done mostly by @Ulrich Weigand who, being at IBM, presumably has access to hardware :smile:. The rest of us just runs QEMU.
@Anton Kirilov @Yehowshua Immanuel If you would like to have access to real s390x hardware, that's available free of charge (for the purpose of open-source development) via the IBM LinuxONE Community Cloud hosted at Marist College: https://linuxone.cloud.marist.edu
@Yehowshua Immanuel How's the Power9 progress?
heh - well I haven't yet gotten around to making much progress on it - besides - I sold my POWER9 machine.
Plus I've been working on this - https://github.com/ThePerfectComputer/FastWave
But I think I'll get back to cranelift when that's done. @Richard Zak - are you interested in POWER9 for crane lift?
I am interested, and was thinking about getting a Raptor Talos II. What machine did you have?
I had a Talos - I just sold it two weeks ago - I would have totally sold it to you too
Just keep in mind that the Talos doesn't have a sleep mode - and if you want a WiFi adapter with reasonable range - you'll need to build this: https://github.com/BracketMaster/rtl8821cu-5.12.0-void-linux-ppc
Couldn't find any modern WiFi drivers that support PowerPC on linux
I'll be using Ethernet, and having the Talos replace my current desktop. How was using it as a desktop? Void seems to be the best bet due to graphics drivers. Did you get any code written for cranelift?
I didn't write any code. Yes - void is basically the only usable linux distro in terms of the graphics capabilities and sane boot times.
As far as using it as a desktop goes - the BMC is what invokes the CPU to boot - which is weird - and there's a firmware bug that occasionally drops cores when NVIDIA cards make invalid PCI-e accesses - didn't have the issue with AMD cards however
Lastly, for the 4 core version, the power consumption to performance ratio is pretty abysmal relative to my iPhone - which is about as fast as the Talos and clearly uses less power. 4c version is about 27W at idle and 90W at full speed -and keep in mind it doesn't have a sleep mode - so either you turn it off when not in use or do 24H*27W to compute your new minimum energy bill
I'm thinking about getting the dual 8-core. I have my current machine on all the time, and running Boinc workloads, so I'm not too worried about it (except for maybe heat).
@Yehowshua Immanuel any thoughts on how to create the inst.isle
and lower.isle
files? Seems each is about 3k lines for s390x and x86.
@Richard Zak that's the essence of the porting effort -- these two files together are most of the compiler backend. "How to create" is more or less to follow what the other backends do, unfortunately
on my todo list is "write a guide for adding a new compiler backend", but unfortunately I haven't had time to get to this yet; we're very much stretched thin and still building a bunch of things
so as a contributor adding a new backend, you're very welcome and we'll try to help, but you're also very much on the bleeding edge
I would recommend starting with the assembler layer first: define an instruction type, write the emission and pretty-printing code
@Richard Zak , link to file?
https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/src/isa/s390x/inst.isle, https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/src/isa/s390x/lower.isle
@Chris Fallin What's in those files? I want to say they look like instructions and parameters, but it somehow seems more than that. And does it need all instructions or a subset? It looks like it also has to handle register flags.
looks lisp like
Looks like everything is in here, starting at page 55 https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv
@Richard Zak that's our DSL for describing pattern-matching backends. I'd recommend starting with the docs at cranelift/isle/docs/language-reference.md
As I mentioned there's very little documentation on how to actually use it to write a backend; my apologies but again we're hard at work actually building the thing still and so haven't managed to fill out a bunch of info on how to come up to speed quickly; you'll need to dig in and read the other backends to learn how things work
we're happy to answer questions you have on the way of course! but I'd start with the doc above and read it thoroughly
Awesome, thank you.
I’ve just gotten my Power9 system up and running and intend to take a closer look at cranelift and isle
Last updated: Dec 23 2024 at 12:05 UTC