-
Hi everyone, Question: Is it possible to build sleef for all of our platforms so that it gives equal results for trigonometric functions everywhere? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello! Thanks for starting a discussion on this, this is an important topic in SLEEF. This topic has been discussed in several issues so far under various terminology, such as determinism, bitwise reproducibility, consistency,... As you might know there are various declinations of it, reproducibility can be required across architectures/platforms or simply between scalar and vector implementations (or even across vector extensions). For reproducibility across platforms and vector extensions (ISAs), availability of FMA instructions is what matters most. If some of your platforms don't have FMA enabled/available, then you will need to disable FMAs on all ISAs to ensure reproducibility, which will have a significant impact on performance (but you said you might be ok with it). Similarly, FTZ is not a feature that is consistent across platform (with impact on float to integer conversions). Determinism was added as a feature by this PR #204, and the corresponding implementations have finz or cinz in the name. Looks like you are lucky because most important routines (including trigonometric routines) support it, and they exist in different precisions and accuracies too. Here is an exhaustive list: sleef/src/libm-tester/hash_finz.txt Line 4 in 69cfa71 If you need scalar to vector determinism then these routines are also available in scalar flavour (as discussed here #443 or #444). This is certainly something we want to document more accurately in the future. Let us know if you are facing difficulties using them and please report a bug if you notice some flaws in the implementations. Regards, |
Beta Was this translation helpful? Give feedback.
-
@xoofx I know you have been involved in introducing this feature, feel free to complete my answer if I missed something. Cheers! |
Beta Was this translation helpful? Give feedback.
Hello! Thanks for starting a discussion on this, this is an important topic in SLEEF.
This topic has been discussed in several issues so far under various terminology, such as determinism, bitwise reproducibility, consistency,... As you might know there are various declinations of it, reproducibility can be required across architectures/platforms or simply between scalar and vector implementations (or even across vector extensions).
I encourage you to browse through existing issues (https://github.com/shibatch/sleef/issues?q=is%3Aopen+is%3Aissue+label%3Adeterminism), to see if one is more appropriate to your use case.
For reproducibility across platforms and vector extensions (ISAs), avai…