Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard recursion in will_simplify_with_ireduce #7882

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

elliottt
Copy link
Member

@elliottt elliottt commented Feb 7, 2024

Expose the underlying issue of #7874 by adding a test with a long chain of additions, and then fix the bug by bounding the recursion of will_simplify_with_ireduce.

Reading through the changes in #7719, it seemed like the recursive cases in will_simplify_with_ireduce were missing two things:

  1. an additional guard of reducible_modular_op before the recursion, which showed up in the entry-point in simplify
  2. a depth bound to ensure that the recursion doesn't get out of control.

This PR makes both of these changes, and resolves the compilation time issues reported in #7874. The depth bound was arbitrary, and it would be fine to increase it if necessary.

Fixes #7874

Add a test to expose issues with unbounded recursion through `iadd`
during egraph rewrites, and bound the recursion of
`will_simplify_with_ireduce`.

Fixes bytecodealliance#7874

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
@elliottt elliottt marked this pull request as ready for review February 7, 2024 00:58
@elliottt elliottt requested a review from a team as a code owner February 7, 2024 00:58
@elliottt elliottt requested review from fitzgen and alexcrichton and removed request for a team February 7, 2024 00:58
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language labels Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@fitzgen fitzgen added this pull request to the merge queue Feb 7, 2024
Merged via the queue into bytecodealliance:main with commit 74a303a Feb 7, 2024
19 checks passed
elliottt added a commit to elliottt/wasmtime that referenced this pull request Feb 7, 2024
Add a test to expose issues with unbounded recursion through `iadd`
during egraph rewrites, and bound the recursion of
`will_simplify_with_ireduce`.

Fixes bytecodealliance#7874

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
elliottt added a commit that referenced this pull request Feb 7, 2024
Add a test to expose issues with unbounded recursion through `iadd`
during egraph rewrites, and bound the recursion of
`will_simplify_with_ireduce`.

Fixes #7874

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
elliottt added a commit to elliottt/wasmtime that referenced this pull request Feb 7, 2024
Add a test to expose issues with unbounded recursion through `iadd`
during egraph rewrites, and bound the recursion of
`will_simplify_with_ireduce`.

Fixes bytecodealliance#7874

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
elliottt added a commit that referenced this pull request Feb 7, 2024
* Guard recursion in `will_simplify_with_ireduce` (#7882)

Add a test to expose issues with unbounded recursion through `iadd`
during egraph rewrites, and bound the recursion of
`will_simplify_with_ireduce`.

Fixes #7874

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>

* Cranelift: Use a fixpoint loop to compute the best value for each eclass (#7859)

* Cranelift: Use a fixpoint loop to compute the best value for each eclass

Fixes #7857

* Remove fixpoint loop early-continue optimization

* Add document describing optimization rule invariants

* Make select optimizations use subsume

* Remove invalid debug assert

* Remove now-unused methods

* Add commutative adds to cost tests

* Add missing subsume uses in egraph rules (#7879)

* Fix a few egraph rules that needed `subsume`

There were a few rules that dropped value references from the LHS
without using subsume. I think they were probably benign as they
produced constant results, but this change is in the spirit of our
revised guidelines for egraph rules.

* Augment egraph rule guideline 2 to talk about constants

* Update release notes

---------

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasmtime 17 hangs while trying to load wasm file
2 participants