-
Notifications
You must be signed in to change notification settings - Fork 164
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
Don't use exact comparison for FP values. #2742
base: main
Are you sure you want to change the base?
Conversation
Fixes the test failure in unoptimized builds, where we do accumulate some error.
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 will look into what the actual standard requirements are but that does indeed look like something that might not be required
if(real(r) != real(z)) | ||
{ | ||
is_about(real(r), real(z)); | ||
} |
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.
We should either completely loosen the assertion or fix the code. I am for loosening it if it is not a required equality
if(real(r) != real(z)) | |
{ | |
is_about(real(r), real(z)); | |
} | |
is_about(real(r), real(z)); |
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.
We're comparing pow(i, j)
vs exp(j * log(i))
. If the compiler does not optimize the comparison away, and we actually have to do exp, log and multiplication, there's no practical way not to lose precision.
If it helps, I can make a list of the values that we happen to trip on right now, and by how much the result happens to be different. The failure I poked at had the result difference of ~1e-18.
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.
Looks like the numeric differences only affect double
, but they are pretty widespread:
https://gist.github.com/Artem-B/19807d5e4f2e3efb0e3d6319ebed1809
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.
For whatever reason I'm having trouble reproducing the issue on the host today, so it could be caused by my hacks to debug the issue. The original failure only reported the failure on a GPU. So, let's limit the scope to double
on GPU.
if(imag(r) != imag(z)) | ||
{ | ||
is_about(imag(r), imag(z)); | ||
} |
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.
Ditto
if(imag(r) != imag(z)) | |
{ | |
is_about(imag(r), imag(z)); | |
} | |
is_about(imag(r), imag(z)); |
pre-commit.ci autofix |
/ok to test |
🟩 CI finished in 1h 38m: Pass: 100%/394 | Total: 6d 23h | Avg: 25m 28s | Max: 1h 13m | Hits: 77%/25866
|
Project | |
---|---|
CCCL Infrastructure | |
+/- | libcu++ |
CUB | |
Thrust | |
CUDA Experimental | |
python | |
CCCL C Parallel Library | |
Catch2Helper |
Modifications in project or dependencies?
Project | |
---|---|
CCCL Infrastructure | |
+/- | libcu++ |
+/- | CUB |
+/- | Thrust |
+/- | CUDA Experimental |
+/- | python |
+/- | CCCL C Parallel Library |
+/- | Catch2Helper |
🏃 Runner counts (total jobs: 394)
# | Runner |
---|---|
326 | linux-amd64-cpu16 |
28 | linux-arm64-cpu16 |
25 | linux-amd64-gpu-v100-latest-1 |
15 | windows-amd64-cpu16 |
Fixes the test failure in unoptimized builds, where we do accumulate some error.
Description
The test uses exact FP comparison for the operation results, and it fails in unoptimized builds where exp/log operations are not optimized away, and we accumulate some errors.
closes #2741
Checklist