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/contribute/installer.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
sidebar_position: 7
3
3
---
4
4
5
-
# Installer System explanation
5
+
# Installer Guide
6
6
7
7
## Overview
8
8
9
-
WasmEdge installer is designed for installing the Core Tools (`wasmedge`, `wasmedgec`), the Libraries (`libwasmedge`), the Extensions(`wasmedge-tensorflow`), and the Plugins(`wasi-nn`, `wasi-crytpo`).
9
+
WasmEdge installer is designed for installing the Core Tools (`wasmedge`, `wasmedge compile`), the Libraries (`libwasmedge`), the Extensions(`wasmedge-tensorflow`), and the Plugins(`wasi-nn`, `wasi-crytpo`).
To improve the performance, the `wasmedgec` can compile WebAssembly into native machine code. After compiling with the `wasmedgec` AOT compiler, the wasmedge tool can execute the WASM in AOT mode which is much faster.
69
+
To improve the performance, the `wasmedge compile` can compile WebAssembly into native machine code. After compiling with the `wasmedge compile` AOT compiler, the wasmedge tool can execute the WASM in AOT mode which is much faster.
The prerequisite of the Wasi-Logging plug-in is the same as the WasmEdge building environment on the [Linux](../os/linux.md) and [MacOS](../os/macos.md) platforms.
10
+
11
+
## Build WasmEdge with WASI-Logging Plug-in
12
+
13
+
To enable the WASI-Logging Plug-in, developers need to build the WasmEdge from source with the cmake option `-DWASMEDGE_PLUGIN_WASI_LOGGING=ON`.
14
+
15
+
```bash
16
+
cd<path/to/your/wasmedge/source/folder>
17
+
mkdir -p build &&cd build
18
+
cmake -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_WASI_LOGGING=ON .. && make -j
19
+
# For the WASI-Logging plug-in, you should install this project.
20
+
cmake --install .
21
+
```
22
+
23
+
> If the built `wasmedge` CLI tool cannot find the WASI-Logging plug-in, you can set the `WASMEDGE_PLUGIN_PATH` environment variable to the plug-in installation path (`/usr/local/lib/wasmedge`, or the built plug-in path `build/plugins/wasi_logging`) to try to fix this issue. You should find `libwasmedgePluginWasiLogging.so` in your `WASMEDGE_PLUGIN_PATH`
24
+
25
+
Then you will have an executable `wasmedge` runtime under `/usr/local/bin` and the WASI-Logging plug-in under `/usr/local/lib/wasmedge/libwasmedgePluginWasiLogging.so` after installation.
Copy file name to clipboardExpand all lines: docs/develop/build-and-run/aot.md
+66-74Lines changed: 66 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,68 +4,70 @@ sidebar_position: 3
4
4
5
5
# The AoT Compiler
6
6
7
-
One of the most important features of WasmEdge is the AoT compiler. The `wasmedgec` tool can compile any wasm file 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 `wasmedgec` AOT compiler, the `wasmedge` tool can execute the WASM in AOT mode which is much faster.
7
+
After [installation](../build-and-run/install.md), users can execute the `wasmedge compile` command.
8
8
9
-
Use the `wasmedgec -v` or `wasmedgec --version` command to check the version of `wasmedgec` installed.
9
+
The usage of the `wasmedge compile` command will be:
10
10
11
11
```bash
12
-
$ wasmedgec -v
13
-
wasmedge version {{ wasmedge_version }}
14
-
```
15
-
16
-
Use `wasmedgec -h` or `wasmedgec --help` to show the help message.
17
-
18
-
```bash
19
-
$ wasmedge -h
12
+
$ wasmedge compile -h
20
13
USAGE
21
-
wasmedgec [OPTIONS] [--] WASM WASM_SO
14
+
wasmedge compile [OPTIONS] [--] WASM WASM_SO
22
15
23
16
...
24
17
```
25
18
26
-
## Output Format: Universal WASM
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.
27
20
28
-
By default, the `wasmedgec` 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.
21
+
## Options
29
22
30
-
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.
23
+
The options of the `wasmedge compile` command are as follows.
31
24
32
-
<!-- prettier-ignore -->
33
-
:::note
34
-
On MacOS platforms, the universal WASM format will `bus error` in execution. It's because the `wasmedgec` tool optimizes the WASM in `O2` level by default. We are trying to fix this issue. For working around, please use the shared library output format instead.
35
-
:::
36
-
37
-
```bash
38
-
wasmedgec app.wasm app_aot.wasm
39
-
wasmedge app_aot.wasm
40
-
```
41
-
42
-
## Output Format: Shared Library
43
-
44
-
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.
45
-
46
-
This AOT-compiled WASM file is only for WasmEdge use, and cannot be used by other WebAssembly runtimes.
47
-
48
-
```bash
49
-
wasmedgec app.wasm app_aot.so
50
-
wasmedge app_aot.so
51
-
```
52
-
53
-
## Example for the AoT compiler
25
+
1.`-h|--help`: Show the help messages. Will ignore 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 the statistics of time measuring 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).
54
56
55
-
Use `wasmedgec XYZ.wasm XYZ.wasm` to compile WebAssembly into native machine code.
57
+
## Example
56
58
57
59
Take the [fibonacci.wasm](https://github.com/WasmEdge/WasmEdge/raw/master/examples/wasm/fibonacci.wasm) for example. It exported a `fib()` function which takes a single `i32` integer as the input parameter.
wasmedgec fibonacci.wasm fibonacci_aot.so # On Linux.
70
+
wasmedge compile fibonacci.wasm fibonacci_aot.so # On Linux.
69
71
```
70
72
71
73
The output will be:
@@ -79,7 +81,7 @@ The output will be:
79
81
[2022-09-09 14:22:10.600] [info] compile done
80
82
```
81
83
82
-
Next, you can execute the output file with `wasmedge` and measure the execution time:
84
+
Then you can execute the output file with `wasmedge` and measure the execution time:
83
85
84
86
```bash
85
87
time wasmedge --reactor fibonacci_aot.wasm fib 30
@@ -111,39 +113,29 @@ user 0m0.427s
111
113
sys 0m0.012s
112
114
```
113
115
114
-
## All options for the AoT compiler
116
+
## Output Format: Universal WASM
115
117
116
-
The options of the `wasmedgec` CLI tool are as follows.
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.
117
119
118
-
1.`-v|--version`: Show the version information. Will ignore other arguments below.
119
-
2.`-h|--help`: Show the help messages. Will ignore other arguments below.
120
-
3. (Optional) `--dump`: Dump the LLVM IR to `wasm.ll` and `wasm-opt.ll`.
121
-
4. (Optional) `--interruptible`: Generate the binary which supports interruptible execution.
122
-
- By default, the AOT-compiled WASM not supports [interruptions in asynchronous executions].
123
-
5. (Optional) Statistics information:
124
-
- By default, the AOT-compiled WASM not supports all statistics even if the options are turned on when running the `wasmedge` tool.
125
-
- Use `--enable-time-measuring` to generate code for enabling the statistics of time measuring in execution.
126
-
- Use `--enable-gas-measuring` to generate code for enabling the statistics of gas measuring in execution.
127
-
- Use `--enable-instruction-count` to generate code for enabling the statistics of counting WebAssembly instructions.
128
-
- Or use `--enable-all-statistics` to generate code for enabling all of the statistics.
129
-
6. (Optional) `--generic-binary`: Generate the generic binary of the current host CPU architecture.
130
-
7. (Optional) WebAssembly proposals:
131
-
- Use `--disable-import-export-mut-globals` to disable the [Import/Export of Mutable Globals](https://github.com/WebAssembly/mutable-global) proposal (Default `ON`).
132
-
- 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`).
133
-
- Use `--disable-sign-extension-operators` to disable the [Sign-Extension Operators](https://github.com/WebAssembly/sign-extension-ops) proposal (Default `ON`).
134
-
- Use `--disable-multi-value` to disable the [Multi-value](https://github.com/WebAssembly/multi-value) proposal (Default `ON`).
135
-
- Use `--disable-bulk-memory` to disable the [Bulk Memory Operations](https://github.com/WebAssembly/bulk-memory-operations) proposal (Default `ON`).
136
-
- Use `--disable-reference-types` to disable the [Reference Types](https://github.com/WebAssembly/reference-types) proposal (Default `ON`).
137
-
- Use `--disable-simd` to disable the [Fixed-width SIMD](https://github.com/webassembly/simd) proposal (Default `ON`).
138
-
- Use `--enable-multi-memory` to enable the [Multiple Memories](https://github.com/WebAssembly/multi-memory) proposal (Default `OFF`).
139
-
- Use `--enable-tail-call` to enable the [Tail call](https://github.com/WebAssembly/tail-call) proposal (Default `OFF`).
140
-
- Use `--enable-extended-const` to enable the [Extended Constant Expressions](https://github.com/WebAssembly/extended-const) proposal (Default `OFF`).
141
-
- Use `--enable-threads` to enable the [Threads](https://github.com/webassembly/threads) proposal (Default `OFF`).
142
-
- Use `--enable-all` to enable ALL proposals above.
143
-
8. (Optional) `--optimize`: Select the LLVM optimization level.
144
-
- Use `--optimize LEVEL` to set the optimization level. The `LEVEL` should be one of `0`, `1`, `2`, `3`, `s`, or `z`.
145
-
- The default value will be `2`, which means `O2`.
146
-
9. Input WASM file (`/path/to/wasm/file`).
147
-
10. Output path (`/path/to/output/file`).
148
-
- By default, the `wasmedgec` tool will output the universal Wasm format, which embeds a native code section into the Wasm file.
149
-
- If the specific file extension (`.so` on Linux, `.dylib` on MacOS, and `.dll` on Windows) is assigned in the output path, the `wasmedgec` tool will output the [shared library format](https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html).
120
+
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.
121
+
122
+
<!-- prettier-ignore -->
123
+
:::note
124
+
On MacOS platforms, the universal WASM format will `bus error` in execution. It's because the `wasmedge compile` tool optimizes the WASM in `O2` level by default. We are trying to fix this issue. For working around, please use the shared library output format instead.
125
+
:::
126
+
127
+
```bash
128
+
wasmedge compile app.wasm app_aot.wasm
129
+
wasmedge app_aot.wasm
130
+
```
131
+
132
+
## Output Format: Shared Library
133
+
134
+
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.
135
+
136
+
This AOT-compiled WASM file is only for WasmEdge use, and cannot be used by other WebAssembly runtimes.
0 commit comments