From 7cd3834987c7bd635c4758b939544518cb3d1236 Mon Sep 17 00:00:00 2001 From: Suraj Aralihalli Date: Mon, 29 Jan 2024 10:34:35 -0800 Subject: [PATCH] revert sum agg (#14907) This pull request reverses the modifications made to the sum/product aggregation target type, ensuring it always produces int64. The changes implemented by PR [14679](https://github.com/rapidsai/cudf/pull/14679) which led to degraded performance when the aggregation column had an unsigned type, are reverted. Additional details can be found in the issue [14886](https://github.com/rapidsai/cudf/issues/14886). Authors: - Suraj Aralihalli (https://github.com/SurajAralihalli) Approvers: - David Wendt (https://github.com/davidwendt) - Nghia Truong (https://github.com/ttnghia) - Karthikeyan (https://github.com/karthikeyann) --- cpp/include/cudf/detail/aggregation/aggregation.hpp | 4 ++-- cpp/tests/groupby/sum_tests.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cpp/include/cudf/detail/aggregation/aggregation.hpp b/cpp/include/cudf/detail/aggregation/aggregation.hpp index c35d56b4c13..a8f164646a5 100644 --- a/cpp/include/cudf/detail/aggregation/aggregation.hpp +++ b/cpp/include/cudf/detail/aggregation/aggregation.hpp @@ -1234,12 +1234,12 @@ constexpr bool is_sum_product_agg(aggregation::Kind k) (k == aggregation::SUM_OF_SQUARES); } -// Summing/Multiplying integers of any type, always use uint64_t for unsigned and int64_t for signed +// Summing/Multiplying integers of any type, always use int64_t accumulator template struct target_type_impl && is_sum_product_agg(k)>> { - using type = std::conditional_t, uint64_t, int64_t>; + using type = int64_t; }; // Summing fixed_point numbers diff --git a/cpp/tests/groupby/sum_tests.cpp b/cpp/tests/groupby/sum_tests.cpp index abf25eb0aa9..03cc3fab568 100644 --- a/cpp/tests/groupby/sum_tests.cpp +++ b/cpp/tests/groupby/sum_tests.cpp @@ -28,10 +28,10 @@ using namespace cudf::test::iterators; template struct groupby_sum_test : public cudf::test::BaseFixture {}; -using K = int32_t; -using supported_types = cudf::test::Concat< - cudf::test::Types, - cudf::test::DurationTypes>; +using K = int32_t; +using supported_types = + cudf::test::Concat, + cudf::test::DurationTypes>; TYPED_TEST_SUITE(groupby_sum_test, supported_types); @@ -40,9 +40,6 @@ TYPED_TEST(groupby_sum_test, basic) using V = TypeParam; using R = cudf::detail::target_type_t; - static_assert(std::is_signed_v == std::is_signed_v, - "Both Result type and Source type must have same signedness"); - cudf::test::fixed_width_column_wrapper keys{1, 2, 3, 1, 2, 2, 1, 3, 3, 2}; cudf::test::fixed_width_column_wrapper vals{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};