-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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] New jiterpreter backbranch scan pass #98530
Conversation
…jiterpreter-trace-generator as a prepass Unify branch decoding to use mono_jiterp_get_opcode_info
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsInterpreted SequenceEqual got slower in WASM (according to browser-bench) after #96315, which was my fault due to the back branch implementation in the jiterpreter being too complicated. It's still going to be too complicated, but this PR should fix the regression. Specifically, the interpreter and jiterpreter were disagreeing slightly on where a back-branch was pointing - this disagreement would not cause a crash or incorrect behavior, but would cause the jiterpreter to not compile the backward branch.
Overall this should ensure that the jiterpreter is able to handle back-branches for any branch opcode it supports (it still doesn't support some of the obscure branch opcodes, I think). I verified that it no longer fails to generate back branches for the benchmarks in question, but I can't easily verify whether this might cause regressions in other traces as a result of the newly-visible back branches making traces get too large.
|
S.T.J tests in browser-on-windows are OOMing near the end of the run, which is probably not caused by this but I'll look into it anyway. My guess is that test is just really heavy and has some sort of leak, since it's near the end and doesn't happen on Linux. |
The STJ tests look like they do have some sort of a leak - they hit ~1GB of browser tab memory usage by the time they hit the 3MB write tests, and the tab process peaks at around 1.2GB. But that's still not remotely up against the normal limits of a browser tab process on a modern x64 machine, and I don't think I caused that to regress. My guess is something is eating up memory on the build VMs, probably the msbuild/roslyn compiler server instances. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea what was the actual problem with the previous code computation ?
It looks like the offsets it calculated were specifically wrong when the branch target was right next to a jiterpreter entry point. |
Interpreted SequenceEqual got slower in WASM (according to browser-bench) after #96315, which was my fault due to the back branch implementation in the jiterpreter being too complicated. It's still going to be too complicated, but this PR should fix the regression. Specifically, the interpreter and jiterpreter were disagreeing slightly on where a back-branch was pointing - this disagreement would not cause a crash or incorrect behavior, but would cause the jiterpreter to not compile the backward branch.
backward_branch_offsets
table stored in InterpMethod that was used by the jiterpreter.Overall this should ensure that the jiterpreter is able to handle back-branches for any branch opcode it supports (it still doesn't support some of the obscure branch opcodes, I think). I verified that it no longer fails to generate back branches for the benchmarks in question, but I can't easily verify whether this might cause regressions in other traces as a result of the newly-visible back branches making traces get too large.