-
Notifications
You must be signed in to change notification settings - Fork 915
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
Fix integer overflow in shim device_sum
functions
#13943
Conversation
python/cudf/udf_cpp/shim.cu
Outdated
int64_t size, | ||
T* sum) | ||
template <typename T, std::enable_if_t<std::is_integral_v<T>, int> = 0> | ||
__device__ int64_t device_sum(cooperative_groups::thread_block const& block, |
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.
Rather than writing an entirely new SFINAE overload, could we have a single kernel and write something like this in a second template parameter:
typename AccumT = std::conditional<std::is_integral_v<T>, int64_t, T>
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.
yes! was hoping someone would comment with something like this :)
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.
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.
Should be updated! Looking much cleaner now, thanks.
I think this makes sense. Of course, there are many ways to still get a bad result, but pandas also gets a bad result in those cases. Overflowing int64 is the natural one, but pandas hilariously converts a sum of |
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.
Python test changes
Co-authored-by: Bradley Dice <[email protected]>
/merge |
Closes #13873