From 89d36cba5f51d8d1c517818b9f6e4130406c2994 Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Tue, 21 Jul 2020 09:49:31 -0400 Subject: [PATCH] SWDEV-244772 - Fix dtest hipMemcpyWithStreamMultiThread.cpp. hipSetDevice is not used correctly to allocate on multiple devices in mGPU setup. Due to which hipMalloc was called on the same device on multiple threads leading to out of memory issues on some devices with lesser memory. Change-Id: I0e5b1bc028b9ecb11bd40c3a5edf715f8bd721ff [ROCm/clr commit: 6f5e63ebacfd14e0b8565d85eba60de02e973dee] --- .../src/runtimeApi/memory/hipMemcpyWithStreamMultiThread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/clr/hipamd/tests/src/runtimeApi/memory/hipMemcpyWithStreamMultiThread.cpp b/projects/clr/hipamd/tests/src/runtimeApi/memory/hipMemcpyWithStreamMultiThread.cpp index aaaf8332bc..b3d613c45f 100644 --- a/projects/clr/hipamd/tests/src/runtimeApi/memory/hipMemcpyWithStreamMultiThread.cpp +++ b/projects/clr/hipamd/tests/src/runtimeApi/memory/hipMemcpyWithStreamMultiThread.cpp @@ -467,6 +467,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestkindDefaultForDtoD(void) { &A_h[0], &B_h[0], &C_h[0], N, false); for (int i=1; i < numDevices; ++i) { + HIPCHECK(hipSetDevice(i)); HIPCHECK(hipMalloc(&A_d[i], Nbytes)); HIPCHECK(hipMalloc(&B_d[i], Nbytes)); HIPCHECK(hipMalloc(&C_d[i], Nbytes)); @@ -476,6 +477,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestkindDefaultForDtoD(void) { hipStream_t stream[numDevices]; for (int i=0; i < numDevices; ++i) { + HIPCHECK(hipSetDevice(i)); HIPCHECK(hipStreamCreate(&stream[i])); }