From a8c43aa3712dddabd372843c347df50b5d7b8cb6 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Wed, 23 Nov 2022 10:04:39 -0500 Subject: [PATCH 1/3] Patch CUB DeviceSegmentedSort and remove workaround --- .../patches/cub_segmented_sort_with_bool_key.diff | 15 +++++++++++++++ cpp/cmake/thirdparty/patches/thrust_override.json | 5 +++++ cpp/src/sort/segmented_sort.cu | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff diff --git a/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff b/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff new file mode 100644 index 00000000000..9c7d33fedf0 --- /dev/null +++ b/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff @@ -0,0 +1,15 @@ +diff --git a/dependencies/cub/cub/agent/agent_sub_warp_merge_sort.cuh b/dependencies/cub/cub/agent/agent_sub_warp_merge_sort.cuh +index ad65f2a3..ad45a21e 100644 +--- a/dependencies/cub/cub/agent/agent_sub_warp_merge_sort.cuh ++++ b/dependencies/cub/cub/agent/agent_sub_warp_merge_sort.cuh +@@ -221,7 +221,8 @@ public: + using UnsignedBitsT = typename Traits::UnsignedBits; + UnsignedBitsT default_key_bits = IS_DESCENDING ? Traits::LOWEST_KEY + : Traits::MAX_KEY; +- KeyT oob_default = reinterpret_cast(default_key_bits); ++ KeyT oob_default = std::is_same_v ? !IS_DESCENDING ++ : reinterpret_cast(default_key_bits); + + WarpLoadKeysT(storage.load_keys) + .Load(keys_input, keys, segment_size, oob_default); + diff --git a/cpp/cmake/thirdparty/patches/thrust_override.json b/cpp/cmake/thirdparty/patches/thrust_override.json index f1908a64719..f8b758663b7 100644 --- a/cpp/cmake/thirdparty/patches/thrust_override.json +++ b/cpp/cmake/thirdparty/patches/thrust_override.json @@ -27,6 +27,11 @@ "file" : "${current_json_dir}/thrust_faster_scan_compile_times.diff", "issue" : "Improve Thrust scan compile times by reducing the number of kernels generated [https://github.com/rapidsai/cudf/pull/8183]", "fixed_in" : "" + }, + { + "file" : "${current_json_dir}/cub_segmented_sort_with_bool_key.diff", + "issue" : "Fix an error in CUB DeviceSegmentedSort when the keys are bool type [https://github.com/NVIDIA/cub/issues/594]", + "fixed_in" : "" } ] } diff --git a/cpp/src/sort/segmented_sort.cu b/cpp/src/sort/segmented_sort.cu index dc87d5ea326..685d8aa3ec1 100644 --- a/cpp/src/sort/segmented_sort.cu +++ b/cpp/src/sort/segmented_sort.cu @@ -52,7 +52,7 @@ struct column_fast_sort_fn { static bool is_fast_sort_supported(column_view const& col) { return !col.has_nulls() and - ((cudf::is_integral(col.type()) && !cudf::is_boolean(col.type())) || + (cudf::is_integral(col.type()) || (cudf::is_fixed_point(col.type()) and (col.type().id() != type_id::DECIMAL128))); } From 7ff1c5d4cb62eef051fc7bf8dfefb3d47148b950 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Wed, 23 Nov 2022 10:13:23 -0500 Subject: [PATCH 2/3] fix style violation --- .../thirdparty/patches/cub_segmented_sort_with_bool_key.diff | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff b/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff index 9c7d33fedf0..7c40fd4287d 100644 --- a/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff +++ b/cpp/cmake/thirdparty/patches/cub_segmented_sort_with_bool_key.diff @@ -12,4 +12,3 @@ index ad65f2a3..ad45a21e 100644 WarpLoadKeysT(storage.load_keys) .Load(keys_input, keys, segment_size, oob_default); - From bb4510c71b2034111f85a137b0b3ff2e8e4b7d08 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Mon, 28 Nov 2022 09:04:37 -0500 Subject: [PATCH 3/3] set fixed_in to 2.1 --- cpp/cmake/thirdparty/patches/thrust_override.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/patches/thrust_override.json b/cpp/cmake/thirdparty/patches/thrust_override.json index f8b758663b7..ded2b90eeba 100644 --- a/cpp/cmake/thirdparty/patches/thrust_override.json +++ b/cpp/cmake/thirdparty/patches/thrust_override.json @@ -31,7 +31,7 @@ { "file" : "${current_json_dir}/cub_segmented_sort_with_bool_key.diff", "issue" : "Fix an error in CUB DeviceSegmentedSort when the keys are bool type [https://github.com/NVIDIA/cub/issues/594]", - "fixed_in" : "" + "fixed_in" : "2.1" } ] }