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

[wasm] More accurate jiterpreter cfg size estimation; generate smaller dispatch tables #83759

Merged
merged 5 commits into from
Mar 23, 2023

Conversation

kg
Copy link
Member

@kg kg commented Mar 22, 2023

The monitoring pass's addition of a back branch flag made the cfg size estimation less accurate, so this PR mostly fixes that. There is still a bit of underestimation for a few traces I haven't tracked down but for s.r.t I see it maybe underestimate 5 traces in total out of thousands, and it's not off by too much.

This PR also changes the dispatch table generator to only generate dispatch entries for back branch targets specifically (it used to generate them for all branch targets, which is wasteful and incorrect).

Currently if a trace managed to hit the 4kb limit despite our best efforts, we would try to compile it anyway and then fail, which would eventually cause the jiterpreter to be disabled. This PR adds an explicit check for that and logs a warning instead with the name of the trace, which will avoid scenarios where a whole application falls off a cliff due to a couple bad traces.

kg added 3 commits March 21, 2023 18:45
Generate smaller dispatch tables for traces with backward branches
… it. Just log a warning

Lower the generated limit slightly
@ghost
Copy link

ghost commented Mar 22, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

The monitoring pass's addition of a back branch flag made the cfg size estimation less accurate, so this PR mostly fixes that. There is still a bit of underestimation for a few traces I haven't tracked down but for s.r.t I see it maybe underestimate 5 traces in total out of thousands, and it's not off by too much.

This PR also changes the dispatch table generator to only generate dispatch entries for back branch targets specifically (it used to generate them for all branch targets, which is wasteful and incorrect).

Currently if a trace managed to hit the 4kb limit despite our best efforts, we would try to compile it anyway and then fail, which would eventually cause the jiterpreter to be disabled. This PR adds an explicit check for that and logs a warning instead with the name of the trace, which will avoid scenarios where a whole application falls off a cliff due to a couple bad traces.

Author: kg
Assignees: -
Labels:

arch-wasm, area-Codegen-Jiterpreter-mono

Milestone: -

@ghost ghost assigned kg Mar 22, 2023
@kg kg merged commit 1e241c0 into dotnet:main Mar 23, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants