Skip to content
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

Tracking Issue for WebAssembly relaxed SIMD intrinsics #111196

Closed
2 tasks
Amanieu opened this issue May 4, 2023 · 2 comments · Fixed by #117468
Closed
2 tasks

Tracking Issue for WebAssembly relaxed SIMD intrinsics #111196

Amanieu opened this issue May 4, 2023 · 2 comments · Fixed by #117468
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Amanieu
Copy link
Member

Amanieu commented May 4, 2023

Feature gate: #![feature(stdarch_wasm_relaxed_simd)]

This is a tracking issue for WebAssmbly intrinsics for the relaxed SIMD instructions.

Public API

// core::arch::wasm32

fn i8x16_relaxed_swizzle(a: v128, s: v128) -> v128;
fn i32x4_relaxed_trunc_f32x4(a: v128) -> v128;
fn u32x4_relaxed_trunc_f32x4(a: v128) -> v128;
fn i32x4_relaxed_trunc_f64x2_zero(a: v128) -> v128;
fn u32x4_relaxed_trunc_f64x2_zero(a: v128) -> v128;
fn f32x4_relaxed_madd(a: v128, b: v128, c: v128) -> v128;
fn f32x4_relaxed_nmadd(a: v128, b: v128, c: v128) -> v128;
fn f64x2_relaxed_madd(a: v128, b: v128, c: v128) -> v128;
fn f64x2_relaxed_nmadd(a: v128, b: v128, c: v128) -> v128;
fn i8x16_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128;
fn i16x8_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128;
fn i32x4_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128;
fn i64x2_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128;
fn f32x4_relaxed_min(a: v128, b: v128) -> v128;
fn f32x4_relaxed_max(a: v128, b: v128) -> v128;
fn f64x2_relaxed_min(a: v128, b: v128) -> v128;
fn f64x2_relaxed_max(a: v128, b: v128) -> v128;
fn i16x8_relaxed_q15mulr(a: v128, b: v128) -> v128;
fn i16x8_relaxed_dot_i8x16_i7x16(a: v128, b: v128) -> v128;
fn i32x4_relaxed_dot_i8x16_i7x16_add(a: v128, b: v128, c: v128) -> v128;

Steps / History

  • Final comment period (FCP)1
  • Stabilization PR

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@Amanieu Amanieu added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC labels May 4, 2023
@Jules-Bertholet
Copy link
Contributor

@rustbot label O-wasm

@rustbot rustbot added the O-wasm Target: WASM (WebAssembly), http://webassembly.org/ label May 5, 2023
@RalfJung
Copy link
Member

RalfJung commented Nov 1, 2023

I am confused by the spec here. Quoting from https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md:

The same instruction at (1) and (2), when given the same inputs, can return two different results.

Okay, so that's normal non-determinism then. Wasm already has that for NaNs when there are non-canonical inputs, which is strangely not acknowledged here (has that changed?), but sure, makes sense.

Some operators are host-dependent, because the set of possible results may depend on properties of the host environment (such as hardware). Technically, each such operator produces a fixed-size list of sets of allowed values. For each execution of the operator in the same environment, only values from the set at the same position in the list are returned, i.e., each environment globally chooses a fixed projection for each operator.

This describes something else! IIUC, it says that the operation, when executed twice in the same environment, must produce the same result. In other words, the non-determinism is fixed once at program startup, and the example givejn just above actually cannot happen within a single program/module execution. This is closer to what we usually call implementation-specific behavior than to full non-determinism.

Can someone explain this seeming contradiction?

@bors bors closed this as completed in 9179d9b Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants