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

Fix the case of an unreachable entry in LocalGraph #6048

Merged
merged 4 commits into from
Oct 24, 2023
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Oct 24, 2023

Followup to #6046 - the fuzzer found we missed handling the case of the entry itself
being unreachable and there being a loop after it, see code and testcase.

Also add a "dump" impl in that file which helps debugging.

@kripken kripken requested a review from tlively October 24, 2023 18:17
@kripken
Copy link
Member Author

kripken commented Oct 24, 2023

Unfortunately this is not enough either... it's possible depending on unreachability here is not the best idea.

edit: there may be a loop later on, that is in effect unreachable even though it has an entry from itself

@kripken
Copy link
Member Author

kripken commented Oct 24, 2023

A proper analysis of unreachability may not be worth it, as it would add overhead that could easily overtake the benefits of this optimization. So I am considering just reverting the previous PR, sadly.

@kripken
Copy link
Member Author

kripken commented Oct 24, 2023

I pushed a proper fix, but still need to measure if the slowdown is worth it.

@kripken
Copy link
Member Author

kripken commented Oct 24, 2023

Sadly this does make us a little slower. Just 1-2% or so, but as the whole point here was an optimization, it makes it not worthwhile. I'll experiment with the other idea of relaxing those assertions.

@kripken
Copy link
Member Author

kripken commented Oct 24, 2023

I pushed a version that relaxes the assertion as @tlively suggested, and am fuzzing it now. It may be the best option here.

@kripken
Copy link
Member Author

kripken commented Oct 24, 2023

This passed 12K fuzzer iterations, so I think it is stable, and is the best solution we have AFAICT.

@kripken kripken merged commit ec8220f into main Oct 24, 2023
@kripken kripken deleted the fix.lg.fast branch October 24, 2023 21:37
kripken added a commit that referenced this pull request Oct 25, 2023
Followup to #6048, we did not handle nondefaultable tuples because of this.
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
…ssembly#6048)

Followup to WebAssembly#6046 - the fuzzer found we missed handling the case of the entry itself
being unreachable, or of an unreachable loop later. Properly identifying unreachable
code requires a flow analysis, unfortunately, so this PR gives up on that and instead
allows LocalGraph to be imprecise in unreachable code. That avoids adding any
overhead, but does mean the IR may be slightly confusing when debugging. It does
not have any optimization downsides, however, as it only affects unreachable code.

Also add a dump() impl in that file which helps debugging.
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
Followup to WebAssembly#6048, we did not handle nondefaultable tuples because of this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants