From 27413f20e16a8bdbeff96e7b0f9ba2ea63fa647f Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 31 Mar 2022 15:34:19 +0530 Subject: [PATCH] SWDEV-329380 - Fixed reset test (#2589) - after reset memory should be re-allocated Change-Id: I3e814de464629a2651b4b8e752400f09fd6fc971 [ROCm/hip commit: b7686183291f95a120a35d6ef41196806db6c3b2] --- .../hipStreamPerThread_DeviceReset.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/projects/hip/tests/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc b/projects/hip/tests/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc index 837446d2a9..dc1c59ee5b 100644 --- a/projects/hip/tests/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc +++ b/projects/hip/tests/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc @@ -77,13 +77,23 @@ TEST_CASE("Unit_hipStreamPerThread_DeviceReset_2") { for (unsigned int i = 0; i < ele_size; ++i) { A_h[i] = 123; } - hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, + status = hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, hipStreamPerThread); + if (status != hipSuccess) return; hipStreamSynchronize(hipStreamPerThread); hipDeviceReset(); - hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, + // After reset all memory objects will be destroyed hence allocating them again + // Intension 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; + status = hipMalloc(&A_d, ele_size * sizeof(int)); + if (status != hipSuccess) return; + + status = hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, hipStreamPerThread); + if (status != hipSuccess) return; hipStreamSynchronize(hipStreamPerThread); -} \ No newline at end of file +}