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 v128 misc optimizations #86506

Merged
merged 3 commits into from
May 19, 2023

Conversation

kg
Copy link
Member

@kg kg commented May 19, 2023

  • The encoding I used previously for a v128 zero constant in some places (i64.const 0 + i64 -> v128 splat) isn't optimized by v8, so we can't use it. We're stuck using the enormous v128.const opcode instead.
  • Use v128 loads/stores if available when unrolling memsets and memmoves. This appears to improve performance for the BCL in some spots by a measurable amount, and at least for the moves it reduces code size too. (The sets will get worse thanks to the incredible constant representation; using a temp local might help maybe?)

@kg kg added arch-wasm WebAssembly architecture area-Codegen-Jiterpreter-mono labels May 19, 2023
@kg kg requested a review from kotlarmilos May 19, 2023 16:05
@kg kg requested review from lewing and pavelsavara as code owners May 19, 2023 16:05
@ghost ghost assigned kg May 19, 2023
@ghost
Copy link

ghost commented May 19, 2023

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

Issue Details
  • The encoding I used previously for a v128 zero constant in some places (i64.const 0 + i64 -> v128 splat) isn't optimized by v8, so we can't use it. We're stuck using the enormous v128.const opcode instead.
  • Use v128 loads/stores if available when unrolling memsets and memmoves. This appears to improve performance for the BCL in some spots by a measurable amount, and at least for the moves it reduces code size too. (The sets will get worse thanks to the incredible constant representation; using a temp local might help maybe?)
Author: kg
Assignees: -
Labels:

arch-wasm, area-Codegen-Jiterpreter-mono

Milestone: -

@kg
Copy link
Member Author

kg commented May 19, 2023

Also found a bug in the memset unroller (musl style). Some quick before/after timings:

measurement before after
Span, Reverse bytes 0.0213ms 0.0139ms
Span, Reverse chars 0.0418ms 0.0256ms
Span, IndexOf bytes 0.5535us 0.3193us
Span, IndexOf chars 0.0881ms 0.0164ms
Span, SequenceEqual bytes 0.0326ms 0.0116ms
Span, SequenceEqual chars 0.0651ms 0.0232ms

@kg kg merged commit ed717cd into dotnet:main May 19, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 18, 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