Stream: git-wasmtime

Topic: wasmtime / PR #13390 Cranelift: add "fuel" to egraph rewr...


view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 17:59):

cfallin opened PR #13390 from cfallin:egraph-fuel to bytecodealliance:main:

This addresses the kind of blowup seen in #13068 (and analyzed in #13204). Specifically, even though we limit the rewrite depth, and size of eclasses, one can still get into situations where the Cartesian product of match possibilities on the left-hand side blows up.

The ISLE rules in the mid-end are compiled to Rust that loops over iterators over each eclass, so if we limit what those iterators can return, we can limit the only dynamic factor in the runtime of the ruleset. This PR implements "fuel" that imposes a hard cutoff of 500 LHS matches per top-level rewrite invocation, with iterators returning None afterward. The mid-end failing to find a match is always OK -- it just means that we don't rewrite/optimize -- so cutting off early is always a correct/valid choice.

The cutoff limit of 500 might seem a little high at first glance, but note that this is every LHS match; including e.g. in sub-matchers; 50 turned out to miss a few rewrites in our tests, so I turned the knob up to 500. This is still sufficient to limit the blowup case shown in #13068 from 2.31s to 0.01s, with RSS decreasing from 855 MiB to 17 MiB, which is a significant win.

Fixes #13204.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 17:59):

cfallin requested fitzgen for a review on PR #13390.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 17:59):

cfallin requested wasmtime-compiler-reviewers for a review on PR #13390.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 21:03):

github-actions[bot] added the label cranelift on PR #13390.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 21:24):

:thumbs_up: fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 21:24):

:speech_balloon: fitzgen created PR review comment:

Maybe call this EXTRACTOR_FUEL? I think that makes the underlying mechanism more clear.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 22:37):

cfallin updated PR #13390.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 22:37):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 22:37):

:speech_balloon: cfallin created PR review comment:

Done!

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 22:37):

cfallin has enabled auto merge for PR #13390.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 22:47):

cfallin added PR #13390 Cranelift: add "fuel" to egraph rewrites. to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 23:12):

:check: cfallin merged PR #13390.

view this post on Zulip Wasmtime GitHub notifications bot (May 15 2026 at 23:12):

cfallin removed PR #13390 Cranelift: add "fuel" to egraph rewrites. from the merge queue


Last updated: Jun 01 2026 at 09:49 UTC