-
Notifications
You must be signed in to change notification settings - Fork 199
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
correctly rounded divide test for half is not using a correctly rounded reference #1996
Comments
Which reminds me, we should probably disable the correctly rounded tests for fp16 and fp64; see #1901 . However, for fp16 I believe the |
Skip the correctly rounded divide (divide_cr) and sqrt (sqrt_cr) tests for fp16 and fp64. The corresponding build option to enable correctly rounded divide and sqrt is named `-cl-fp32-correctly-rounded-divide-sqrt` and the description refers only to "single precision floating-point", so this option should not apply to fp16 or fp64. The specification states that fp16 and fp64 divide and sqrt must be correctly rounded for the full profile, without needing any additional build options. This is already tested by the regular divide and sqrt tests. For the embedded profile the ULP requirement is non-zero, but there is no build option to request a correctly rounded implementation anyway. Fixes KhronosGroup#1901 . Relates to KhronosGroup#1996 . Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
When running the new fp16 divide test I get this kind of error:
As the specification states that fp16 precision for divide is |
|
For the embedded profile we need to account for the |
@b-sumner are you seeing any failures related to the excess roundings? If so, could you share some of the problematic input values? |
I haven't studied it closely, but this suggests some theorems for safe double rounding that could be helpful: https://dl.acm.org/doi/abs/10.1145/221332.221334 |
Skip the correctly rounded divide (divide_cr) and sqrt (sqrt_cr) tests for fp16 and fp64. The corresponding build option to enable correctly rounded divide and sqrt is named `-cl-fp32-correctly-rounded-divide-sqrt` and the description refers only to "single precision floating-point", so this option should not apply to fp16 or fp64. The specification states that fp16 and fp64 divide and sqrt must be correctly rounded for the full profile, without needing any additional build options. This is already tested by the regular divide and sqrt tests. For the embedded profile the ULP requirement is non-zero, but there is no build option to request a correctly rounded implementation anyway. Fixes KhronosGroup#1901 . Relates to KhronosGroup#1996 . Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
I thought I saw another patch about dropping the correctly rounded tests for non-fp32 floating point types, so perhaps this should be closed. But while I'm here I want to ask a related question about the max ulp error for half division. What I see in function_list.cpp is: 412 { "divide", Line 419 sets the half_ulps to 0.0. I would like to know where in the spec this requirement of correct rounding for half division appears or if the specified error is higher but simply not properly reflected in the test. |
Table 69 in https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#relative-error-as-ulps |
Thank you. |
…1997) Skip the correctly rounded divide (divide_cr) and sqrt (sqrt_cr) tests for fp16 and fp64. The corresponding build option to enable correctly rounded divide and sqrt is named `-cl-fp32-correctly-rounded-divide-sqrt` and the description refers only to "single precision floating-point", so this option should not apply to fp16 or fp64. The specification states that fp16 and fp64 divide and sqrt must be correctly rounded for the full profile, without needing any additional build options. This is already tested by the regular divide and sqrt tests. For the embedded profile the ULP requirement is non-zero, but there is no build option to request a correctly rounded implementation anyway. Fixes #1901 . Relates to #1996 . Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The new correctly rounded divide test for half precision, located in binary_operator_half.cpp is using an fptr for its reference function and computing the reference like this:
Here func.f_ff works out to reference_divide(). So r[j] starts with the double precision rounded result of the divide, rounds it to single precision and then rounds that to half. That's 3 roundings instead of the required single rounding.
Shouldn't this test be disabled until a correct reference is used?
The text was updated successfully, but these errors were encountered: