-
Notifications
You must be signed in to change notification settings - Fork 94
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
Gracefully handle overflows #1112
Comments
it will give wrong result when input is indeed -1? |
Can you think of a place where we use |
From prefix sum name, I would expect it allows the negative input if the type is signed type. |
Good point - either add a parameter |
There are many places where integer computations might overflow in Ginkgo. I think the most important one is the
prefix_sum
kernel. So I would like to suggest that we add an overflow guard to it, by slightly modifying the addition operation to return-1
on overflow or if one of the operands is also-1
. Then we can check the resulting value after the kernel has finished and throw an appropriate exception.This gives a nicer error message than the
cuda: failed to allocate memory block of 18446744066997193496B
we usually get.The text was updated successfully, but these errors were encountered: