Stream: cranelift

Topic: Interleaving `Inst` and `Value` nodes?


view this post on Zulip Bongjun Jang (Oct 19 2025 at 10:55):

Hi, I'm interested in writing an optimization (((X / Y) = N) = ((Y * N) = X)) in ISLE.
The left-hand side will have something like (icmp (IntCC.Equal) (udiv x y) ...).
However, the problem is that the udiv term yields an Inst node while the icmp term requires Value nodes as operands.
It makes writing such a rule very difficult.

Is there any walkaround possible in ISLE? Thank you!

view this post on Zulip Chris Fallin (Oct 20 2025 at 00:14):

It looks like there is some glue missing here:

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant - bytecodealliance/wasmtime
A lightweight WebAssembly runtime that is fast, secure, and standards-compliant - bytecodealliance/wasmtime
A lightweight WebAssembly runtime that is fast, secure, and standards-compliant - bytecodealliance/wasmtime

view this post on Zulip Chris Fallin (Oct 20 2025 at 00:15):

Feel free to do so as part of an upcoming PR if you have one, or separately and tag me for review, either way.

view this post on Zulip Chris Fallin (Oct 20 2025 at 00:17):

(and, goes without saying but: thank you for continuing to work on optimizations of this sort! the slow but steady improvements to our codegen are greatly appreciated)

view this post on Zulip Bongjun Jang (Oct 20 2025 at 00:52):

Thank you for the detailed answer! I'm trying to generate valid ISLE rules as many as possible.

For that you mentioned improvements for cranelift's codegen,
I wonder if we can precisely measure the improvements on generated code, and the compilation overhead. At the moment, I can think of running cranelift on some benchmarks and measure the time spent. Is there any established method for Cranelift per se?

view this post on Zulip Chris Fallin (Oct 20 2025 at 04:14):

We normally use Sightglass for that; see this part of the readme in particular showing how to build two different .sos from Wasmtime and compare them

A benchmark suite and tool to compare different implementations of the same primitives. - bytecodealliance/sightglass
A benchmark suite and tool to compare different implementations of the same primitives. - bytecodealliance/sightglass

view this post on Zulip Chris Fallin (Oct 20 2025 at 04:15):

the benchmark suite still isn't super-well filled out, but at least will give you something. Typically the numbers that are most interesting to the core Cranelift folks are the non-microbenchmarks, which more or less is the default suite plus maybe regex and blake3-*

A benchmark suite and tool to compare different implementations of the same primitives. - bytecodealliance/sightglass

view this post on Zulip Bongjun Jang (Oct 20 2025 at 04:38):

Thank you very much. I hope the improved codegen can make some change. I'll try the benchamrks.


Last updated: Dec 06 2025 at 07:03 UTC