From b32c03358533ad09288fd421ad3abb9085042be5 Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Mon, 22 Jun 2020 19:26:54 -0400 Subject: [PATCH] SWDEV-209747 - Staging Copy will not be supported in HIP, adjust test case accordingly. Change-Id: Iad616ef3990d539cdb82bbd8a22ea2124f7abe50 [ROCm/hip commit: 04b58e6e50072a398846281a1ef4501099e368f9] --- .../tests/src/runtimeApi/memory/hipMemcpyDtoD.cpp | 12 ++++++++---- .../src/runtimeApi/memory/hipMemcpyDtoDAsync.cpp | 7 +++++++ .../tests/src/runtimeApi/memory/hipMemcpyPeer.cpp | 6 ++++++ .../src/runtimeApi/memory/hipMemcpyPeerAsync.cpp | 7 +++++++ .../src/runtimeApi/memory/hipMemcpyWithStream.cpp | 8 +++++++- 5 files changed, 35 insertions(+), 5 deletions(-) mode change 100644 => 100755 projects/hip/tests/src/runtimeApi/memory/hipMemcpyDtoD.cpp mode change 100644 => 100755 projects/hip/tests/src/runtimeApi/memory/hipMemcpyDtoDAsync.cpp mode change 100644 => 100755 projects/hip/tests/src/runtimeApi/memory/hipMemcpyPeer.cpp mode change 100644 => 100755 projects/hip/tests/src/runtimeApi/memory/hipMemcpyPeerAsync.cpp mode change 100644 => 100755 projects/hip/tests/src/runtimeApi/memory/hipMemcpyWithStream.cpp diff --git a/projects/hip/tests/src/runtimeApi/memory/hipMemcpyDtoD.cpp b/projects/hip/tests/src/runtimeApi/memory/hipMemcpyDtoD.cpp old mode 100644 new mode 100755 index b68cb3f708..7e65c47244 --- a/projects/hip/tests/src/runtimeApi/memory/hipMemcpyDtoD.cpp +++ b/projects/hip/tests/src/runtimeApi/memory/hipMemcpyDtoD.cpp @@ -39,6 +39,9 @@ int main() { HIPCHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { + int canAccessPeer = 0; + hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + if (canAccessPeer) { HIPCHECK(hipSetDevice(0)); unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N); HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); @@ -47,23 +50,21 @@ int main() { HIPCHECK(hipMalloc(&Y_d, Nbytes)); HIPCHECK(hipMalloc(&Z_d, Nbytes)); - HIPCHECK(hipSetDevice(0)); HIPCHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice)); HIPCHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice)); hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, - static_cast(A_d), static_cast(B_d), C_d, N); + static_cast(A_d), static_cast(B_d), C_d, N); HIPCHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HIPCHECK(hipDeviceSynchronize()); HipTest::checkVectorADD(A_h, B_h, C_h, N); - HIPCHECK(hipSetDevice(1)); HIPCHECK(hipMemcpyDtoD((hipDeviceptr_t)X_d, (hipDeviceptr_t)A_d, Nbytes)); HIPCHECK(hipMemcpyDtoD((hipDeviceptr_t)Y_d, (hipDeviceptr_t)B_d, Nbytes)); hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, - static_cast(X_d), static_cast(Y_d), Z_d, N); + static_cast(X_d), static_cast(Y_d), Z_d, N); HIPCHECK(hipMemcpyDtoH(C_h, (hipDeviceptr_t)Z_d, Nbytes)); HIPCHECK(hipDeviceSynchronize()); HipTest::checkVectorADD(A_h, B_h, C_h, N); @@ -72,6 +73,9 @@ int main() { HIPCHECK(hipFree(X_d)); HIPCHECK(hipFree(Y_d)); HIPCHECK(hipFree(Z_d)); + } else { + std::cout<<"Machine does not seem to have P2P Capabilities, Empty Pass"< 1) { + + int canAccessPeer = 0; + hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + if (canAccessPeer) { HIPCHECK(hipSetDevice(0)); unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N); HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); @@ -75,6 +79,9 @@ int main() { HIPCHECK(hipFree(X_d)); HIPCHECK(hipFree(Y_d)); HIPCHECK(hipFree(Z_d)); + } else { + std::cout<<"Machine does not seem to have P2P Capabilities, Empty Pass"< 1) { + int canAccessPeer = 0; + hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + if (canAccessPeer) { HIPCHECK(hipSetDevice(0)); unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N); HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); @@ -72,6 +75,9 @@ int main() { HIPCHECK(hipFree(X_d)); HIPCHECK(hipFree(Y_d)); HIPCHECK(hipFree(Z_d)); + } else { + std::cout<<"Machine does not seem to have P2P Capabilities, Empty Pass"< 1) { + + int canAccessPeer = 0; + hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + if (canAccessPeer) { HIPCHECK(hipSetDevice(0)); unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N); HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); @@ -77,6 +81,9 @@ int main() { HIPCHECK(hipFree(X_d)); HIPCHECK(hipFree(Y_d)); HIPCHECK(hipFree(Z_d)); + } else { + std::cout<<"Machine does not seem to have P2P Capabilities, Empty Pass"<