Stream: cranelift

Topic: ✔ Testing New Optimizations


view this post on Zulip Bongjun Jang (Dec 31 2024 at 00:56):

Thank you for your response!

view this post on Zulip Bongjun Jang (Dec 31 2024 at 00:58):

One more thing) Is there a way to know which optimization is on/off? I want to know the progress of cranelift's optimization.

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:00):

Right now there is one main switch: the opt_level option is set either to speed or none, and that turns on/off the entire optimizer

view this post on Zulip Bongjun Jang (Dec 31 2024 at 01:10):

Oh thank you. And how do I check if an optimization rule written in ISLE under cranelift/codegen/src/opts/ is actually compiled down to cranelift compiler? I want to measure the number of rules that the ISLE compiler is accepting.

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:10):

All are included; the ISLE compiler doesn't have any notion of not "accepting" a rule

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:11):

(it does have type errors, but then the entire Cranelift build fails)

view this post on Zulip Bongjun Jang (Dec 31 2024 at 01:14):

https://github.com/bytecodealliance/wasmtime/blob/cb51a4f2137edb90b213d9f30d94b02797d45fc5/cranelift/codegen/src/opts/arithmetic.isle#L78-L82

So this rule is actually included in the islec-compiled compiler code, but the generated compiler is not optimizing my program. Am I correct?

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

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:19):

Ah, yes, there is some subtlety here. I took "included" to mean that the rule is compiled and included in Cranelift. That rule is indeed included in Cranelift. However the entry point for rule execution is not invoked on trapping operators, for the reasons given in that issue above.

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:20):

So the rule is "included" but never executed

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:20):

I suppose it's some future-proofing? I'm not sure why we included it otherwise

view this post on Zulip Bongjun Jang (Dec 31 2024 at 01:22):

Thank you. I think now it is clear to me. Have a good rest of your day!

view this post on Zulip Notification Bot (Dec 31 2024 at 01:22):

Bongjun Jang has marked this topic as resolved.

view this post on Zulip Chris Fallin (Dec 31 2024 at 01:22):

No problem, you as well!


Last updated: Jan 24 2025 at 00:11 UTC