You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/start/wasmedge/extensions/plugins.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -35,4 +35,4 @@ The latest version supporting the extensions is `0.12.1`. This chapter will be d
35
35
| Extension | Description | Platform Support | Language support |
36
36
| --- | --- | --- | --- |
37
37
|[Image processing](https://github.com/second-state/WasmEdge-image)| A native library to manipulate images for AI inference tasks. Migrated into the plug-in after WasmEdge `0.13.0`. |`manylinux2014 x86_64`, `manylinux2014 aarch64`, `android aarch64`, `ubuntu 20.04 x86_64`, and `darwin x86_64`|[Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.2.2) |
38
-
|[TensorFlow and Tensorflow-Lite](https://github.com/second-state/WasmEdge-tensorflow)| A native library to inferring TensorFlow and TensorFlow-Lite models. Migrated into the plug-in after WasmEdge `0.13.0`. |`manylinux2014 x86_64`, `manylinux2014 aarch64` (TensorFlow-Lite only), `android aarch64` (TensorFlow-Lite only), `ubuntu 20.04 x86_64`, and `darwin x86_64`|[Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.2.2) |
38
+
|[TensorFlow and Tensorflow-Lite](https://github.com/second-state/WasmEdge-tensorflow)| A native library to inferring TensorFlow and TensorFlow-Lite models. Migrated into the plug-in after WasmEdge `0.13.0`. |`manylinux2014 x86_64`, `manylinux2014 aarch64` (TensorFlow-Lite only), `android aarch64` (TensorFlow-Lite only), `ubuntu 20.04 x86_64`, and `darwin x86_64`|[Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.2.2) |
The usage of the `wasmedge compile`command will be:
9
+
`wasmedge compile`命令的用法如下:
10
10
11
11
```bash
12
12
$ wasmedge compile -h
@@ -16,61 +16,60 @@ USAGE
16
16
...
17
17
```
18
18
19
-
The `wasmedge compile` command can compile WebAssembly into native machine code (i.e., the AOT compiler). For the pure WebAssembly, the `wasmedge` tool will execute the WASM in interpreter mode. After compiling with the `wasmedge compile` AOT compiler, the `wasmedge` tool can execute the WASM in AOT mode, which is much faster.
20
-
21
-
## Options
22
-
23
-
The options of the `wasmedge compile` command are as follows.
24
-
25
-
1.`-h|--help`: Show the help messages. Will ignore the other arguments below.
26
-
2._(Optional)_`--dump`: Dump the LLVM IR to `wasm.ll` and `wasm-opt.ll`.
27
-
3._(Optional)_`--interruptible`: Generate the binary which supports interruptible execution.
28
-
- By default, the AOT-compiled WASM not supports [interruptions in asynchronous executions](../../embed/c/reference/0.12.x#async).
29
-
4._(Optional)_ Statistics information:
30
-
- By default, the AOT-compiled WASM not supports all statistics even if the options are turned on when running the `wasmedge` tool.
31
-
- Use `--enable-time-measuring` to generate code for enabling time-measuring statistics in execution.
32
-
- Use `--enable-gas-measuring` to generate code for enabling the statistics of gas measuring in execution.
33
-
- Use `--enable-instruction-count` to generate code for enabling the statistics of counting WebAssembly instructions.
34
-
- Or use `--enable-all-statistics` to generate code for enabling all of the statistics.
35
-
5._(Optional)_`--generic-binary`: Generate the generic binary of the current host CPU architecture.
36
-
6._(Optional)_ WebAssembly proposals:
37
-
- Use `--disable-import-export-mut-globals` to disable the [Import/Export of Mutable Globals](https://github.com/WebAssembly/mutable-global) proposal (Default `ON`).
38
-
- Use `--disable-non-trap-float-to-int` to disable the [Non-Trapping Float-to-Int Conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) proposal (Default `ON`).
39
-
- Use `--disable-sign-extension-operators` to disable the [Sign-Extension Operators](https://github.com/WebAssembly/sign-extension-ops) proposal (Default `ON`).
40
-
- Use `--disable-multi-value` to disable the [Multi-value](https://github.com/WebAssembly/multi-value) proposal (Default `ON`).
41
-
- Use `--disable-bulk-memory` to disable the [Bulk Memory Operations](https://github.com/WebAssembly/bulk-memory-operations) proposal (Default `ON`).
42
-
- Use `--disable-reference-types` to disable the [Reference Types](https://github.com/WebAssembly/reference-types) proposal (Default `ON`).
43
-
- Use `--disable-simd` to disable the [Fixed-width SIMD](https://github.com/webassembly/simd) proposal (Default `ON`).
44
-
- Use `--enable-multi-memory` to enable the [Multiple Memories](https://github.com/WebAssembly/multi-memory) proposal (Default `OFF`).
45
-
- Use `--enable-tail-call` to enable the [Tail call](https://github.com/WebAssembly/tail-call) proposal (Default `OFF`).
46
-
- Use `--enable-extended-const` to enable the [Extended Constant Expressions](https://github.com/WebAssembly/extended-const) proposal (Default `OFF`).
47
-
- Use `--enable-threads` to enable the [Threads](https://github.com/webassembly/threads) proposal (Default `OFF`).
48
-
- Use `--enable-all` to enable ALL proposals above.
49
-
7._(Optional)_`--optimize`: Select the LLVM optimization level.
50
-
- Use `--optimize LEVEL` to set the optimization level. The `LEVEL` should be one of `0`, `1`, `2`, `3`, `s`, or `z`.
51
-
- The default value will be `2`, which means `O2`.
52
-
8. Input WASM file (`/path/to/wasm/file`).
53
-
9. Output path (`/path/to/output/file`).
54
-
- By default, the `wasmedge compile` command will output the [universal WASM format](#output-format-universal-wasm).
55
-
- If the specific file extension (`.so` on Linux, `.dylib` on MacOS, and `.dll` on Windows) is assigned in the output path, the `wasmedge compile` command will output the [shared library format](#output-format-shared-library).
56
-
57
-
## Example
58
-
59
-
We created the hand-written [fibonacci.wat](https://github.com/WasmEdge/WasmEdge/raw/master/examples/wasm/fibonacci.wat) and used the [wat2wasm](https://webassembly.github.io/wabt/demo/wat2wasm/) tool to convert it into the `fibonacci.wasm` WebAssembly program. Take it, for example. It exported a `fib()` function, which takes a single `i32` integer as the input parameter.
wasmedge compile fibonacci.wasm fibonacci_aot.so #在 Linux 上
71
70
```
72
71
73
-
The output will be:
72
+
输出将会是:
74
73
75
74
```bash
76
75
[2022-09-09 14:22:10.540] [info] compile start
@@ -81,13 +80,13 @@ The output will be:
81
80
[2022-09-09 14:22:10.600] [info] compile done
82
81
```
83
82
84
-
Then you can execute the output file with `wasmedge`and measure the execution time:
83
+
然后,你可以使用 `wasmedge`执行输出文件并测量执行时间:
85
84
86
85
```bash
87
86
time wasmedge --reactor fibonacci_aot.wasm fib 30
88
87
```
89
88
90
-
The output will be:
89
+
输出将会是:
91
90
92
91
```bash
93
92
1346269
@@ -97,13 +96,13 @@ user 0m0.012s
97
96
sys 0m0.014s
98
97
```
99
98
100
-
Then you can compare it with the interpreter mode:
99
+
接着,你可以与解释器模式进行比较:
101
100
102
101
```bash
103
102
time wasmedge --reactor fibonacci.wasm fib 30
104
103
```
105
104
106
-
The output shows that the AOT-compiled WASM is much faster than the interpreter mode:
105
+
输出显示,AOT 编译的 WASM 比解释器模式快得多:
107
106
108
107
```bash
109
108
1346269
@@ -113,27 +112,27 @@ user 0m0.427s
113
112
sys 0m0.012s
114
113
```
115
114
116
-
## Output Format: Universal WASM
115
+
## 输出格式:通用 WASM
117
116
118
-
By default, the `wasmedge compile` AOT compiler tool could wrap the AOT-compiled native binary into a custom section in the origin WASM file. We call this the universal WASM binary format.
This AOT-compiled WASM file is compatible with any WebAssembly runtime. However, when this WASM file is executed by the WasmEdge runtime, WasmEdge will extract the native binary from the custom section and execute it in AOT mode.
On MacOS platforms, the universal WASM format will `bus error` in execution. By default, the `wasmedge compile`tool optimizes the WASM in the `O2`level. We are trying to fix this issue. For working around, please use the shared library output format instead.
Users can assign the shared library extension for the output files (`.so` on Linux,`.dylib` on MacOS, and `.dll` on Windows) to generate the shared library output format output.
133
+
用户可以为输出文件指定共享库扩展名(在 Linux 上为 `.so`,在 MacOS 上为`.dylib`,在 Windows 上为 `.dll`),以生成共享库格式的输出。
135
134
136
-
This AOT-compiled WASM file is only for WasmEdge use and cannot be used by other WebAssembly runtimes.
0 commit comments