SWDEV-488318 - Fixes memory leaks in SPT tests

Change-Id: Icabc541b25342d7d5c095b437b91f74582cd9336


[ROCm/hip-tests commit: 726a537a74]
This commit is contained in:
Sourabh Betigeri
2024-10-01 13:16:15 -07:00
committed by Rakesh Roy
parent 6c7ed09ca0
commit c3caa7d1de
2 changed files with 13 additions and 1 deletions
@@ -59,6 +59,11 @@ TEST_CASE("Unit_hipStreamPerThread_Basic") {
for (int i = MEM_SIZE-1; i >= 0; --i) {
CHECK(hostMem[i] == (i+1+SEED));
}
// Clean-up
HIP_CHECK(hipHostFree(hostMem));
HIP_CHECK(hipFree(devMem));
}
TEST_CASE("Unit_hipStreamPerThread_StreamQuery") {
@@ -43,6 +43,9 @@ static void Copy_to_device() {
}
HIP_CHECK(hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice,
hipStreamPerThread));
// Clean up
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipFree(A_d));
}
TEST_CASE("Unit_hipStreamPerThread_DeviceReset_1") {
@@ -88,7 +91,7 @@ TEST_CASE("Unit_hipStreamPerThread_DeviceReset_2") {
HIP_CHECK(hipDeviceReset());
// After reset all memory objects will be destroyed hence allocating them again
// Intension is to use hipStreamPerThread successfully after reset hence not validating
// Intention is to use hipStreamPerThread successfully after reset hence not validating
// values after copy
status = hipHostMalloc(&A_h, ele_size*sizeof(int));
if (status != hipSuccess) return;
@@ -99,4 +102,8 @@ TEST_CASE("Unit_hipStreamPerThread_DeviceReset_2") {
hipStreamPerThread);
if (status != hipSuccess) return;
HIP_CHECK(hipStreamSynchronize(hipStreamPerThread));
// Clean up
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipFree(A_d));
}