Skip to content

pulley: Add some macro-instructions related to bounds-checks#9943

Merged
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:pulley-bounds-check-macro-op
Jan 8, 2025
Merged

pulley: Add some macro-instructions related to bounds-checks#9943
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:pulley-bounds-check-macro-op

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit starts down the path of optimizing wasm loads/stores in Pulley with macro-instructions. It's expected that these instructions are so common that it's worth putting them in the 1-byte namespace of opcodes.

Locally this gets a 10% speedup on the sightglass bz2 benchmark.

This commit starts down the path of optimizing wasm loads/stores in
Pulley with macro-instructions. It's expected that these instructions
are so common that it's worth putting them in the 1-byte namespace of
opcodes.

Locally this gets a 10% speedup on the sightglass bz2 benchmark.
@alexcrichton alexcrichton requested review from a team as code owners January 7, 2025 20:07
@alexcrichton alexcrichton requested review from abrown and fitzgen and removed request for a team January 7, 2025 20:07
@alexcrichton
Copy link
Copy Markdown
Member Author

This additionally shrinks spidermonkey.cwasm from 28M to 21M

@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator pulley Issues related to the Pulley interpreter labels Jan 8, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 8, 2025

Subscribe to Label Action

cc @fitzgen

Details This issue or pull request has been labeled: "cranelift", "pulley"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: pulley

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

;; wasm[0]::function[0]::load8:
;; push_frame
;; xload32le_offset8 x6, x0, 52
;; br_if_xulteq32 x6, x2, 0x14 // target = 0x19
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't want this one to use the new xbc macro-op?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No we probably do but I wanted to add this here for complete-ness to show that it's not currently using the new op. One-byte loads/stores are generated a bit differently with bounds checks and use a >= condition instead of > + arithmetic to test whether something is out of bounds. That made it so it doesn't fall into the patterns I added and would need a specific opcode just for the one-byte access. I figured it's probably fine to leave that off for now and add in the future if necessary

@alexcrichton alexcrichton added this pull request to the merge queue Jan 8, 2025
Merged via the queue into bytecodealliance:main with commit b6527cf Jan 8, 2025
@alexcrichton alexcrichton deleted the pulley-bounds-check-macro-op branch January 8, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift Issues related to the Cranelift code generator pulley Issues related to the Pulley interpreter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants