From a7f00a6b2c1908829cb9689a6cc245c194cc8e07 Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Tue, 1 Mar 2022 17:40:39 +0000 Subject: [PATCH] Remove fpenv from overview, add proposed spec text on Relaxed operations --- proposals/relaxed-simd/Overview.md | 56 +++++------------------------- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/proposals/relaxed-simd/Overview.md b/proposals/relaxed-simd/Overview.md index 7f5378bd..39dcd90a 100644 --- a/proposals/relaxed-simd/Overview.md +++ b/proposals/relaxed-simd/Overview.md @@ -59,54 +59,14 @@ that instruction). One can imagine splitting an application's module and running them on multiple runtimes, where the runtimes produce different results - this can be surprising to the application. -Applications can specify their consistency needs using a new module-level -entity `fpenv` (name subject to change). A `fpenv` is defined in the `fpenv` -section of a module. All Relaxed SIMD instructions will take an additional -`varuint32` immediate, which is an index into the `fpenv` index space: - -```wast -(module - (func (param v128 v128 v128) - (f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)) ;; (1) - ;; ... - (f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)) ;; (2) - ) - (fpenv $fpu 0)) -``` - -In the example above, both `f32x4.qfma` instructions refer to the same `fpenv`, -and will get the same results when given the same input. - -A `fpenv` has a single `varuint32` attribute which is reserved for future -extensibility and must be `0` for now. The value of an `fpenv` is -non-deterministically computed when the module which declares it is -instantiated. This value determines the semantics of the instructions that -uses it as an immediate. - -As such, all the non-determinism of Relaxed SIMD is encapsulated in `fpenv`, -which makes Relaxed SIMD instructions themselves deterministic. - -Modules can import/export an `fpenv` to specify consistency requirements: - -```wast -;; module a -(module - (fpenv $fpu (export "foo") 0) - (func (param v128 v128 v128) - (f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)))) ;; (1) -``` - -```wast -;; module b -(module - (import "a" "foo" (fpenv $fpu 0)) - (func (param v128 v128 v128) - (f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)))) ;; (2) -``` - -In the above example, the same `fpenv` is exported by module `a`, and imported -by module `b`, so instructions `(1)` and `(2)` will consistently return the -same results when given the same inputs. +The specification is updated with the idea of "Relaxed operations": + +> 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. ## Instructions