Skip to content

Conversation

@kg
Copy link
Member

@kg kg commented Jan 5, 2023

This PR adds a configurable quota to the jiterpreter that will stop it from generating more code once a total number of WASM bytes is hit. For some degenerate cases (like massive test suites) we could otherwise end up generating a truckload of modules and potentially hit corner cases in the browser or exhaust memory.

At present System.Runtime.Tests generates around 2 megabytes of WASM in a full run with everything turned on, which is (IMO) pretty reasonable, but also shows how bad it could get. For AOT applications we are way less likely to approach the quota

I also adjusted some of the jiterpreter tuning parameters in this PR. The current ones in main (chosen arbitrarily at the time) cause S.T.J's test suite to be slower than w/o the jiterpreter in some cases, and these adjustments bring its execution times back in line with normal. (It should really be faster, but I believe this is a degenerate case and it is faster in browser-bench.) At some point we'll want to more aggressively evaluate what the right values for these parameters are, but for now I think this is an improvement.

@kg kg added the arch-wasm WebAssembly architecture label Jan 5, 2023
@ghost
Copy link

ghost commented Jan 5, 2023

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

Issue Details

This PR adds a configurable quota to the jiterpreter that will stop it from generating more code once a total number of WASM bytes is hit. For some degenerate cases (like massive test suites) we could otherwise end up generating a truckload of modules and potentially hit corner cases in the browser or exhaust memory.

At present System.Runtime.Tests generates around 2 megabytes of WASM in a full run with everything turned on, which is (IMO) pretty reasonable, but also shows how bad it could get. For AOT applications we are way less likely to approach the quota

I also adjusted some of the jiterpreter tuning parameters in this PR. The current ones in main (chosen arbitrarily at the time) cause S.T.J's test suite to be slower than w/o the jiterpreter in some cases, and these adjustments bring its execution times back in line with normal. (It should really be faster, but I believe this is a degenerate case and it is faster in browser-bench.) At some point we'll want to more aggressively evaluate what the right values for these parameters are, but for now I think this is an improvement.

Author: kg
Assignees: -
Labels:

arch-wasm

Milestone: -

@kg kg merged commit 9f515ff into dotnet:main Jan 6, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants