Skip to content

Commit

Permalink
Exposes new c-api functions for configuring relaxed SIMD (#6292)
Browse files Browse the repository at this point in the history
* Exposes new c-api functions for configuring relaxed SIMD:

 - wasmtime_config_wasm_relaxed_simd_set(bool)
 - wasmtime_config_wasm_relaxed_simd_deterministic_set(bool)

* Applied rustfmt suggestion

* Added header file entries for new calls

* Fixed link to `relaxed simd proposal`
  • Loading branch information
martindevans authored Apr 27, 2023
1 parent aeb5af1 commit 5cce054
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
16 changes: 16 additions & 0 deletions crates/c-api/include/wasmtime/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,22 @@ WASMTIME_CONFIG_PROP(void, wasm_reference_types, bool)
*/
WASMTIME_CONFIG_PROP(void, wasm_simd, bool)

/**
* \brief Configures whether the WebAssembly relaxed SIMD proposal is
* enabled.
*
* This setting is `false` by default.
*/
WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd, bool)

/**
* \brief Configures whether the WebAssembly relaxed SIMD proposal is
* in deterministic mode.
*
* This setting is `false` by default.
*/
WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd_deterministic, bool)

/**
* \brief Configures whether the WebAssembly bulk memory proposal is
* enabled.
Expand Down
13 changes: 13 additions & 0 deletions crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ pub extern "C" fn wasmtime_config_wasm_simd_set(c: &mut wasm_config_t, enable: b
c.config.wasm_simd(enable);
}

#[no_mangle]
pub extern "C" fn wasmtime_config_wasm_relaxed_simd_set(c: &mut wasm_config_t, enable: bool) {
c.config.wasm_relaxed_simd(enable);
}

#[no_mangle]
pub extern "C" fn wasmtime_config_wasm_relaxed_simd_deterministic_set(
c: &mut wasm_config_t,
enable: bool,
) {
c.config.relaxed_simd_deterministic(enable);
}

#[no_mangle]
pub extern "C" fn wasmtime_config_wasm_bulk_memory_set(c: &mut wasm_config_t, enable: bool) {
c.config.wasm_bulk_memory(enable);
Expand Down
3 changes: 1 addition & 2 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,7 @@ impl Config {
///
/// The [WebAssembly SIMD proposal][proposal]. This feature gates items such
/// as the `v128` type and all of its operators being in a module. Note that
/// this does not enable the [relaxed simd proposal] as that is not
/// implemented in Wasmtime at this time.
/// this does not enable the [relaxed simd proposal].
///
/// On x86_64 platforms note that enabling this feature requires SSE 4.2 and
/// below to be available on the target platform. Compilation will fail if
Expand Down

0 comments on commit 5cce054

Please sign in to comment.