From 12ad8421bb7179b08e2456306d003284d7044fe3 Mon Sep 17 00:00:00 2001 From: vstojilj Date: Thu, 4 Sep 2025 17:21:32 +0200 Subject: [PATCH] SWDEV-549700 - Add missing destroy calls (#755) --- .../deviceLib/AtomicsWithRandomActiveLanesInWavefront.cc | 4 ++++ projects/hip-tests/catch/unit/deviceLib/anyAll.cc | 2 ++ projects/hip-tests/catch/unit/deviceLib/ballot.cc | 1 + projects/hip-tests/catch/unit/deviceLib/bfloat16.cc | 4 ++++ .../hip-tests/catch/unit/deviceLib/deviceAllocation.cc | 1 + projects/hip-tests/catch/unit/deviceLib/fp8_ocp.cc | 8 ++++++++ projects/hip-tests/catch/unit/deviceLib/funnelshift.cc | 5 +++++ .../hip-tests/catch/unit/deviceLib/hipDeviceMemcpy.cc | 3 +++ projects/hip-tests/catch/unit/deviceLib/hipTestClock.cc | 3 +++ projects/hip-tests/catch/unit/deviceLib/hipTestFMA.cc | 4 ++++ projects/hip-tests/catch/unit/deviceLib/hipTestHost.cc | 2 ++ projects/hip-tests/catch/unit/deviceLib/hipTestNew.cc | 2 ++ 12 files changed, 39 insertions(+) diff --git a/projects/hip-tests/catch/unit/deviceLib/AtomicsWithRandomActiveLanesInWavefront.cc b/projects/hip-tests/catch/unit/deviceLib/AtomicsWithRandomActiveLanesInWavefront.cc index 3798292a7e..d6ef49d7fd 100644 --- a/projects/hip-tests/catch/unit/deviceLib/AtomicsWithRandomActiveLanesInWavefront.cc +++ b/projects/hip-tests/catch/unit/deviceLib/AtomicsWithRandomActiveLanesInWavefront.cc @@ -550,6 +550,7 @@ static void runFloatTest() { // Cleanup memory free(hOData); + free(hIActiveLanes); HIP_CHECK(hipFree(dOData)); HIP_CHECK(hipFree(dIActiveLanes)); } @@ -768,8 +769,11 @@ static void runDivFloatTest() { // Cleanup memory free(hOData); + free(hIDivValues); + free(hIActiveLanes); HIP_CHECK(hipFree(dOData)); HIP_CHECK(hipFree(dIActiveLanes)); + HIP_CHECK(hipFree(dIDivValues)); } /* diff --git a/projects/hip-tests/catch/unit/deviceLib/anyAll.cc b/projects/hip-tests/catch/unit/deviceLib/anyAll.cc index 9b4cfca3ec..9ca8fb082c 100644 --- a/projects/hip-tests/catch/unit/deviceLib/anyAll.cc +++ b/projects/hip-tests/catch/unit/deviceLib/anyAll.cc @@ -79,6 +79,8 @@ TEST_CASE("Unit_AnyAll_CompileTest") { HIP_CHECK(hipFree(device_any)); HIP_CHECK(hipFree(device_all)); + free(host_any); + free(host_all); REQUIRE(anycount == 0); REQUIRE(allcount == 1); } diff --git a/projects/hip-tests/catch/unit/deviceLib/ballot.cc b/projects/hip-tests/catch/unit/deviceLib/ballot.cc index c7e168de94..91ac4b5879 100644 --- a/projects/hip-tests/catch/unit/deviceLib/ballot.cc +++ b/projects/hip-tests/catch/unit/deviceLib/ballot.cc @@ -82,5 +82,6 @@ TEST_CASE("Unit_ballot") { } HIP_CHECK(hipFree(device_ballot)); + free(host_ballot); REQUIRE(divergent_count == 1); } diff --git a/projects/hip-tests/catch/unit/deviceLib/bfloat16.cc b/projects/hip-tests/catch/unit/deviceLib/bfloat16.cc index c17ca0bb23..a31fc94a90 100644 --- a/projects/hip-tests/catch/unit/deviceLib/bfloat16.cc +++ b/projects/hip-tests/catch/unit/deviceLib/bfloat16.cc @@ -307,6 +307,9 @@ TEST_CASE("Unit_bf16_basic") { INFO("Index: " << i << " input: " << in[i] << " output: " << res[i]); REQUIRE(res[i] == 1); } + + HIP_CHECK(hipFree(d_in)); + HIP_CHECK(hipFree(d_res)); } SECTION("MathOp Compare") { @@ -454,6 +457,7 @@ TEST_CASE("Unit_bf16_basic") { HIP_CHECK(hipFree(d_in1)) HIP_CHECK(hipFree(d_in2)); + HIP_CHECK(hipFree(d_out)); } SECTION("abs") { diff --git a/projects/hip-tests/catch/unit/deviceLib/deviceAllocation.cc b/projects/hip-tests/catch/unit/deviceLib/deviceAllocation.cc index 33f415a1d7..aede74c668 100644 --- a/projects/hip-tests/catch/unit/deviceLib/deviceAllocation.cc +++ b/projects/hip-tests/catch/unit/deviceLib/deviceAllocation.cc @@ -835,6 +835,7 @@ template static bool TestMemoryAcrossMulKernelsUsingGraph(int test_ } HIP_CHECK(hipStreamDestroy(streamForGraph)); HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(graph)); HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; diff --git a/projects/hip-tests/catch/unit/deviceLib/fp8_ocp.cc b/projects/hip-tests/catch/unit/deviceLib/fp8_ocp.cc index 511ecb56b9..e262e7e3b1 100644 --- a/projects/hip-tests/catch/unit/deviceLib/fp8_ocp.cc +++ b/projects/hip-tests/catch/unit/deviceLib/fp8_ocp.cc @@ -142,6 +142,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_ocp_compare_host_device", "", float, double) { << " - gpu_result: " << result[i]); CHECK(cpu_result[i] == result[i]); } + + HIP_CHECK(hipFree(d_numbers)); } __FP8_DEVICE__ void e4m3_fp8x2_ocp_device(float2* val) { @@ -234,6 +236,8 @@ TEST_CASE("Unit_fp8x2_ocp_compare_host_device") { for (size_t i = 0; i < result.size(); i++) { CHECK(cpu_result[i] == result[i]); } + + HIP_CHECK(hipFree(d_numbers)); } TEST_CASE("Unit_fp8x2_ocp_split_compare") { @@ -290,6 +294,8 @@ TEST_CASE("Unit_fp8x2_ocp_split_compare") { << " y: " << result[i].y); CHECK(cpu_result[i] == result[i]); } + + HIP_CHECK(hipFree(d_numbers)); } __FP8_DEVICE__ void e4m3_fp8x4_ocp_device(float4* val) { @@ -388,6 +394,8 @@ TEST_CASE("Unit_fp8x4_ocp_split_compare") { << " w: " << result[i].w); CHECK(cpu_result[i] == result[i]); } + + HIP_CHECK(hipFree(d_numbers)); } __FP8_DEVICE__ bool e4m3_bool_ocp_device(float val) { diff --git a/projects/hip-tests/catch/unit/deviceLib/funnelshift.cc b/projects/hip-tests/catch/unit/deviceLib/funnelshift.cc index 096513a80c..5cfeff496f 100644 --- a/projects/hip-tests/catch/unit/deviceLib/funnelshift.cc +++ b/projects/hip-tests/catch/unit/deviceLib/funnelshift.cc @@ -204,5 +204,10 @@ TEST_CASE("Unit_funnelshift") { free(host_r_output); free(host_rc_output); + free(golden_l); + free(golden_lc); + free(golden_r); + free(golden_rc); + REQUIRE(errors == 0); } \ No newline at end of file diff --git a/projects/hip-tests/catch/unit/deviceLib/hipDeviceMemcpy.cc b/projects/hip-tests/catch/unit/deviceLib/hipDeviceMemcpy.cc index df881aa454..08dc413a4a 100644 --- a/projects/hip-tests/catch/unit/deviceLib/hipDeviceMemcpy.cc +++ b/projects/hip-tests/catch/unit/deviceLib/hipDeviceMemcpy.cc @@ -55,6 +55,9 @@ TEST_CASE("Unit_ToAndFroMemCpyToDevice") { for (int i = LEN - 16; i < LEN; i++) { REQUIRE(0x01010101 == B[i]); } + + HIP_CHECK(hipFree(Ad)); + HIP_CHECK(hipFree(Bd)); delete[] A; delete[] B; } diff --git a/projects/hip-tests/catch/unit/deviceLib/hipTestClock.cc b/projects/hip-tests/catch/unit/deviceLib/hipTestClock.cc index a72fb35f46..9d5803b1a8 100644 --- a/projects/hip-tests/catch/unit/deviceLib/hipTestClock.cc +++ b/projects/hip-tests/catch/unit/deviceLib/hipTestClock.cc @@ -48,4 +48,7 @@ TEST_CASE("Unit_hipTestClock") { for (unsigned i = 0; i < LEN; i++) { assert(0 != A[i]); } + + HIP_CHECK(hipFree(Ad)); + delete[] A; } diff --git a/projects/hip-tests/catch/unit/deviceLib/hipTestFMA.cc b/projects/hip-tests/catch/unit/deviceLib/hipTestFMA.cc index 2d14a06eeb..c56a64f665 100644 --- a/projects/hip-tests/catch/unit/deviceLib/hipTestFMA.cc +++ b/projects/hip-tests/catch/unit/deviceLib/hipTestFMA.cc @@ -93,6 +93,8 @@ void runTestFMA() { for (unsigned i = 0; i < LEN; i++) { REQUIRE(A[i] == true); } + + HIP_CHECK(hipFree(Ad)); } __global__ void kernelTestHalfFMA(bool* Ad) { @@ -166,6 +168,8 @@ void runTestHalfFMA() { for (unsigned i = 0; i < LEN; i++) { REQUIRE(A[i] == true); } + + HIP_CHECK(hipFree(Ad)); } TEST_CASE("Unit_hipTestFMA") { diff --git a/projects/hip-tests/catch/unit/deviceLib/hipTestHost.cc b/projects/hip-tests/catch/unit/deviceLib/hipTestHost.cc index bc1b0eb9a2..f8addfb5df 100644 --- a/projects/hip-tests/catch/unit/deviceLib/hipTestHost.cc +++ b/projects/hip-tests/catch/unit/deviceLib/hipTestHost.cc @@ -391,6 +391,8 @@ TEST_CASE("Unit_TestDevice_DoublePrecisionMathFunc") { REQUIRE(srcPtr[0] == true); HIP_CHECK(hipFree(devicePtr)); + HIP_CHECK(hipFree(Afd)); + HIP_CHECK(hipFree(Ad)); delete srcPtr; delete[] Af; delete[] A; diff --git a/projects/hip-tests/catch/unit/deviceLib/hipTestNew.cc b/projects/hip-tests/catch/unit/deviceLib/hipTestNew.cc index f6b95f068e..67c05f41d1 100644 --- a/projects/hip-tests/catch/unit/deviceLib/hipTestNew.cc +++ b/projects/hip-tests/catch/unit/deviceLib/hipTestNew.cc @@ -49,5 +49,7 @@ TEST_CASE("Unit_hipTest_DeviceNewOperator") { for (unsigned i = 0; i < LEN; i++) { REQUIRE(i == A[i]); } + + HIP_CHECK(hipFree(Ad)); delete[] A; }