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] Outline exception throws in the interp and ifdef out unreachable opcodes #79239

Merged
merged 15 commits into from
Dec 14, 2022

Conversation

kg
Copy link
Contributor

@kg kg commented Dec 5, 2022

In my testing it improves performance if we outline exception throwing logic and don't include cases for unreachable opcodes. Based on a dump of the resulting dotnet.wasm module, this makes interp_exec_method ~3kb smaller and reduces the nesting depth by a bit as well.

According to my local browser-bench runs this makes the interpreter much faster for some workloads - I saw a consistent 1ms speed-up on some of the JSON test cases. My assumption is that interp_exec_method is big enough and complex enough that we are falling off performance cliffs and this somehow gets us back up one of the cliffs.

For unreachable opcodes the solution used here is to define a new IROPDEF category for opcodes that are meant for internal use and not meant to be executed - they all get moved to the end of the list and don't need cases defined or entries in the computed goto table, which makes interp_exec_method a bit smaller as well.

There are other opcodes that would benefit from this but I found that changing them caused weird test failures, so we can do that later.

@kg kg added arch-wasm WebAssembly architecture and removed area-Codegen-Interpreter-mono labels Dec 5, 2022
@ghost ghost assigned kg Dec 5, 2022
@ghost
Copy link

ghost commented Dec 5, 2022

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

Issue Details

In my testing it improves performance if we outline exception throwing logic and don't include cases for unreachable opcodes. Based on a dump of the resulting dotnet.wasm module, this makes interp_exec_method ~3kb smaller and reduces the nesting depth by a bit as well.

According to my local browser-bench runs this makes the interpreter much faster for some workloads - I saw a consistent 1ms speed-up on some of the JSON test cases. My assumption is that interp_exec_method is big enough and complex enough that we are falling off performance cliffs and this somehow gets us back up one of the cliffs.

Author: kg
Assignees: kg
Labels:

arch-wasm

Milestone: -

@ghost
Copy link

ghost commented Dec 5, 2022

Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.

Issue Details

In my testing it improves performance if we outline exception throwing logic and don't include cases for unreachable opcodes. Based on a dump of the resulting dotnet.wasm module, this makes interp_exec_method ~3kb smaller and reduces the nesting depth by a bit as well.

According to my local browser-bench runs this makes the interpreter much faster for some workloads - I saw a consistent 1ms speed-up on some of the JSON test cases. My assumption is that interp_exec_method is big enough and complex enough that we are falling off performance cliffs and this somehow gets us back up one of the cliffs.

Author: kg
Assignees: kg
Labels:

arch-wasm, area-Codegen-Interpreter-mono

Milestone: -

@kg kg marked this pull request as ready for review December 8, 2022 07:52
@kg kg merged commit d316bb4 into dotnet:main Dec 14, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jan 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants