Stream: cranelift

Topic: power9


view this post on Zulip Yehowshua Immanuel (Apr 11 2022 at 03:56):

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?

view this post on Zulip Chris Fallin (Apr 11 2022 at 16:27):

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!

view this post on Zulip Yehowshua Immanuel (Apr 12 2022 at 00:49):

Thanks. I'm sure I'll have more questions soon!

view this post on Zulip Yehowshua Immanuel (Apr 12 2022 at 00:50):

I'm starting to wonder where on earth you guys were able to test an s390x!!

view this post on Zulip Yehowshua Immanuel (Apr 12 2022 at 00:51):

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

view this post on Zulip Yehowshua Immanuel (Apr 12 2022 at 00:53):

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...

view this post on Zulip Anton Kirilov (Apr 12 2022 at 13:40):

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.

view this post on Zulip Ulrich Weigand (Apr 12 2022 at 15:57):

@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

view this post on Zulip Richard Zak (Aug 02 2022 at 20:42):

@Yehowshua Immanuel How's the Power9 progress?

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 20:50):

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

A Rust VCD parser intended to be the backend of a Waveform Viewer(built in egui) that supports dynamically loaded rust plugins. - GitHub - ThePerfectComputer/FastWave: A Rust VCD parser intended to...

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 20:50):

But I think I'll get back to cranelift when that's done. @Richard Zak - are you interested in POWER9 for crane lift?

view this post on Zulip Richard Zak (Aug 02 2022 at 20:56):

I am interested, and was thinking about getting a Raptor Talos II. What machine did you have?

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 21:25):

I had a Talos - I just sold it two weeks ago - I would have totally sold it to you too

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 21:27):

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

In case you need to use a BrosTrend 650Mbps Linux WiFi Adapter with your POWER9 machine. - GitHub - BracketMaster/rtl8821cu-5.12.0-void-linux-ppc: In case you need to use a BrosTrend 650Mbps Linux ...

view this post on Zulip Richard Zak (Aug 02 2022 at 21:31):

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?

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 22:13):

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.

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 22:15):

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

view this post on Zulip Yehowshua Immanuel (Aug 02 2022 at 22:17):

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

view this post on Zulip Richard Zak (Aug 02 2022 at 22:47):

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).

view this post on Zulip Richard Zak (Aug 05 2022 at 22:58):

@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.

view this post on Zulip Chris Fallin (Aug 05 2022 at 23:30):

@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

view this post on Zulip Chris Fallin (Aug 05 2022 at 23:31):

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

view this post on Zulip Chris Fallin (Aug 05 2022 at 23:31):

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

view this post on Zulip Chris Fallin (Aug 05 2022 at 23:33):

I would recommend starting with the assembler layer first: define an instruction type, write the emission and pretty-printing code

view this post on Zulip Yehowshua Immanuel (Aug 05 2022 at 23:42):

@Richard Zak , link to file?

view this post on Zulip Richard Zak (Aug 05 2022 at 23:45):

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

A standalone runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.
A standalone runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Richard Zak (Aug 05 2022 at 23:49):

@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.

view this post on Zulip Yehowshua Immanuel (Aug 05 2022 at 23:58):

looks lisp like

view this post on Zulip Richard Zak (Aug 06 2022 at 00:07):

Looks like everything is in here, starting at page 55 https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv

view this post on Zulip Chris Fallin (Aug 06 2022 at 00:24):

@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

view this post on Zulip Chris Fallin (Aug 06 2022 at 00:25):

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

view this post on Zulip Chris Fallin (Aug 06 2022 at 00:26):

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

view this post on Zulip Richard Zak (Aug 06 2022 at 00:28):

Awesome, thank you.

view this post on Zulip Richard Zak (Sep 18 2022 at 02:03):

I’ve just gotten my Power9 system up and running and intend to take a closer look at cranelift and isle


Last updated: Nov 22 2024 at 17:03 UTC