From 1b94b507b2656f19038c73d70d492da0739a06ec Mon Sep 17 00:00:00 2001 From: Wayne Franz Date: Wed, 15 Jan 2025 11:36:18 -0500 Subject: [PATCH 1/2] Limit test_hipcub_device_radix_sort memory usage On Windows, HipcubDeviceRadixSort.SortKeysLargeSizes fails due to an out of memory error on some devices. This happens because of an issue that sometimes causes hipMalloc to return hipSuccess for some allocation requests that are too large. This prevents us from being able to reliably detect whether a data size is too large for the test. This change works around the problem for now by limiting the data sizes that used are used for the test. --- CHANGELOG.md | 3 +++ test/hipcub/test_hipcub_device_radix_sort.hpp | 2 +- test/hipcub/test_utils_data_generation.hpp | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21ed041c..56e67482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ Full documentation for hipCUB is available at [https://rocm.docs.amd.com/project * The NVIDIA backend now requires CUB, Thrust and libcu++ 2.5.0. If it is not found it will be downloaded from the NVIDIA CCCL repository. * Changed the C++ version from 14 to 17. C++14 will be deprecated in the next major release. +### Known issues +* When building on Windows using the HIP SDK release for ROCm 6.4, hipMalloc currently returns hipSuccess for some sizes that are larger than it can allocate. For this reason, we've limited the maximum test case sizes for some unit tests (eg. HipcubDeviceRadixSort's SortKeysLargeSizes test). + ## hipCUB 3.3.0 for ROCm 6.3.0 ### Added diff --git a/test/hipcub/test_hipcub_device_radix_sort.hpp b/test/hipcub/test_hipcub_device_radix_sort.hpp index 8c4eaee3..e3365c3d 100644 --- a/test/hipcub/test_hipcub_device_radix_sort.hpp +++ b/test/hipcub/test_hipcub_device_radix_sort.hpp @@ -1215,7 +1215,7 @@ inline void sort_keys_large_sizes() hipStream_t stream = 0; - const std::vector sizes = test_utils::get_large_sizes(seeds[0]); + const std::vector sizes = test_utils::get_large_sizes<34>(seeds[0]); for(const size_t size : sizes) { SCOPED_TRACE(testing::Message() << "with size = " << size); diff --git a/test/hipcub/test_utils_data_generation.hpp b/test/hipcub/test_utils_data_generation.hpp index 28d3c4e1..e490986d 100644 --- a/test/hipcub/test_utils_data_generation.hpp +++ b/test/hipcub/test_utils_data_generation.hpp @@ -473,18 +473,19 @@ inline std::vector get_random_data01(size_t size, float p, int seed_value) return data; } +template inline std::vector get_large_sizes(int seed_value) { // clang-format off std::vector sizes = { (size_t{1} << 32) - 1, size_t{1} << 32, - (size_t{1} << 35) - 1, size_t{1} << 35 + (size_t{1} << MaxPow2) - 1, size_t{1} << MaxPow2 }; // clang-format on const std::vector random_sizes = test_utils::get_random_data(2, (size_t{1} << 30) + 1, - (size_t{1} << 35) - 2, + (size_t{1} << MaxPow2) - 2, seed_value); sizes.insert(sizes.end(), random_sizes.begin(), random_sizes.end()); std::sort(sizes.begin(), sizes.end()); From e5a77c9ac370e75ed4054a084d5298b8f563a32f Mon Sep 17 00:00:00 2001 From: Wayne Franz Date: Mon, 20 Jan 2025 11:56:44 -0500 Subject: [PATCH 2/2] Update CHANGELOG.md Co-authored-by: spolifroni-amd --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e67482..5a13e148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ Full documentation for hipCUB is available at [https://rocm.docs.amd.com/project * Changed the C++ version from 14 to 17. C++14 will be deprecated in the next major release. ### Known issues -* When building on Windows using the HIP SDK release for ROCm 6.4, hipMalloc currently returns hipSuccess for some sizes that are larger than it can allocate. For this reason, we've limited the maximum test case sizes for some unit tests (eg. HipcubDeviceRadixSort's SortKeysLargeSizes test). +* When building on Windows using HIP SDK for ROCm 6.4, ``hipMalloc`` returns ``hipSuccess`` even when the size passed to it is too large and the allocation fails. Because of this, limits have been set for the maximum test case sizes for some unit tests such as HipcubDeviceRadixSort's SortKeysLargeSizes . ## hipCUB 3.3.0 for ROCm 6.3.0