From 5ce508401e1934053b127de5bf756dcd56a326a2 Mon Sep 17 00:00:00 2001 From: "Stojiljkovic, Vladana" Date: Fri, 8 Aug 2025 15:13:39 +0200 Subject: [PATCH] SWDEV-546111 - Fix memory leaks in coopGroup tests (#509) --- .../cooperativeGrps/coalesced_groups_shfl_down_old.cc | 1 + .../cooperativeGrps/coalesced_groups_shfl_up_old.cc | 1 + catch/unit/cooperativeGrps/hipCGCoalescedGroups_old.cc | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/catch/unit/cooperativeGrps/coalesced_groups_shfl_down_old.cc b/catch/unit/cooperativeGrps/coalesced_groups_shfl_down_old.cc index 675da24dd5..f395c5978b 100644 --- a/catch/unit/cooperativeGrps/coalesced_groups_shfl_down_old.cc +++ b/catch/unit/cooperativeGrps/coalesced_groups_shfl_down_old.cc @@ -233,6 +233,7 @@ static void test_shfl_down() { HIPCHECK(hipHostFree(hPtr)); HIPCHECK(hipFree(dPtr)); + HIPCHECK(hipFree(dResults)); free(cpuResultsArr); } } diff --git a/catch/unit/cooperativeGrps/coalesced_groups_shfl_up_old.cc b/catch/unit/cooperativeGrps/coalesced_groups_shfl_up_old.cc index 54cd62c197..0118caf45b 100644 --- a/catch/unit/cooperativeGrps/coalesced_groups_shfl_up_old.cc +++ b/catch/unit/cooperativeGrps/coalesced_groups_shfl_up_old.cc @@ -221,6 +221,7 @@ static void test_shfl_up() { HIPCHECK(hipHostFree(hPtr)); HIPCHECK(hipFree(dPtr)); + HIPCHECK(hipFree(dResults)); free(cpuResultsArr); } } diff --git a/catch/unit/cooperativeGrps/hipCGCoalescedGroups_old.cc b/catch/unit/cooperativeGrps/hipCGCoalescedGroups_old.cc index 11933e99d1..9f0d2d8541 100644 --- a/catch/unit/cooperativeGrps/hipCGCoalescedGroups_old.cc +++ b/catch/unit/cooperativeGrps/hipCGCoalescedGroups_old.cc @@ -394,6 +394,8 @@ static void test_shfl_any_to_any() { HIPCHECK(hipHostFree(hPtr)); HIPCHECK(hipFree(dPtr)); + HIPCHECK(hipFree(dResults)); + HIPCHECK(hipFree(dsrcArr)); free(srcArr); free(srcArrCpu); free(cpuResultsArr); @@ -461,6 +463,7 @@ static void test_shfl_broadcast() { HIPCHECK(hipHostFree(hPtr)); HIPCHECK(hipFree(dPtr)); + HIPCHECK(hipFree(dResults)); free(cpuResultsArr); } } @@ -554,4 +557,11 @@ TEST_CASE("Unit_coalesced_groups") { std::cout << "Now grouping active threads based on branch divergence" << '\n' << std::endl; test_active_threads_grouping(); + + HIPCHECK(hipFree(d_data_to_filter)); + HIPCHECK(hipFree(d_filtered_data)); + HIPCHECK(hipFree(d_nres)); + free(data_to_filter); + free(filtered_data); + free(host_filtered_data); }