Stream: git-wasmtime

Topic: wasmtime / PR #9874 pulley: Add macro `CallN` instructions


view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2024 at 21:46):

alexcrichton opened PR #9874 from alexcrichton:pulley-callN-instruction to bytecodealliance:main:

This commit adds new macro instructions to assist with speeding up calls between functions. Pulley's previous Call instruction was similar to native call instructions where arguments/results are implicitly in the right location according to the ABI, but movement between registers is more expensive with Pulley than with native architectures. The CallN instructions here enable listing a few arguments (only integer registers) in the opcode itself. This removes the need for individual xmov instructions into individual registers and instead it can all be done within the opcode handlers.

This additionally enables passing the same argument twice to a function to reside only in one register. Finally parallel-copies between these registers are supported as the interpreter loads all registers and then stores all registers.

These new instructions participate in register allocation differently from before where the first few arguments are allowed to be in any register and no longer use reg_fixed_use. All other arguments (and all float arguments for example) continue to use reg_fixed_use.

Locally sightglass reports this change speeding up pulldown-cmark by 2-10%. On a fib(N) micro-benchmark it didn't help as much as I was hoping that it was going to.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2024 at 21:46):

alexcrichton requested abrown for a review on PR #9874.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2024 at 21:46):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9874.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2024 at 21:46):

alexcrichton requested wasmtime-default-reviewers for a review on PR #9874.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2024 at 23:44):

github-actions[bot] commented on PR #9874:

Subscribe to Label Action

cc @cfallin, @fitzgen

<details>
This issue or pull request has been labeled: "cranelift", "cranelift:area:machinst", "cranelift:meta", "isle", "pulley"

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

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

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 01:49):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 01:49):

fitzgen created PR review comment:

Do we not have a fallback instruction for the n >= 5 case?

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 01:49):

fitzgen created PR review comment:

Ahhhh, I see what's going on. Argument i for i >= 5 are in fixed registers and arguments i <= 4 go in any register and that is encoded in the call instructions. Clever.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 16:00):

alexcrichton updated PR #9874.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 16:00):

alexcrichton has enabled auto merge for PR #9874.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 16:54):

alexcrichton merged PR #9874.


Last updated: Dec 23 2024 at 12:05 UTC