Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Oct 15, 2024

This can help find errors in the middle of passes like Inlining, that do
multiple cycles and include optimizations in the middle.

@kripken kripken requested review from aheejin and tlively October 15, 2024 23:26
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

Should we do this only for higher PassDebug levels to avoid affecting the pass timings reported at level 1?

@aheejin
Copy link
Member

aheejin commented Oct 15, 2024

Do we need to do the check also before the optimization, not only after it? In that case, if we run the optimization function multiple times, wouldn't we run the optimization twice on the same input after an iteration and before the next iteration?

@kripken
Copy link
Member Author

kripken commented Oct 15, 2024

@aheejin It could be wasteful in that case, yeah. But the existing passes call it once in each iteration, so we do something like "inline some functions, optimize, inline some more functions, optimize", and for that it makes sense to check for errors both in the inlining and in the optimizations. (And while that is slower, pass-debug mode is where we do the slowest checks.)

@kripken
Copy link
Member Author

kripken commented Oct 16, 2024

@tlively

Should we do this only for higher PassDebug levels to avoid affecting the pass timings reported at level 1?

Hmm, that's a good question. It does seem bad to add to those timings, but mode 1 is the one most tested and fuzzed. I'll think some more, maybe there's a good way to avoid this problem.

@kripken
Copy link
Member Author

kripken commented Oct 16, 2024

@tlively I can't think of a better solution than your idea to do this in level 2+, so I switched to that. It is nice and simple and captures almost all the benefits without that timing downside.

@kripken kripken merged commit d13c262 into WebAssembly:main Oct 16, 2024
14 checks passed
@kripken kripken deleted the opt-utils.debug branch October 16, 2024 18:08
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.

3 participants