Stream: cranelift

Topic: Cranelift egraphs in action


view this post on Zulip Alex Crichton (Jun 25 2024 at 21:16):

I stumbled across https://github.com/tkaitchuck/aHash/issues/222 today and using Afonso's freshly-added support to the compiler explorer whipped up https://godbolt.org/z/j6YEv81MM to show how cranelift's doing quite a good job relative native by eating through all the swap_bytes expansions that llvm inserts

Unfortunately neither u128 nor swap_bytes are supported directly by WebAssembly. So both implementations of folded_multiply are very slow. I think an algorithm that takes both u64 values, turns the...
Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.

view this post on Zulip Alex Crichton (Jun 25 2024 at 21:16):

just figured it was neat and wanted to share

view this post on Zulip Afonso Bordado (Jun 25 2024 at 21:18):

Super neat being able to see all of this in a single screen!

view this post on Zulip fitzgen (he/him) (Jun 25 2024 at 21:24):

nice :)

view this post on Zulip Till Schneidereit (Sep 08 2024 at 13:35):

I completely randomly stumbled upon this just now, and then additionally stumbled upon the fact that the Wasmtime output is pretty different with Wasmtime 22—the latest version available on Godbolt: https://godbolt.org/z/3W8j8MG9n

It looks like maybe that's just a matter of more details being printed? I have no idea where the wasm_to_array_trampoline comes from, though

Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.

view this post on Zulip Afonso Bordado (Sep 08 2024 at 15:26):

I have no idea where the wasm_to_array_trampoline comes from, though

Oh, when we compile wasm in godbolt we compile it into a binary and then dissasemble it. We then filter out some of the trampoline functions that wasmtime includes in the binary, that must be broken somehow.

view this post on Zulip Till Schneidereit (Sep 09 2024 at 12:15):

ah, that makes sense—thank you!


Last updated: Dec 23 2024 at 12:05 UTC