-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Wasmtime: Add support for Wasm tail calls #6774
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
One thing I might recommend doing though is to push a commit with prtest:full
which enables tail calls by default. That'll help weed out any lingering issues and the commit can be backed out before landing to keep it off-by-default in tree
Subscribe to Label Actioncc @fitzgen, @peterhuene, @saulecabrera
This issue or pull request has been labeled: "cranelift", "cranelift:wasm", "fuzzing", "wasmtime:api", "wasmtime:config", "winch"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
To modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
Doing a |
1428982
to
0687b24
Compare
Tracked down the riscv64 failure as #6780 |
a40f04e
to
b75b108
Compare
Looks like it is just s390x that is failing |
This adds the `Config::wasm_tail_call` method and `--wasm-features tail-call` CLI flag to enable the Wasm tail calls proposal in Wasmtime. This PR is mostly just plumbing and enabling tests, since all the prerequisite work (Wasmtime trampoline overhauls and Cranelift tail calls) was completed in earlier pull requests. When Wasm tail calls are enabled, Wasm code uses the `tail` calling convention. The `tail` calling convention is known to cause a 1-7% slow down for regular code that isn't using tail calls, which is why it isn't used unconditionally. This involved shepherding `Tunables` through to Wasm signature construction methods. The eventual plan is for the `tail` calling convention to be used unconditionally, but not until the performance regression is addressed. This work is tracked in bytecodealliance#6759 Additionally while our x86-64, aarch64, and riscv64 backends support tail calls, the s390x backend does not support them yet. Attempts to use tail calls on s390x will return errors. Support for s390x is tracked in bytecodealliance#6530
Instead of passing as an argument to every `Compiler` method.
b75b108
to
82b7774
Compare
Hm looks like there is actually a second riscv64 bug lurking here. |
They still use `jalr` instead of `jal` but this allows us to use the `RiscvCall` reloc, which Wasmtime handles. Before we were using `LoadExternalName` which produces an `Abs8` reloc, which Wasmtime intentionally does not handle since that involves patching code at runtime, which makes loading code slower.
6c0d1b0
to
749b523
Compare
Support for the tail-call proposal landed in bytecodealliance/wasmtime#6774
Support for the tail-call proposal landed in bytecodealliance/wasmtime#6774
* main: (47 commits) Add core dump support to the runtime (bytecodealliance#6513) Resource table tracks child relationships (bytecodealliance#6779) Wasmtime: Move `OnDemandInstanceAllocator` to its own module (bytecodealliance#6790) wasi: Test the stdio streams implementation (bytecodealliance#6764) Don't generate same-named imports in fact modules (bytecodealliance#6783) Wasmtime: Add support for Wasm tail calls (bytecodealliance#6774) Cranelift: Fix `ABIMachineSpec::gen_add_imm` for riscv64 (bytecodealliance#6780) Update the wasm-tools family of crates, disallow empty component types (bytecodealliance#6777) Fix broken link to WASI API documentation (bytecodealliance#6775) A bunch of cleanups for cranelift-codegen-meta (bytecodealliance#6772) Implement component-to-component calls with resources (bytecodealliance#6769) Ignore async_stack_size if async_support is disabled (bytecodealliance#6771) A bunch of minor cleanups (bytecodealliance#6767) Fix flaky tests in preview2 streams (bytecodealliance#6763) Refactor and simplify component trampolines (bytecodealliance#6751) Cranelift: Implement tail calls on riscv64 (bytecodealliance#6749) WASI Preview 2: rewrite streams and pollable implementation (bytecodealliance#6556) cranelift-wasm: Add support for translating Wasm tail calls to CLIF (bytecodealliance#6760) Cranelift: Get tail calls working on aarch64 (bytecodealliance#6723) Implement component model resources in Wasmtime (bytecodealliance#6691) ...
* Wasmtime: Add support for Wasm tail calls This adds the `Config::wasm_tail_call` method and `--wasm-features tail-call` CLI flag to enable the Wasm tail calls proposal in Wasmtime. This PR is mostly just plumbing and enabling tests, since all the prerequisite work (Wasmtime trampoline overhauls and Cranelift tail calls) was completed in earlier pull requests. When Wasm tail calls are enabled, Wasm code uses the `tail` calling convention. The `tail` calling convention is known to cause a 1-7% slow down for regular code that isn't using tail calls, which is why it isn't used unconditionally. This involved shepherding `Tunables` through to Wasm signature construction methods. The eventual plan is for the `tail` calling convention to be used unconditionally, but not until the performance regression is addressed. This work is tracked in bytecodealliance#6759 Additionally while our x86-64, aarch64, and riscv64 backends support tail calls, the s390x backend does not support them yet. Attempts to use tail calls on s390x will return errors. Support for s390x is tracked in bytecodealliance#6530 * Store `Tunables` inside the `Compiler` Instead of passing as an argument to every `Compiler` method. * Cranelift: Support "direct" return calls on riscv64 They still use `jalr` instead of `jal` but this allows us to use the `RiscvCall` reloc, which Wasmtime handles. Before we were using `LoadExternalName` which produces an `Abs8` reloc, which Wasmtime intentionally does not handle since that involves patching code at runtime, which makes loading code slower. * Fix tests that assume tail call support on s390x
This adds the
Config::wasm_tail_call
method and--wasm-features tail-call
CLI flag to enable the Wasm tail calls proposal in Wasmtime.This PR is mostly just plumbing and enabling tests, since all the prerequisite work (Wasmtime trampoline overhauls and Cranelift tail calls) was completed in earlier pull requests.
When Wasm tail calls are enabled, Wasm code uses the
tail
calling convention. Thetail
calling convention is known to cause a 1-7% slow down for regular code that isn't using tail calls, which is why it isn't used unconditionally. This involved shepherdingTunables
through to Wasm signature construction methods. The eventual plan is for thetail
calling convention to be used unconditionally, but not until the performance regression is addressed. This work is tracked in#6759
Additionally while our x86-64, aarch64, and riscv64 backends support tail calls, the s390x backend does not support them yet. Attempts to use tail calls on s390x will return errors. Support for s390x is tracked in #6530