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 jiterpreter cleanup and bug fixes pt. 3 #78782

Merged
merged 12 commits into from
Dec 2, 2022

Conversation

kg
Copy link
Contributor

@kg kg commented Nov 23, 2022

Blocks #78428

  • Fix semantics of floating point relops in the jiterpreter. This only causes test failures when the new tier_instantly option is enabled.
  • Unroll memmoves in the jiterpreter like memsets in the previous PR
  • Turn interp_exec_method back into a static function, and move jiterp code around to enable it to still work. This seems to arbitrarily change the performance of the interpreter (mostly for the worse, but positively on some test cases) on all platforms for some reason even though it shouldn't.

@ghost
Copy link

ghost commented Nov 23, 2022

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

Issue Details

Blocks #78428

  • Add new runtime "tier instantly" option that causes interpreter tiering and jiterpreter compilation to be triggered instantly for testing/troubleshooting
  • Fix semantics of floating point relops in the jiterpreter. This only causes test failures when the new tier_instantly option is enabled.
  • Unroll memmoves in the jiterpreter like memsets in the previous PR
Author: kg
Assignees: -
Labels:

arch-wasm

Milestone: -

@ghost
Copy link

ghost commented Nov 23, 2022

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

Issue Details

Blocks #78428

  • Add new runtime "tier instantly" option that causes interpreter tiering and jiterpreter compilation to be triggered instantly for testing/troubleshooting
  • Fix semantics of floating point relops in the jiterpreter. This only causes test failures when the new tier_instantly option is enabled.
  • Unroll memmoves in the jiterpreter like memsets in the previous PR
Author: kg
Assignees: -
Labels:

arch-wasm, area-Codegen-Interpreter-mono

Milestone: -

if (!isF64)
builder.appendU8(intrinsicFpBinop);
builder.i32_const(<any>opcode);
builder.callImport("relop_fp");
Copy link
Member

Choose a reason for hiding this comment

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

Do I understand correctly this is call from generated wasm into main wasm file ? is this expensive ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's calling into dotnet.wasm - in this case, mono_jiterp_relop_fp. It is somewhat expensive, but the alternative is painful. In the long run if the performance of these comparisons was sensitive we'd generate all the ordering comparison logic inline.

// in the correct place and compute the stack offset, then it passes that in to this
// function in order to actually enter the interpreter and process the return value
EMSCRIPTEN_KEEPALIVE void
mono_jiterp_interp_entry (JiterpEntryData *_data, stackval *sp_args, void *res)
Copy link
Member

Choose a reason for hiding this comment

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

Another option here would have been to make interp_exec_method static again as it was before the original jiterpreter commit and then have a global mono_interp_exec_method that calls it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to change it? I originally had a wrapper like you describe, but the performance impact was measurable so that's how we ended up here. I might be able to get it to inline though, I don't think I spent much time trying when I was first prototyping.

@kg kg merged commit 5a7d46b into dotnet:main Dec 2, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 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