WebAssembly / relaxed-simd

Relax the strict determinism requirements of SIMD operations.
Other
38 stars 6 forks source link

Behavior of relaxed operations for multi-tier compilers #141

Open yurydelendik opened 1 year ago

yurydelendik commented 1 year ago

The https://github.com/WebAssembly/relaxed-simd/blob/c4c9ddaf0d8b086f64531ed80604b44e6f19efec/document/core/exec/numerics.rst#relaxed-operations specifies:

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.

For JS engines, it is common to use interpreter or baseline compiler first, continue compilation in the optimizing compiler, and then hot-swap interpreter/non-optimized code with optimized one.

Is it allowed for an engine to choose values from the set at one position e.g. in the baseline tier, and later (for any reason) choose values from the set at different position in the optimizing tier?

Maratyszcza commented 1 year ago

As switching the compiler tier is invisible to the user, they're considered the same environments, and all compilation tiers should choose the same position in the set.