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

Optimization: Lower load and store operations by pruning types #1302

Closed
Robbepop opened this issue Nov 9, 2024 · 0 comments · Fixed by #1303
Closed

Optimization: Lower load and store operations by pruning types #1302

Robbepop opened this issue Nov 9, 2024 · 0 comments · Fixed by #1303
Labels
optimization An performance optimization issue.

Comments

@Robbepop
Copy link
Member

Robbepop commented Nov 9, 2024

Currently, the wasmi_ir crate supports these load operations among others:

  • {I,F}{32,64}Load
  • {I,F}{32,64}LoadAt
  • {I,F}{32,64}LoadOffset16

As well as the following store operations among others:

  • {F,I}{32,64}Store
  • I{32,64}StoreImm16*
  • {F,I}{32,64}StoreOffset16
  • I{32,64}StoreOffset16Imm16*
  • {F,I}{32,64}StoreAt
  • I{32,64}StoreAtImm16*

(*): The Imm16 postfixed variants cannot be further generlized. The same applies to truncation-stores and extension-loads.

Since Wasmi bytecode is executed without type safety or type checking we could easily lower all of these instructions down to load and store instructions that are just loading and storing a fixed number of bytes instead:

  • Load{32,64}
  • Load{32,64}At
  • Load{32,64}Offset16
  • Store{32,64}
  • Store{32,64}Offset16
  • Store{32,64}At

Effects

  • Replace 24 instructions by just 12 new ones.
  • Simplify Wasmi executor.
  • Reduce pressure on the CPU's instruction cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization An performance optimization issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant