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

Reduce cmp and cmp+br instructions #1243

Merged
merged 14 commits into from
Oct 23, 2024
Merged

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Oct 21, 2024

This reduces i{32,64}.{gt,ge}_{s,u} and f{32,64}.{gt,ge} instructions into respective {lt,le} variants.
Fused cmp+br instructions are also affected by the above change.

To support this, new {lt,le} variants with 16-bit immediate lhs values have been added.

Overall this reduces the total amount of Wasmi instructions by 24 which is quite significant.

Local benchmarks show significant improvements across the board:
image

@Robbepop Robbepop marked this pull request as draft October 21, 2024 21:58
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 63.82979% with 204 lines in your changes missing coverage. Please review.

Project coverage is 81.44%. Comparing base (5ec8bb8) to head (a594ada).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/wasmi/src/engine/translator/comparator.rs 44.59% 123 Missing ⚠️
crates/wasmi/src/engine/executor/instrs.rs 30.23% 30 Missing ⚠️
crates/wasmi/src/engine/translator/visit.rs 3.44% 28 Missing ⚠️
...rates/wasmi/src/engine/translator/instr_encoder.rs 79.46% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1243      +/-   ##
==========================================
- Coverage   81.77%   81.44%   -0.34%     
==========================================
  Files         304      304              
  Lines       25144    25036     -108     
==========================================
- Hits        20561    20390     -171     
- Misses       4583     4646      +63     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Robbepop Robbepop marked this pull request as ready for review October 23, 2024 15:29
Copy link

@dkcumming dkcumming left a comment

Choose a reason for hiding this comment

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

I had a bit of trouble with the executor, as I am less experienced at that part, but it I couldn't see anything that looked wrong. The rest of the code ir, executor, instrs, tests I was more thorough and understood better and all looks good to me!

@Robbepop
Copy link
Member Author

Robbepop commented Oct 23, 2024

I had a bit of trouble with the executor, as I am less experienced at that part, but it I couldn't see anything that looked wrong. The rest of the code ir, executor, instrs, tests I was more thorough and understood better and all looks good to me!

Thank you for the code review @dkcumming ! 🚀 Really appreciate it.
You probably meant that you had troubles with the translator, not the executor.

@Robbepop Robbepop merged commit 5bf180b into main Oct 23, 2024
17 of 20 checks passed
@Robbepop Robbepop deleted the rf-remove-unnecessary-cmp-instrs branch October 23, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants