Skip to content

docs: Add LLVM thread control documentation #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion pages/runtime/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ wasmer run my_program.wasm --singlepass

> You can also use `--cranelift` or `--llvm` instead of `--singlepass`.

#### Run a Wasm file with LLVM thread control

When using the LLVM compiler, you can control how many threads are used during compilation:

```bash copy
wasmer run my_program.wasm --llvm --llvm-num-threads=4
```

> If the requested number of threads is 1, then rayon is not used during compilation, and modules are compiled on the calling thread.

### Run a WASI or WASIX Module

You can pass the arguments that will be given to the WASI program:
Expand All @@ -62,7 +72,7 @@ wasmer run my_wasi_program.wasm --env MYVAR=MYVALUE -- arg1 arg2 arg3

## Help

This is the help output from the Wasmer CLI for `wasmer run --help` (last updated 2025-01):
This is the help output from the Wasmer CLI for `wasmer run --help` (last updated 2025-04):

```
Run a WebAssembly file or Wasmer container
Expand Down Expand Up @@ -130,6 +140,11 @@ Options:
--llvm
Use LLVM compiler

--llvm-num-threads <NUM_THREADS>
Only available for the LLVM compiler. Sets the number of threads used to compile the input module(s).

If set to 1, compilation happens on the calling thread without using rayon.

--enable-verifier
Enable compiler internal verification.

Expand Down
2 changes: 2 additions & 0 deletions pages/runtime/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Each of this backends support different features, and have different support for
### Wasmer features
- **Caching**: compiled WebAssembly modules can be reused so subsequent runs of a Wasm file will have very little start up time;
- **Metering**: computation time and other resources can be monitored and limits set to control how the Wasm code runs. This is also known as "gas metering";
- **LLVM Thread Control**: control how many threads LLVM uses during compilation to optimize performance;

## Support of features by backend

Expand Down Expand Up @@ -58,6 +59,7 @@ Wasmer features:
| -------- | ---------- | --------- | ---- | -- | ----- | -------------- | ------- |
| Caching | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Metering | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Thread Control | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |


## Backend support by Operating System
Expand Down