Refactor Wasmtime CLI to support components #6836
Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom Aug 19, 2023
Merged
Refactor Wasmtime CLI to support components #6836alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton merged 1 commit intobytecodealliance:mainfrom
Conversation
pchickey
reviewed
Aug 15, 2023
Contributor
pchickey
left a comment
There was a problem hiding this comment.
Various conflicts with main, and I'd like to leave the flush stuff out, but otherwise the meat of this is great.
This commit refactors the `wasmtime` CLI executable to be able to
support not only compiling components but additionally executing
components. While I was doing this I've additionally added a new
`--preview2` argument to enable using the new experimental
implementation of preview1 based on preview2 type/structs. This is
off-by-default but is expected to become the default in the future.
Some notable features of this change are:
* The preview1-implemented-with-preview2 module now sports
`add_to_linker_{async,sync}` to replace the previous `add_to_linker`
which always did async.
* Some trait bounds in the preview1-implemented-with-preview2 module are
simplified.
* Some minor changes were made to `wiggle`'s macros to support a "block
on" that isn't the default wiggle dummy executor (as now we actually
do need Tokio)
* Many options related to core wasm `Linker` configuration, such as
`--default-values-unknown-imports`, are not implemented for components
at this time. When used with components these options return an error.
* Construction of WASI contexts has been refactored to pass around fewer
arguments to avoid threading through lots of values for both preview1
and preview2.
* Reading the input to the Wasmtime CLI has been updated to read the
input in the `run` subcommand before handing it off to the `wasmtime`
crate's API to enable the CLI to use the contents of what's loaded to
determine what to do next.
* Our generic `./ci/run-tests.sh` script has been updated to pass the
`--features component-model` flag to ensure that this CLI support is
tested during the normal test suite.
* The CLI support for `wasi-nn` supports components as well as core wasm
modules.
0b837c1 to
1274636
Compare
Member
Author
|
Ok I've ignored the one test that relies on output flushing and otherwise rebased this on main. I've additionally added component support for the I think this should be ready to go though if you can give it another review @pchickey |
Contributor
|
wasi-http is hosed at the moment and should not be enabled. @elliottt will hook it back in once its in a better state. |
pchickey
approved these changes
Aug 18, 2023
eduardomourar
pushed a commit
to eduardomourar/wasmtime
that referenced
this pull request
Aug 19, 2023
This commit refactors the `wasmtime` CLI executable to be able to
support not only compiling components but additionally executing
components. While I was doing this I've additionally added a new
`--preview2` argument to enable using the new experimental
implementation of preview1 based on preview2 type/structs. This is
off-by-default but is expected to become the default in the future.
Some notable features of this change are:
* The preview1-implemented-with-preview2 module now sports
`add_to_linker_{async,sync}` to replace the previous `add_to_linker`
which always did async.
* Some trait bounds in the preview1-implemented-with-preview2 module are
simplified.
* Some minor changes were made to `wiggle`'s macros to support a "block
on" that isn't the default wiggle dummy executor (as now we actually
do need Tokio)
* Many options related to core wasm `Linker` configuration, such as
`--default-values-unknown-imports`, are not implemented for components
at this time. When used with components these options return an error.
* Construction of WASI contexts has been refactored to pass around fewer
arguments to avoid threading through lots of values for both preview1
and preview2.
* Reading the input to the Wasmtime CLI has been updated to read the
input in the `run` subcommand before handing it off to the `wasmtime`
crate's API to enable the CLI to use the contents of what's loaded to
determine what to do next.
* Our generic `./ci/run-tests.sh` script has been updated to pass the
`--features component-model` flag to ensure that this CLI support is
tested during the normal test suite.
* The CLI support for `wasi-nn` supports components as well as core wasm
modules.
geekbeast
pushed a commit
to geekbeast/wasmtime
that referenced
this pull request
Aug 21, 2023
…eature/kserve * 'feature/kserve' of github.com:geekbeast/wasmtime: Refactor Wasmtime CLI to support components (bytecodealliance#6836) Bump the wasm-tools family of crates (bytecodealliance#6861) Wasmtime: refactor the pooling allocator for components (bytecodealliance#6835)
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Aug 21, 2023
This commit updates the component support in the `wasmtime` CLI from bytecodealliance#6836 to use the generated bindings for the "command" style of components rather than having that custom-written in the CLI.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Aug 21, 2023
* Use generated bindings to run components in the CLI This commit updates the component support in the `wasmtime` CLI from #6836 to use the generated bindings for the "command" style of components rather than having that custom-written in the CLI. * Fix tests
eduardomourar
pushed a commit
to eduardomourar/wasmtime
that referenced
this pull request
Aug 22, 2023
…#6869) * Use generated bindings to run components in the CLI This commit updates the component support in the `wasmtime` CLI from bytecodealliance#6836 to use the generated bindings for the "command" style of components rather than having that custom-written in the CLI. * Fix tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit refactors the
wasmtimeCLI executable to be able tosupport not only compiling components but additionally executing
components. While I was doing this I've additionally added a new
--preview2argument to enable using the new experimentalimplementation of preview1 based on preview2 type/structs. This is
off-by-default but is expected to become the default in the future.
Some notable features of this change are:
The preview1-implemented-with-preview2 module now sports
add_to_linker_{async,sync}to replace the previousadd_to_linkerwhich always did async.
Some trait bounds in the preview1-implemented-with-preview2 module are
simplified.
Some minor changes were made to
wiggle's macros to support a "blockon" that isn't the default wiggle dummy executor (as now we actually
do need Tokio)
Many options related to core wasm
Linkerconfiguration, such as--default-values-unknown-imports, are not implemented for componentsat this time. When used with components these options return an error.
Construction of WASI contexts has been refactored to pass around fewer
arguments to avoid threading through lots of values for both preview1
and preview2.
Reading the input to the Wasmtime CLI has been updated to read the
input in the
runsubcommand before handing it off to thewasmtimecrate's API to enable the CLI to use the contents of what's loaded to
determine what to do next.
Our generic
./ci/run-tests.shscript has been updated to pass the--features component-modelflag to ensure that this CLI support istested during the normal test suite.