SWDEV-485763 - Fix memory leaks in various unit tests
Fix memory leaks by adding missing destroy calls for
events, streams, and graphs at the end of tests.
Ensure that every test case executes destroy calls,
regardless of whether it passes or fails.
Change-Id: I814e35c528d90ed2abb34d77377f1a7fd3f1f11c
[ROCm/hip-tests commit: 9cffda4ebb]
This commit is contained in:
@@ -51,7 +51,7 @@ void run1(size_t size, hipStream_t stream) {
|
||||
HIPCHECK(hipMemcpyAsync(Bh, Ah, size, hipMemcpyHostToHost, stream));
|
||||
HIPCHECK(hipMemcpyAsync(Cd, Bh, size, hipMemcpyHostToDevice, stream));
|
||||
hipLaunchKernelGGL(HIP_KERNEL_NAME(Inc), dim3(N / 500), dim3(500), 0, stream, Cd);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIPCHECK(hipMemcpyAsync(Dd, Cd, size, hipMemcpyDeviceToDevice, stream));
|
||||
HIPCHECK(hipMemcpyAsync(Eh, Dd, size, hipMemcpyDeviceToHost, stream));
|
||||
HIPCHECK(hipDeviceSynchronize());
|
||||
@@ -93,9 +93,9 @@ void run(size_t size, hipStream_t stream1, hipStream_t stream2) {
|
||||
HIPCHECK(hipMemcpyAsync(Cd, Bh, size, hipMemcpyHostToDevice, stream1));
|
||||
HIPCHECK(hipMemcpyAsync(Cdd, Bhh, size, hipMemcpyHostToDevice, stream2));
|
||||
hipLaunchKernelGGL(HIP_KERNEL_NAME(Inc), dim3(N / 500), dim3(500), 0, stream1, Cd);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipLaunchKernelGGL(HIP_KERNEL_NAME(Inc), dim3(N / 500), dim3(500), 0, stream2, Cdd);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIPCHECK(hipMemcpyAsync(Dd, Cd, size, hipMemcpyDeviceToDevice, stream1));
|
||||
HIPCHECK(hipMemcpyAsync(Ddd, Cdd, size, hipMemcpyDeviceToDevice, stream2));
|
||||
HIPCHECK(hipMemcpyAsync(Eh, Dd, size, hipMemcpyDeviceToHost, stream1));
|
||||
@@ -140,4 +140,8 @@ TEST_CASE("Unit_hipMultiThreadStreams2") {
|
||||
t2.join();
|
||||
t3.join();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
HIPCHECK(hipStreamDestroy(stream[i]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user