Skip to content

Commit 403f320

Browse files
alabulei1juntao
andauthored
Update the new rust compiler target for wasm (#263)
* Update the new rust compiler target for wasm Signed-off-by: alabulei1 <[email protected]> * Update simd.md Signed-off-by: Michael Yuan <[email protected]> Signed-off-by: Michael Yuan <[email protected]> --------- Signed-off-by: Michael Yuan <[email protected]> Co-authored-by: Michael Yuan <[email protected]>
1 parent 6a6339d commit 403f320

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+292
-292
lines changed

docs/contribute/source/os/android/cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ git clone https://github.com/second-state/wasm-learning.git
7474
cd wasm-learning/rust/birds_v1
7575
```
7676

77-
Use the `cargo` command to build a WASM bytecode file from the Rust source code. The WASM file is located at `target/wasm32-wasi/release/birds_v1.wasm`.
77+
Use the `cargo` command to build a WASM bytecode file from the Rust source code. The WASM file is located at `target/wasm32-wasip1/release/birds_v1.wasm`.
7878

7979
```bash
80-
rustup target add wasm32-wasi
81-
cargo build --release --target=wasm32-wasi
80+
rustup target add wasm32-wasip1
81+
cargo build --release --target=wasm32-wasip1
8282
```
8383

8484
Push the WASM bytecode file, tensorflow lite model file, and the test bird picture file onto the Android device using `adb`.
8585

8686
```bash
87-
adb push target/wasm32-wasi/release/birds_v1.wasm /data/local/tmp/WasmEdge-tensorflow-tools
87+
adb push target/wasm32-wasip1/release/birds_v1.wasm /data/local/tmp/WasmEdge-tensorflow-tools
8888
adb push lite-model_aiy_vision_classifier_birds_V1_3.tflite /data/local/tmp/WasmEdge-tensorflow-tools
8989
adb push bird.jpg /data/local/tmp/WasmEdge-tensorflow-tools
9090
```

docs/develop/c/simd.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ sidebar_position: 4
66

77
[128-bit packed Single Instruction Multiple Data (SIMD)](https://webassembly.github.io/simd/core/syntax/instructions.html#simd-instructions) instructions provide simultaneous computations over packed data in just one instruction. It's commonly used to improve performance for multimedia applications. With the SIMD proposal, the modules can benefit from using these commonly used instructions in modern hardware to gain more speedup.
88

9-
If you are interested in enabling the SIMD proposal will improve how much performance of the applications, please refer to our [wasm32-wasi benchmark](https://github.com/second-state/wasm32-wasi-benchmark) for more information. The Mandelbrot Set application can have a **2.65x** speedup in our benchmark.
9+
If you are interested in enabling the SIMD proposal will improve how much performance of the applications, please refer to our [wasm32-wasip1 benchmark](https://github.com/second-state/wasm32-wasi-benchmark) for more information. The Mandelbrot Set application can have a **2.65x** speedup in our benchmark.
1010

11-
We modified the Mandelbrot Set example from our [wasm32-wasi benchmark project](https://github.com/second-state/wasm32-wasi-benchmark/blob/master/src/mandelbrot.c). We will use this as an example in this article.
11+
We modified the Mandelbrot Set example from our [wasm32-wasip1 benchmark project](https://github.com/second-state/wasm32-wasi-benchmark/blob/master/src/mandelbrot.c). We will use this as an example in this article.
1212

1313
## Prerequisites
1414

docs/develop/javascript/hello_world.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ git clone https://github.com/second-state/wasmedge-quickjs
7676
cd wasmedge-quickjs
7777

7878
# Build the QuickJS JavaScript interpreter
79-
cargo build --target wasm32-wasi --release
79+
cargo build --target wasm32-wasip1 --release
8080
```
8181

8282
The WebAssembly-based JavaScript interpreter program is located in the build `target` directory.
8383

8484
WasmEdge provides a `wasmedgec` utility to compile and add a native machine code section to the `wasm` file. You can use `wasmedge` to run the natively instrumented `wasm` file to get a much faster performance.
8585

8686
```bash
87-
wasmedge compile target/wasm32-wasi/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
87+
wasmedge compile target/wasm32-wasip1/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
8888
wasmedge --dir .:. wasmedge_quickjs.wasm example_js/hello.js
8989
```
9090

docs/develop/javascript/rust.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The examples are in the `examples/embed_js` folder in the `wasmedge-quickjs` rep
2222

2323
```bash
2424
cd examples/embed_js
25-
cargo build --target wasm32-wasi --release
26-
wasmedge --dir .:. target/wasm32-wasi/release/embed_js.wasm
25+
cargo build --target wasm32-wasip1 --release
26+
wasmedge --dir .:. target/wasm32-wasip1/release/embed_js.wasm
2727
```
2828

2929
## Code explanation: embed JavaScript into a Rust program
@@ -191,8 +191,8 @@ The project is in the [examples/embed_rust_module](https://github.com/second-sta
191191

192192
```bash
193193
cd examples/embed_rust_module
194-
cargo build --target wasm32-wasi --release
195-
wasmedge --dir .:. target/wasm32-wasi/release/embed_rust_module.wasm
194+
cargo build --target wasm32-wasip1 --release
195+
wasmedge --dir .:. target/wasm32-wasip1/release/embed_rust_module.wasm
196196
```
197197

198198
### Code explanation

docs/develop/javascript/tensorflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ git clone https://github.com/second-state/wasmedge-quickjs
103103
cd wasmedge-quickjs
104104

105105
# Build the QuickJS JavaScript interpreter with WASI NN
106-
cargo build --target wasm32-wasi --release --features=wasi_nn
106+
cargo build --target wasm32-wasip1 --release --features=wasi_nn
107107
```
108108

109109
The WebAssembly-based JavaScript interpreter program is located in the build `target` directory.
110110

111111
WasmEdge provides a `wasmedge compile` utility to compile and add a native machine code section to the wasm file. You can use wasmedge to run the natively instrumented wasm file to get much faster performance.
112112

113113
```bash
114-
wasmedge compile target/wasm32-wasi/release/wasmedge_quickjs.wasm wasmedge_quickjs_nn.wasm
114+
wasmedge compile target/wasm32-wasip1/release/wasmedge_quickjs.wasm wasmedge_quickjs_nn.wasm
115115
```

docs/develop/python/hello_world.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ Several different language implementations of the Python runtime exist, and some
88

99
## Compile RustPython
1010

11-
To compile RustPython, you should install the Rust toolchain on your machine. And `wasm32-wasi` platform support should be enabled.
11+
To compile RustPython, you should install the Rust toolchain on your machine. And `wasm32-wasip1` platform support should be enabled.
1212

1313
```bash
14-
rustup target add wasm32-wasi
14+
rustup target add wasm32-wasip1
1515
```
1616

1717
Then you could use the following command to clone and compile RustPython:
1818

1919
```bash
2020
git clone https://github.com/RustPython/RustPython.git
2121
cd RustPython
22-
cargo build --release --target wasm32-wasi --features="freeze-stdlib"
22+
cargo build --release --target wasm32-wasip1 --features="freeze-stdlib"
2323
```
2424

25-
`freeze-stdlib` feature is enabled for including Python standard library inside the binary file. The output file should be at `target/wasm32-wasi/release/rustpython.wasm`.
25+
`freeze-stdlib` feature is enabled for including Python standard library inside the binary file. The output file should be at `target/wasm32-wasip1/release/rustpython.wasm`.
2626

2727
## AOT Compile
2828

2929
WasmEdge supports compiling WebAssembly bytecode programs into native machine code for better performance. It is highly recommended to compile the RustPython to native machine code before running.
3030

3131
```bash
32-
wasmedge compile ./target/wasm32-wasi/release/rustpython.wasm ./target/wasm32-wasi/release/rustpython.wasm
32+
wasmedge compile ./target/wasm32-wasip1/release/rustpython.wasm ./target/wasm32-wasip1/release/rustpython.wasm
3333
```
3434

3535
## Run
3636

3737
```bash
38-
wasmedge ./target/wasm32-wasi/release/rustpython.wasm
38+
wasmedge ./target/wasm32-wasip1/release/rustpython.wasm
3939
```
4040

4141
Then you could get a Python shell in WebAssembly!
@@ -45,5 +45,5 @@ Then you could get a Python shell in WebAssembly!
4545
You can pre-open directories to let WASI programs have permission to read and write files stored on the real machine. The following command mounted the current working directory to the WASI virtual file system.
4646

4747
```bash
48-
wasmedge --dir .:. ./target/wasm32-wasi/release/rustpython.wasm
48+
wasmedge --dir .:. ./target/wasm32-wasip1/release/rustpython.wasm
4949
```

docs/develop/rust/dapr.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Build.
5959

6060
```bash
6161
cd image-api-grayscale
62-
cargo build --target wasm32-wasi --release
63-
wasmedgec ./target/wasm32-wasi/release/image-api-grayscale.wasm image-api-grayscale.wasm
62+
cargo build --target wasm32-wasip1 --release
63+
wasmedgec ./target/wasm32-wasip1/release/image-api-grayscale.wasm image-api-grayscale.wasm
6464
```
6565

6666
Deploy.
@@ -81,8 +81,8 @@ Build.
8181

8282
```bash
8383
cd image-api-classify
84-
cargo build --target wasm32-wasi --release
85-
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_server_tflite.wasm wasmedge_hyper_server_tflite.wasm
84+
cargo build --target wasm32-wasip1 --release
85+
wasmedgec target/wasm32-wasip1/release/wasmedge_hyper_server_tflite.wasm wasmedge_hyper_server_tflite.wasm
8686
```
8787

8888
Deploy.
@@ -103,8 +103,8 @@ Build.
103103

104104
```bash
105105
cd events-service
106-
cargo build --target wasm32-wasi --release
107-
wasmedgec target/wasm32-wasi/release/events_service.wasm events_service.wasm
106+
cargo build --target wasm32-wasip1 --release
107+
wasmedgec target/wasm32-wasip1/release/events_service.wasm events_service.wasm
108108
```
109109

110110
Deploy.

docs/develop/rust/database/my_sql_driver.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2121
cd wasmedge-db-examples/mysql_async
2222

2323
# Compile the rust code into WASM
24-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
24+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2525

2626
# Execute MySQL statements against a MySQL database at mysql://user:[email protected]:3306
27-
wasmedge --env "DATABASE_URL=mysql://user:[email protected]:3306/mysql" target/wasm32-wasi/release/crud.wasm
27+
wasmedge --env "DATABASE_URL=mysql://user:[email protected]:3306/mysql" target/wasm32-wasip1/release/crud.wasm
2828
```
2929

3030
<!-- prettier-ignore -->

docs/develop/rust/database/postgres_driver.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2121
cd wasmedge-db-examples/postgres
2222

2323
# Compile the rust code into WASM
24-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
24+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2525

2626
# Execute SQL statements against a PostgreSQL database at postgres://user:passwd@localhost/testdb
27-
wasmedge --env "DATABASE_URL=postgres://user:passwd@localhost/testdb" target/wasm32-wasi/release/crud.wasm
27+
wasmedge --env "DATABASE_URL=postgres://user:passwd@localhost/testdb" target/wasm32-wasip1/release/crud.wasm
2828
```
2929

3030
## Configuration

docs/develop/rust/database/qdrant_driver.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2323
cd wasmedge-db-examples/qdrant
2424

2525
# Compile the rust code into WASM
26-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
26+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2727

2828
# Perform vector data operations against a Qdrant at http://localhost:6333
29-
wasmedge target/wasm32-wasi/release/qdrant_examples.wasm
29+
wasmedge target/wasm32-wasip1/release/qdrant_examples.wasm
3030
```
3131

3232
## Configuration

0 commit comments

Comments
 (0)