Skip to content

Commit 5cce054

Browse files
authored
Exposes new c-api functions for configuring relaxed SIMD (#6292)
* 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`
1 parent aeb5af1 commit 5cce054

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

crates/c-api/include/wasmtime/config.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,22 @@ WASMTIME_CONFIG_PROP(void, wasm_reference_types, bool)
165165
*/
166166
WASMTIME_CONFIG_PROP(void, wasm_simd, bool)
167167

168+
/**
169+
* \brief Configures whether the WebAssembly relaxed SIMD proposal is
170+
* enabled.
171+
*
172+
* This setting is `false` by default.
173+
*/
174+
WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd, bool)
175+
176+
/**
177+
* \brief Configures whether the WebAssembly relaxed SIMD proposal is
178+
* in deterministic mode.
179+
*
180+
* This setting is `false` by default.
181+
*/
182+
WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd_deterministic, bool)
183+
168184
/**
169185
* \brief Configures whether the WebAssembly bulk memory proposal is
170186
* enabled.

crates/c-api/src/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ pub extern "C" fn wasmtime_config_wasm_simd_set(c: &mut wasm_config_t, enable: b
8181
c.config.wasm_simd(enable);
8282
}
8383

84+
#[no_mangle]
85+
pub extern "C" fn wasmtime_config_wasm_relaxed_simd_set(c: &mut wasm_config_t, enable: bool) {
86+
c.config.wasm_relaxed_simd(enable);
87+
}
88+
89+
#[no_mangle]
90+
pub extern "C" fn wasmtime_config_wasm_relaxed_simd_deterministic_set(
91+
c: &mut wasm_config_t,
92+
enable: bool,
93+
) {
94+
c.config.relaxed_simd_deterministic(enable);
95+
}
96+
8497
#[no_mangle]
8598
pub extern "C" fn wasmtime_config_wasm_bulk_memory_set(c: &mut wasm_config_t, enable: bool) {
8699
c.config.wasm_bulk_memory(enable);

crates/wasmtime/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,7 @@ impl Config {
666666
///
667667
/// The [WebAssembly SIMD proposal][proposal]. This feature gates items such
668668
/// as the `v128` type and all of its operators being in a module. Note that
669-
/// this does not enable the [relaxed simd proposal] as that is not
670-
/// implemented in Wasmtime at this time.
669+
/// this does not enable the [relaxed simd proposal].
671670
///
672671
/// On x86_64 platforms note that enabling this feature requires SSE 4.2 and
673672
/// below to be available on the target platform. Compilation will fail if

0 commit comments

Comments
 (0)