-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Determinism] Add deterministic functions #216
Conversation
Are there any specific changes I should look for in |
libsleefgnuabi should be unchanged. |
Thank you. Does it mean that the deterministic versions of the functions are not compiled in libsleefgnuabi? |
At this time, no new functions are added to libsleefgnuabi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how the DETERMINISTIC version are tested with CI in this patch. Could you please explain how this is happening? Or point at CI logs showing that the deterministic tests are executed together with the non deterministic ones?
Please modify the body of the functions according to the comment below.
src/libm/sleefsimddp.c
Outdated
@@ -389,6 +393,13 @@ static INLINE CONST ddi_t rempi(vdouble a) { | |||
return ret; | |||
} | |||
|
|||
#if !defined(DETERMINISTIC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the function is always called "xsin" in C code, I would prefer to have the #if !defined(DETERMINISTIC)
switch inside the function definition:
EXPORT CONST vdouble xsin(vdouble d) {
#if !defined(DETERMINISTIC)
// original version
#else // #if !defined(DETERMINISTIC)
// deterministic version
#endif // #if !defined(DETERMINISTIC)
}
Could you please apply this change to all the function definitions of this change-set in which you have introduced DETERMINISTIC behavior?
This is quite important because our downstream version of SLEEF is using the attribute aarch64_vector_pcs
[1], and having only one declaration instead of two will make merging easier.
[1] https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi section 2.1
Thank you for explaining, I don't see a need to add deterministic functions to |
The iut programs whose name begins with "iuty" are the iut for the deterministic version of functions. By checking the result of testing with iutysse2, for example, you can be sure that the corresponding deterministic functions passes the accuracy and nonnumber tests. I will add bit-identity tests in the next patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just minor changes I am asking you to do, in terms of comments. After these, I will approve the review, but I'd prefer you wait for a final OK from @xoofx before merging it to master. Please add him as a reviewer.
src/libm-tester/CMakeLists.txt
Outdated
@@ -85,6 +85,20 @@ macro(test_extension SIMD) | |||
add_test_iut(${TARGET_IUT${SIMD}}) | |||
list(APPEND IUT_LIST ${TARGET_IUT${SIMD}}) | |||
|
|||
string(CONCAT IUTYNAME "iuty" ${LCSIMD}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment in the source explaining the difference between iut and iuty
src/libm-tester/CMakeLists.txt
Outdated
@@ -100,6 +114,18 @@ macro(test_extension SIMD) | |||
if (MPFR_INCLUDE_DIR) | |||
target_include_directories(${T} PRIVATE ${MPFR_INCLUDE_DIR}) | |||
endif() | |||
|
|||
set(T "tester2y${SCSIMD}${P}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, make sure the distinction between the old tester2 and tester2y is clear
src/libm/sleefsimdsp.c
Outdated
|
||
#if !defined(DETERMINISTIC) && !defined(ENABLE_GNUABI) | ||
|
||
#ifdef ENABLE_ALIAS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what are these alias for? Please do it in a comment in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing. On our side, another priority came into the project, so we have postponed deterministic implementation to Q4 (or worse to Q1/2019), but I will try to plug it into our compiler - around September - at least to check that things are running correctly
@xoofx No problem. |
This patch adds implementations of deterministic functions.
The SIMD source files(sleefsimd?p.c) are compiled twice for each vector extension, with DETERMINISTIC macro turned on and off.
Renaming by rename*.h is switched according to DETERMINISTIC macro.
When DETERMINISTIC macro is undefined, the function name xsin will be renamed to Sleef_sind2_u35sse2 with renamesse2.h, for example.
If DETERMINISTIC macro is defined, the function name xsin will be renamed to Sleef_cinz_sind2_u35sse2, for example.
iuty* and tester2y* are added in order to test the newly added deterministic functions. As a consequence, time for testing is increased to almost two times.