Skip to content

Commit 9d1a8a8

Browse files
authored
Merge pull request #58 from ngzhian/remove-fpenv
Remove fpenv from overview, add proposed spec text on Relaxed operations
2 parents 8f0a216 + a7f00a6 commit 9d1a8a8

File tree

1 file changed

+8
-48
lines changed

1 file changed

+8
-48
lines changed

proposals/relaxed-simd/Overview.md

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -59,54 +59,14 @@ that instruction). One can imagine splitting an application's module and
5959
running them on multiple runtimes, where the runtimes produce
6060
different results - this can be surprising to the application.
6161

62-
Applications can specify their consistency needs using a new module-level
63-
entity `fpenv` (name subject to change). A `fpenv` is defined in the `fpenv`
64-
section of a module. All Relaxed SIMD instructions will take an additional
65-
`varuint32` immediate, which is an index into the `fpenv` index space:
66-
67-
```wast
68-
(module
69-
(func (param v128 v128 v128)
70-
(f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)) ;; (1)
71-
;; ...
72-
(f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)) ;; (2)
73-
)
74-
(fpenv $fpu 0))
75-
```
76-
77-
In the example above, both `f32x4.qfma` instructions refer to the same `fpenv`,
78-
and will get the same results when given the same input.
79-
80-
A `fpenv` has a single `varuint32` attribute which is reserved for future
81-
extensibility and must be `0` for now. The value of an `fpenv` is
82-
non-deterministically computed when the module which declares it is
83-
instantiated. This value determines the semantics of the instructions that
84-
uses it as an immediate.
85-
86-
As such, all the non-determinism of Relaxed SIMD is encapsulated in `fpenv`,
87-
which makes Relaxed SIMD instructions themselves deterministic.
88-
89-
Modules can import/export an `fpenv` to specify consistency requirements:
90-
91-
```wast
92-
;; module a
93-
(module
94-
(fpenv $fpu (export "foo") 0)
95-
(func (param v128 v128 v128)
96-
(f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)))) ;; (1)
97-
```
98-
99-
```wast
100-
;; module b
101-
(module
102-
(import "a" "foo" (fpenv $fpu 0))
103-
(func (param v128 v128 v128)
104-
(f32x4.qfma $fpu (local.get 0) (local.get 1) (local.get 2)))) ;; (2)
105-
```
106-
107-
In the above example, the same `fpenv` is exported by module `a`, and imported
108-
by module `b`, so instructions `(1)` and `(2)` will consistently return the
109-
same results when given the same inputs.
62+
The specification is updated with the idea of "Relaxed operations":
63+
64+
> Some operators are host-dependent, because the set of possible results may
65+
> depend on properties of the host environment (such as hardware). Technically,
66+
> each such operator produces a fixed-size list of sets of allowed values. For
67+
> each execution of the operator in the same environment, only values from the
68+
> set at the same position in the list are returned, i.e., each environment
69+
> globally chooses a fixed projection for each operator.
11070
11171
## Instructions
11272

0 commit comments

Comments
 (0)