-
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
[BUG] Sorted sum aggregations are not performed in the result type #10246
Comments
The input values should be cast to the result type when doing the reduction, but they aren't: cudf/cpp/src/groupby/sort/group_single_pass_reduction_util.cuh Lines 207 to 208 in 10faad9
|
@ttnghia could you fix this? I believe you worked on this code most recently. |
Sure. I'll look into it. |
Issue #9988 is somewhat related -- both pertain to performing computations in the output precision rather than the input precision. It might be worth investigating whether this problem is commonly occurring in the codebase. |
Hah, yes that is similar. Fixing everything should be a bigger PR instead. |
Keep PR scopes small and fix issues one at a time — I just wanted to make a note that this might not be an isolated problem. We should keep our eyes out for similar cases in other algorithms since at least two such issues have been found. edit: I see the previous comment was edited and now agrees with keeping PR scopes small. 😉 |
… of target type (#10250) In groupby reductions, some operations such as SUM on integers have the output type different from the source type. For example, target type is int64 while the source type is int32. This is to prevent overflow of the computation result. This fixes a bug in groupby reductions that perform computation using the data in source type instead of target type. Closes #10246. Authors: - Nghia Truong (https://github.com/ttnghia) Approvers: - Mike Wilson (https://github.com/hyperbolic2346) - Conor Hoekstra (https://github.com/codereport) URL: #10250
Describe the bug
When libcudf performs a sum aggregation on INT32 inputs it produces an INT64 output. This works as expected when the aggregation is using a hash-based implementation, but when cudf decides to use a sort-based implementation the output type is indeed INT64 but apparently the sum is being performed in INT32 and only casted to INT64 at the end. This can result in overflows that would not have occurred if the sum operation was performed in INT64.
Steps/Code to reproduce bug
Apply the following patch and run GROUPBY_TEST. Note how the hash-based aggregation passes but the sort-based aggregation fails, producing a sum of 0 instead of -4294967296
Expected behavior
Sum aggregations should be performed in the result type rather than the input type. In addition, the behavior of hash-based and sort-based aggregations for an individual output row should be equivalent from the caller's perspective for sorted inputs.
The text was updated successfully, but these errors were encountered: