Browse Source

Rename the `wasm32-wasi` target to `wasm32-wasip1` (#8867)

This rename is happening in upstream Rust and should be in enough places
now.

prtest:full
pull/9013/head
Alex Crichton 3 months ago
committed by GitHub
parent
commit
05095c1868
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      .github/actions/install-rust/action.yml
  2. 14
      .github/workflows/main.yml
  3. 4
      README.md
  4. 6
      benches/instantiation.rs
  5. 4
      crates/test-programs/artifacts/build.rs
  6. 4
      crates/wasi-common/README.md
  7. 2
      crates/wasi-nn/README.md
  8. 2
      crates/wasi-nn/examples/classification-component-onnx/Cargo.toml
  9. 10
      crates/wasi-nn/examples/classification-component-onnx/README.md
  10. 2
      crates/wasi-nn/examples/classification-example-named/Cargo.toml
  11. 4
      crates/wasi-nn/examples/classification-example-named/README.md
  12. 2
      crates/wasi-nn/examples/classification-example-winml/Cargo.toml
  13. 10
      crates/wasi-nn/examples/classification-example-winml/README.md
  14. 2
      crates/wasi-nn/examples/classification-example/Cargo.toml
  15. 4
      crates/wasi-nn/examples/classification-example/README.md
  16. 2
      crates/wasi-preview1-component-adapter/README.md
  17. 8
      docs/WASI-tutorial.md
  18. 6
      docs/contributing-implementing-wasm-proposals.md
  19. 4
      docs/contributing-testing.md
  20. 2
      docs/examples-coredump.md
  21. 2
      docs/examples-debugging-core-dumps.md
  22. 2
      docs/examples-profiling-perf.md
  23. 4
      docs/examples-profiling-vtune.md
  24. 6
      docs/examples-rust-wasi.md
  25. 2
      docs/stability-tiers.md
  26. 4
      examples/CMakeLists.txt
  27. 2
      examples/component/main.rs
  28. 2
      examples/tokio/main.rs
  29. 2
      examples/wasi-async/main.rs
  30. 2
      examples/wasi/main.c
  31. 2
      examples/wasi/main.rs
  32. 2
      tests/all/traps.rs

2
.github/actions/install-rust/action.yml

@ -59,4 +59,4 @@ runs:
- name: Install the WASI target
shell: bash
run: rustup target add wasm32-wasi wasm32-unknown-unknown
run: rustup target add wasm32-wasip1 wasm32-unknown-unknown

14
.github/workflows/main.yml

@ -587,7 +587,7 @@ jobs:
toolchain: ${{ matrix.rust }}
# Install targets in order to build various tests throughout the repo
- run: rustup target add wasm32-wasi wasm32-unknown-unknown ${{ matrix.target }}
- run: rustup target add wasm32-wasip1 wasm32-unknown-unknown ${{ matrix.target }}
- run: echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
if: matrix.target != ''
@ -715,7 +715,7 @@ jobs:
if: (matrix.os == 'windows-latest') && (matrix.feature == 'winml')
# Install Rust targets.
- run: rustup target add wasm32-wasi
- run: rustup target add wasm32-wasip1
# Run the tests!
- run: cargo test -p wasmtime-wasi-nn --features ${{ matrix.feature }}
@ -765,7 +765,7 @@ jobs:
with:
submodules: true
- uses: ./.github/actions/install-rust
- run: rustup target add wasm32-wasi wasm32-unknown-unknown
- run: rustup target add wasm32-wasip1 wasm32-unknown-unknown
- run: |
sudo apt-get update && sudo apt-get install -y gdb lldb-15 llvm
# workaround for https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1972855
@ -795,7 +795,7 @@ jobs:
with:
submodules: true
- uses: ./.github/actions/install-rust
- run: rustup target add wasm32-wasi wasm32-unknown-unknown
- run: rustup target add wasm32-wasip1 wasm32-unknown-unknown
- name: Install wasm-tools
run: |
@ -881,8 +881,8 @@ jobs:
with:
submodules: true
- uses: ./.github/actions/install-rust
- run: rustup target add wasm32-wasi wasm32-unknown-unknown
- run: cargo build --target wasm32-wasi --no-default-features --features compile,cranelift,all-arch
- run: rustup target add wasm32-wasip1 wasm32-unknown-unknown
- run: cargo build --target wasm32-wasip1 --no-default-features --features compile,cranelift,all-arch
env:
VERSION: ${{ github.sha }}
@ -903,7 +903,7 @@ jobs:
with:
submodules: true
- uses: ./.github/actions/install-rust
- run: rustup target add wasm32-wasi
- run: rustup target add wasm32-wasip1
- run: cargo test --benches --release
# common logic to cancel the entire run if this job fails

4
README.md

@ -54,8 +54,8 @@ fn main() {
and compile/run it with:
```sh
$ rustup target add wasm32-wasi
$ rustc hello.rs --target wasm32-wasi
$ rustup target add wasm32-wasip1
$ rustc hello.rs --target wasm32-wasip1
$ wasmtime hello.wasm
Hello, world!
```

6
benches/instantiation.rs

@ -185,7 +185,7 @@ fn build_wasi_example() {
"-p",
"example-wasi-wasm",
"--target",
"wasm32-wasi",
"wasm32-wasip1",
])
.spawn()
.expect("failed to run cargo to build WASI example")
@ -193,11 +193,11 @@ fn build_wasi_example() {
.expect("failed to wait for cargo to build")
.success()
{
panic!("failed to build WASI example for target `wasm32-wasi`");
panic!("failed to build WASI example for target `wasm32-wasip1`");
}
std::fs::copy(
"target/wasm32-wasi/release/wasi.wasm",
"target/wasm32-wasip1/release/wasi.wasm",
"benches/instantiation/wasi.wasm",
)
.expect("failed to copy WASI example module");

4
crates/test-programs/artifacts/build.rs

@ -30,7 +30,7 @@ fn build_and_generate_tests() {
// Build the test programs:
let mut cmd = cargo();
cmd.arg("build")
.arg("--target=wasm32-wasi")
.arg("--target=wasm32-wasip1")
.arg("--package=test-programs")
.env("CARGO_TARGET_DIR", &out_dir)
.env("CARGO_PROFILE_DEV_DEBUG", "2")
@ -59,7 +59,7 @@ fn build_and_generate_tests() {
for target in targets {
let camel = target.to_shouty_snake_case();
let wasm = out_dir
.join("wasm32-wasi")
.join("wasm32-wasip1")
.join("debug")
.join(format!("{target}.wasm"));

4
crates/wasi-common/README.md

@ -44,10 +44,10 @@ so stay tuned!
## Development hints
When testing the crate, you may want to enable and run full wasm32 integration testsuite. This
requires `wasm32-wasi` target installed which can be done as follows using [rustup]
requires `wasm32-wasip1` target installed which can be done as follows using [rustup]
```
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
```
[rustup]: https://rustup.rs

2
crates/wasi-nn/README.md

@ -35,5 +35,5 @@ To use the WIT-based ABI, compile with `--features component-model` and use `was
An end-to-end example demonstrating ML classification is included in [examples]:
`examples/classification-example` contains a standalone Rust project that uses
the [wasi-nn] APIs and is compiled to the `wasm32-wasi` target using the
the [wasi-nn] APIs and is compiled to the `wasm32-wasip1` target using the
high-level `wasi-nn` [bindings].

2
crates/wasi-nn/examples/classification-component-onnx/Cargo.toml

@ -29,7 +29,7 @@ ndarray = "0.15.3"
# This crate is built with the wasm32-wasi target, so it's separate
# This crate is built with the wasm32-wasip1 target, so it's separate
# from the main Wasmtime build, so use this directive to exclude it
# from the parent directory's workspace.
[workspace]

10
crates/wasi-nn/examples/classification-component-onnx/README.md

@ -1,6 +1,6 @@
# Onnx Backend Classification Component Example
This example demonstrates how to use the `wasi-nn` crate to run a classification using the
This example demonstrates how to use the `wasi-nn` crate to run a classification using the
[ONNX Runtime](https://onnxruntime.ai/) backend from a WebAssembly component.
## Build
@ -15,9 +15,9 @@ In the wasmtime root directory, run the following command to build the wasmtime
cargo build --features component-model,wasi-nn,wasmtime-wasi-nn/onnx
# run the component with wasmtime
./target/debug/wasmtime run \
--wasm-features component-model \
./target/debug/wasmtime run \
--wasm-features component-model \
--wasi-modules=experimental-wasi-nn \
--mapdir fixture::./crates/wasi-nn/examples/classification-component-onnx/fixture \
./crates/wasi-nn/examples/classification-component-onnx/target/wasm32-wasi/debug/classification_component_onnx.wasm
```
./crates/wasi-nn/examples/classification-component-onnx/target/wasm32-wasip1/debug/classification_component_onnx.wasm
```

2
crates/wasi-nn/examples/classification-example-named/Cargo.toml

@ -9,7 +9,7 @@ publish = false
[dependencies]
wasi-nn = "0.5.0"
# This crate is built with the wasm32-wasi target, so it's separate
# This crate is built with the wasm32-wasip1 target, so it's separate
# from the main Wasmtime build, so use this directive to exclude it
# from the parent directory's workspace.
[workspace]

4
crates/wasi-nn/examples/classification-example-named/README.md

@ -1,2 +1,2 @@
This example project demonstrates using the `wasi-nn` API to perform ML inference. It consists of Rust code that is
built using the `wasm32-wasi` target. See `ci/run-wasi-nn-example.sh` for how this is used.
This example project demonstrates using the `wasi-nn` API to perform ML inference. It consists of Rust code that is
built using the `wasm32-wasip1` target. See `ci/run-wasi-nn-example.sh` for how this is used.

2
crates/wasi-nn/examples/classification-example-winml/Cargo.toml

@ -11,7 +11,7 @@ wasi-nn = "0.6.0"
image = { version = "0.24.6", default-features = false, features = ["png"] }
ndarray = "0.15.3"
# This crate is built with the wasm32-wasi target, so it's separate
# This crate is built with the wasm32-wasip1 target, so it's separate
# from the main Wasmtime build, so use this directive to exclude it
# from the parent directory's workspace.
[workspace]

10
crates/wasi-nn/examples/classification-example-winml/README.md

@ -23,18 +23,18 @@ To run this example, perform the following steps on Windows 10 v1803 and later:
set PROJECT_DIR=%CD%
cd crates\wasi-nn\examples\classification-example-winml
```
1. Install the `wasm32-wasi` Rust target:
1. Install the `wasm32-wasip1` Rust target:
```
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
```
1. Compile this example; the `wasm32-wasi` output is a WebAssembly file:
1. Compile this example; the `wasm32-wasip1` output is a WebAssembly file:
```
cargo build --release --target=wasm32-wasi
cargo build --release --target=wasm32-wasip1
```
1. Run the sample; the fixture directory containing the model and image must be
mapped in to be accessible to WebAssembly.
```
%PROJECT_DIR%\target\release\wasmtime.exe --dir fixture::fixture -S nn target\wasm32-wasi\release\wasi-nn-example-winml.wasm
%PROJECT_DIR%\target\release\wasmtime.exe --dir fixture::fixture -S nn target\wasm32-wasip1\release\wasi-nn-example-winml.wasm
```
1. The example will print the top 5 classification results. To run with a
different image or ONNX model, modify the files in the `fixture` directory

2
crates/wasi-nn/examples/classification-example/Cargo.toml

@ -9,7 +9,7 @@ publish = false
[dependencies]
wasi-nn = "0.1.0"
# This crate is built with the wasm32-wasi target, so it's separate
# This crate is built with the wasm32-wasip1 target, so it's separate
# from the main Wasmtime build, so use this directive to exclude it
# from the parent directory's workspace.
[workspace]

4
crates/wasi-nn/examples/classification-example/README.md

@ -1,2 +1,2 @@
This example project demonstrates using the `wasi-nn` API to perform ML inference. It consists of Rust code that is
built using the `wasm32-wasi` target. See `ci/run-wasi-nn-example.sh` for how this is used.
This example project demonstrates using the `wasi-nn` API to perform ML inference. It consists of Rust code that is
built using the `wasm32-wasip1` target. See `ci/run-wasi-nn-example.sh` for how this is used.

2
crates/wasi-preview1-component-adapter/README.md

@ -45,7 +45,7 @@ $ cat foo.rs
fn main() {
println!("Hello, world!");
}
$ rustc foo.rs --target wasm32-wasi
$ rustc foo.rs --target wasm32-wasip1
$ wasm-tools print foo.wasm | grep '(import'
(import "wasi_snapshot_preview1" "fd_write" (func ...
(import "wasi_snapshot_preview1" "environ_get" (func ...

8
docs/WASI-tutorial.md

@ -154,14 +154,14 @@ Let's put this source in the main file of our crate `src/main.rs`.
In order to build it, we first need to install a WASI-enabled Rust toolchain:
```
$ rustup target add wasm32-wasi
$ cargo build --target wasm32-wasi
$ rustup target add wasm32-wasip1
$ cargo build --target wasm32-wasip1
```
We should now have the WebAssembly module created in `target/wasm32-wasi/debug`:
We should now have the WebAssembly module created in `target/wasm32-wasip1/debug`:
```
$ file target/wasm32-wasi/debug/demo.wasm
$ file target/wasm32-wasip1/debug/demo.wasm
demo.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
```

6
docs/contributing-implementing-wasm-proposals.md

@ -130,7 +130,7 @@ The [cap-std](https://github.com/bytecodealliance/cap-std) repository contains
crates which implement the capability-based version of the Rust standard library
and extensions to that functionality. Once the functionality has been added to
the relevant crates of that repository, they can be added into wasmtime by
including them in the preview2 directory of the [wasi crate](https://github.com/bytecodealliance/wasmtime/tree/main/crates/wasi).
including them in the preview2 directory of the [wasi crate](https://github.com/bytecodealliance/wasmtime/tree/main/crates/wasi).
Currently, WebAssembly modules which rely on preview2 ABI cannot be directly
executed by the wasmtime command. The following steps allow for testing such
@ -139,11 +139,11 @@ changes.
1. Build wasmtime with the changes `cargo build --release`
2. Create a simple Webassembly module to test the new component functionality by
compiling your test code to the `wasm32-wasi` build target.
compiling your test code to the `wasm32-wasip1` build target.
3. Build the [wasi-preview1-component-adapter](https://github.com/bytecodealliance/wasmtime/tree/main/crates/wasi-preview1-component-adapter)
as a command adapter. `cargo build -p wasi-preview1-component-adapter --target
wasm32-wasi --release --features command --no-default-features`
wasm32-wasip1 --release --features command --no-default-features`
4. Use [wasm-tools](https://github.com/bytecodealliance/wasm-tools) to convert
the test module to a component. `wasm-tools component new --adapt

4
docs/contributing-testing.md

@ -8,13 +8,13 @@ can't build it!
## Installing `wasm32` Targets
To compile the tests, you'll need the `wasm32-wasi` and
To compile the tests, you'll need the `wasm32-wasip1` and
`wasm32-unknown-unknown` targets installed, which, assuming you're using
[rustup.rs](https://rustup.rs) to manage your Rust versions, can be done as
follows:
```shell
rustup target add wasm32-wasi wasm32-unknown-unknown
rustup target add wasm32-wasip1 wasm32-unknown-unknown
```
## Running All Tests

2
docs/examples-coredump.md

@ -5,7 +5,7 @@ The following steps describe how to debug using Wasm coredump in Wasmtime:
1. Compile your WebAssembly with debug info enabled; for example:
```sh
$ rustc foo.rs --target=wasm32-wasi -C debuginfo=2
$ rustc foo.rs --target=wasm32-wasip1 -C debuginfo=2
```
<details>

2
docs/examples-debugging-core-dumps.md

@ -35,7 +35,7 @@ fn baz(x: u32) {
We can compile it to Wasm with the following command:
```shell-session
$ rustc --target wasm32-wasi -o ./trap.wasm ./trap.rs
$ rustc --target wasm32-wasip1 -o ./trap.wasm ./trap.rs
```
Next, we can run it in Wasmtime and capture a core dump when it traps:

2
docs/examples-profiling-perf.md

@ -162,7 +162,7 @@ fn fib(n: u32) -> u32 {
To collect perf information for this wasm module we'll execute:
```sh
$ rustc --target wasm32-wasi fib.rs -O
$ rustc --target wasm32-wasip1 fib.rs -O
$ perf record -k mono wasmtime --profile=jitdump fib.wasm
fib(42) = 267914296
[ perf record: Woken up 1 times to write data ]

4
docs/examples-profiling-vtune.md

@ -92,7 +92,7 @@ fn fib(n: u32) -> u32 {
We compile the example to Wasm:
```sh
$ rustc --target wasm32-wasi fib.rs -C opt-level=z -C lto=yes
$ rustc --target wasm32-wasip1 fib.rs -C opt-level=z -C lto=yes
```
Then we execute the Wasmtime runtime (built with the `vtune` feature and
@ -101,7 +101,7 @@ application, `vtune`, which must already be installed and available on the
path. To collect hot spot profiling information, we execute:
```sh
$ rustc --target wasm32-wasi fib.rs -C opt-level=z -C lto=yes
$ rustc --target wasm32-wasip1 fib.rs -C opt-level=z -C lto=yes
$ vtune -run-pass-thru=--no-altstack -v -collect hotspots target/debug/wasmtime --profile=vtune fib.wasm
fib(45) = 1134903170
amplxe: Collection stopped.

6
docs/examples-rust-wasi.md

@ -14,14 +14,14 @@ WebAssembly module.
### WebAssembly module source code
For this WASI example, this Hello World program is compiled to a WebAssembly module using the WASI Preview 1 API.
For this WASI example, this Hello World program is compiled to a WebAssembly module using the WASI Preview 1 API.
`wasi.rs`
```rust
{{#include ../examples/wasi/wasm/wasi.rs}}
```
Building this program generates `target/wasm32-wasi/debug/wasi.wasm`, used below.
Building this program generates `target/wasm32-wasip1/debug/wasi.wasm`, used below.
### Invoke the WASM module
@ -98,4 +98,4 @@ This does not require any change to the WebAssembly module, it's just the WASI A
```
You can also [browse this source code online][code2] and clone the wasmtime
repository to run the example locally.
repository to run the example locally.

2
docs/stability-tiers.md

@ -88,7 +88,7 @@ For explanations of what each tier means see below.
|----------------------|-----------------------------------|-----------------------------|
| Target | `aarch64-pc-windows-msvc` | CI testing, unwinding, full-time maintainer |
| Target | `riscv64gc-unknown-linux-gnu` | full-time maintainer |
| Target | `wasm32-wasi` [^3] | Supported but not tested |
| Target | `wasm32-wasip1` [^3] | Supported but not tested |
| Target | `aarch64-linux-android` | CI testing, full-time maintainer |
| Target | `x86_64-linux-android` | CI testing, full-time maintainer |
| Target | `x86_64-unknown-linux-musl` [^4] | CI testing, full-time maintainer |

4
examples/CMakeLists.txt

@ -62,8 +62,8 @@ create_target(wasi wasi/main.c)
# Add rust tests
create_rust_test(anyref)
create_rust_wasm(fib-debug wasm32-unknown-unknown)
create_rust_wasm(tokio wasm32-wasi)
create_rust_wasm(wasi wasm32-wasi)
create_rust_wasm(tokio wasm32-wasip1)
create_rust_wasm(wasi wasm32-wasip1)
create_rust_wasm(component wasm32-unknown-unknown)
create_rust_test(epochs)
create_rust_test(externref)

2
examples/component/main.rs

@ -41,7 +41,7 @@ fn main() -> Result<()> {
let engine = Engine::new(Config::new().wasm_component_model(true))?;
// NOTE: The wasm32-unknown-unknown target is used here for simplicity, real world use cases
// should probably use the wasm32-wasi target, and enable wasi preview2 within the component
// should probably use the wasm32-wasip1 target, and enable wasi preview2 within the component
// model.
let component = convert_to_component("target/wasm32-unknown-unknown/debug/guest.wasm")?;

2
examples/tokio/main.rs

@ -54,7 +54,7 @@ impl Environment {
config.consume_fuel(true);
let engine = Engine::new(&config)?;
let module = Module::from_file(&engine, "target/wasm32-wasi/debug/tokio-wasi.wasm")?;
let module = Module::from_file(&engine, "target/wasm32-wasip1/debug/tokio-wasi.wasm")?;
// A `Linker` is shared in the environment amongst all stores, and this
// linker is used to instantiate the `module` above. This example only

2
examples/wasi-async/main.rs

@ -33,7 +33,7 @@ async fn main() -> Result<()> {
// Instantiate our 'Hello World' wasm module.
// Note: This is a module built against the preview1 WASI API.
let module = Module::from_file(&engine, "target/wasm32-wasi/debug/wasi.wasm")?;
let module = Module::from_file(&engine, "target/wasm32-wasip1/debug/wasi.wasm")?;
let func = linker
.module_async(&mut store, "", &module)
.await?

2
examples/wasi/main.c

@ -48,7 +48,7 @@ int main() {
wasm_byte_vec_t wasm;
// Load our input file to parse it next
FILE *file = fopen("target/wasm32-wasi/debug/wasi.wasm", "rb");
FILE *file = fopen("target/wasm32-wasip1/debug/wasi.wasm", "rb");
if (!file) {
printf("> Error loading file!\n");
exit(1);

2
examples/wasi/main.rs

@ -25,7 +25,7 @@ fn main() -> Result<()> {
let mut store = Store::new(&engine, wasi);
// Instantiate our module with the imports we've created, and run it.
let module = Module::from_file(&engine, "target/wasm32-wasi/debug/wasi.wasm")?;
let module = Module::from_file(&engine, "target/wasm32-wasip1/debug/wasi.wasm")?;
linker.module(&mut store, "", &module)?;
linker
.get_default(&mut store, "")?

2
tests/all/traps.rs

@ -723,7 +723,7 @@ fn rustc(src: &str) -> Vec<u8> {
.arg("-o")
.arg(&output)
.arg("--target")
.arg("wasm32-wasi")
.arg("wasm32-wasip1")
.arg("-g")
.output()
.unwrap();

Loading…
Cancel
Save