diff --git a/CHANGELOG.md b/CHANGELOG.md index 59f45f150..f65a20eb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Documentation for rocPRIM is available at * device merge, * device partial sort, and/or * device sort (merge sort). +* Fixed an issue where on certain inputs to block_sort_merge, device_merge_sort_merge_path, device_merge, and warp_sort_stable would cause an assertion error during its call to serial_merge ### Deprecations diff --git a/rocprim/include/rocprim/detail/merge_path.hpp b/rocprim/include/rocprim/detail/merge_path.hpp index 8cdd51d33..eb61fb627 100644 --- a/rocprim/include/rocprim/detail/merge_path.hpp +++ b/rocprim/include/rocprim/detail/merge_path.hpp @@ -100,8 +100,8 @@ void serial_merge(KeyType* keys_shared, OutputFunction output_function) { // Pre condition, we're including some edge cases too. - assert(range.begin1 <= range.end1); - assert(range.begin2 <= range.end2); + if (!AllowUnsafe && range.begin1 > range.end1 && range.begin2 > range.end2) + return; // don't do anything, we have invalid inputs // More descriptive names for ranges: auto idx_a = range.begin1;