It looks like currently we don't define the accuracy of floating point operations.
I am running into an issue with the cos and sin web platform tests:
- WGSL spec defines floating point accuracy for some built-in functions.
- For cos, and sin , the allowed error is at most 2**-11 for fp32 and 2**-7 for fp16. However it's only for values within [-π, π]
- Our WPTs contains inputs outside of the range.
So currently some fp16 tests are failing in some bots for tflite gpu backend with output diff greater than 2**-7.
I think we can either:
a. align with the WGSL spec, so no guarantee for inputs outside of [-π, π]. And update the WPTs.
b. using the periodicity of the cos/sin function, perform range reduction by emulation before calling cos.
@fdwr @huningxin