From 934b6929d007a5b4f54b10d12e7f96f7bb0c04ce Mon Sep 17 00:00:00 2001 From: Yaxun Sam Liu Date: Sun, 20 Jan 2019 00:04:24 -0500 Subject: [PATCH 1/3] Use chrono instead of sys/time.h in test sys/time.h is not available on Windows. Use C++11 instead so that the tests compile on Windows. [ROCm/hip commit: 05b5e301870cd1448c495b16dc6eb2da2f5ffa78] --- projects/hip/tests/src/test_common.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/hip/tests/src/test_common.h b/projects/hip/tests/src/test_common.h index 40f6fffd8e..da5b47ea47 100644 --- a/projects/hip/tests/src/test_common.h +++ b/projects/hip/tests/src/test_common.h @@ -19,7 +19,7 @@ THE SOFTWARE. #include #include -#include +#include #include #include "hip/hip_runtime.h" @@ -105,9 +105,8 @@ namespace HipTest { // Returns the current system time in microseconds inline long long get_time() { - struct timeval tv; - gettimeofday(&tv, 0); - return (tv.tv_sec * 1000000) + tv.tv_usec; + return std::chrono::high_resolution_clock::now().time_since_epoch() + /std::chrono::microseconds(1); } double elapsed_time(long long startTimeUs, long long stopTimeUs); From 99e563d8a01b4bc81f051457c9f717033faae0d3 Mon Sep 17 00:00:00 2001 From: Yaxun Sam Liu Date: Mon, 21 Jan 2019 14:07:50 -0500 Subject: [PATCH 2/3] Fix get_time in tests for nvcc [ROCm/hip commit: aa6abb0dcf8d2373cbcb828cacdd9d924c33dbbf] --- projects/hip/tests/src/test_common.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/hip/tests/src/test_common.h b/projects/hip/tests/src/test_common.h index da5b47ea47..bacbf35a22 100644 --- a/projects/hip/tests/src/test_common.h +++ b/projects/hip/tests/src/test_common.h @@ -19,7 +19,11 @@ THE SOFTWARE. #include #include +#if __CUDACC__ +#include +#else #include +#endif #include #include "hip/hip_runtime.h" @@ -105,8 +109,14 @@ namespace HipTest { // Returns the current system time in microseconds inline long long get_time() { +#if __CUDACC__ + struct timeval tv; + gettimeofday(&tv, 0); + return (tv.tv_sec * 1000000) + tv.tv_usec; +#else return std::chrono::high_resolution_clock::now().time_since_epoch() /std::chrono::microseconds(1); +#endif } double elapsed_time(long long startTimeUs, long long stopTimeUs); From 7aafa0da9f3dae214a6bc4c7c93a74fde7a521b9 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Tue, 22 Jan 2019 06:25:43 +0530 Subject: [PATCH 3/3] Fixed issue of GPU device losing access to host pinned memory [ROCm/hip commit: bab3a94b33a7bd09d708578872277f09516d7606] --- projects/hip/src/hip_peer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hip/src/hip_peer.cpp b/projects/hip/src/hip_peer.cpp index cffb895c57..12a047e94f 100644 --- a/projects/hip/src/hip_peer.cpp +++ b/projects/hip/src/hip_peer.cpp @@ -129,7 +129,7 @@ hipError_t ihipEnablePeerAccess(hipCtx_t peerCtx, unsigned int flags) { LockedAccessor_CtxCrit_t peerCrit(peerCtx->criticalData()); // Add thisCtx to peerCtx's access list so that new allocations on peer will be made // visible to this device: - bool isNewPeer = peerCrit->addPeerWatcher(peerCtx, thisCtx); + bool isNewPeer = peerCrit->addPeerWatcher(thisCtx, peerCtx); if (isNewPeer) { tprintf(DB_MEM, "device=%s can now see all memory allocated on peer=%s\n", thisCtx->toString().c_str(), peerCtx->toString().c_str());