Description
Filing this issue to track the discussions we have had over in WebAssembly/design#1401. (I tried to summarize the discussion to seed this issue with some content, any misrepresentation of the discussion that happened there is entirely my fault.)
The gist of the problem is, given an instruction that is specified to be non-deterministic (e.g. quasi-FMA (qfma)), it is valid (though unlikely in a Web VM) for two adjacent calls to the same instruction to return two different results, e.g.:
function foo:
qfma(x, y, z); // returns result with 1 rounding (real fma)
qfma(x, y, z); // returns result with 2 roundings (mul + add)
One idea from @sunfishcode WebAssembly/design#1401 (comment) is an opaque fpenv
value that these instructions will take.
Another idea from the same author is "intrinsic functions" WebAssembly/design#1401 (comment).
The key goal with both ideas is allowing applications to be able to specify this need for consistency.
One counter-argument (by @tlively) is that the usefulness of this ability to express such fine-grained intent is not worth the complexity, see WebAssembly/design#1401 (comment), especially for Web use cases.
Another issue (by @Maratyszcza) is that the fpenv/intrinsic functions will not resolve under-specified instructions like reciprocal algorithms, since they differ across processor models, and no way to emulate them. However, full emulation isn't the goal.