From de3e0c92b78e3adc302361d4d5c82b21a4eb2d8b Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Wed, 1 Mar 2023 19:02:23 +0530 Subject: [PATCH 1/3] SWDEV-382397 - Add hipStreamSynchronize() (#166) Make sure the queue is done before exit. Change-Id: I1011514211d665d3e1f0e93abcc38f08b2e3c375 --- catch/unit/event/Unit_hipEventElapsedTime.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/catch/unit/event/Unit_hipEventElapsedTime.cc b/catch/unit/event/Unit_hipEventElapsedTime.cc index a3ebad3e88..1b5f6e22e9 100644 --- a/catch/unit/event/Unit_hipEventElapsedTime.cc +++ b/catch/unit/event/Unit_hipEventElapsedTime.cc @@ -106,6 +106,7 @@ TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") { HIP_CHECK_ERROR(hipEventQuery(stop), hipErrorNotReady); HIP_ASSERT(hipEventElapsedTime(&tElapsed,start,stop) == hipErrorNotReady); + HIP_CHECK(hipStreamSynchronize(nullptr)); HIP_CHECK(hipEventDestroy(start)); HIP_CHECK(hipEventDestroy(stop)); } From b95d5677695c8d0c9bc1c38ae8a13e91ecb38adf Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Wed, 1 Mar 2023 20:35:51 +0530 Subject: [PATCH 2/3] SWDEV-380405 - Correct test cases. (#165) Change-Id: I55f2e2273a19643b14baeebc8a6f19331c20b09d --- catch/unit/memory/hipMemcpyPeer.cc | 14 ++++++++++---- catch/unit/memory/hipMemcpyPeerAsync.cc | 16 +++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/catch/unit/memory/hipMemcpyPeer.cc b/catch/unit/memory/hipMemcpyPeer.cc index 245b3e0b2c..8c91281cf6 100644 --- a/catch/unit/memory/hipMemcpyPeer.cc +++ b/catch/unit/memory/hipMemcpyPeer.cc @@ -138,13 +138,19 @@ TEST_CASE("Unit_hipMemcpyPeer_Positive_ZeroSize") { const auto element_count = allocation_size / sizeof(*src_alloc.ptr()); constexpr auto thread_count = 1024; const auto block_count = element_count / thread_count + 1; - constexpr int set_value = 22; + constexpr int set_value_s = 22; HIP_CHECK(hipSetDevice(src_device)); - VectorSet<<>>(src_alloc.ptr(), set_value, element_count); + VectorSet<<>>(src_alloc.ptr(), set_value_s, element_count); HIP_CHECK(hipGetLastError()); - constexpr int expected_value = 21; - std::fill_n(src_alloc.host_ptr(), element_count, expected_value); + constexpr int expected_value = 20; + HIP_CHECK(hipSetDevice(dst_device)); + VectorSet<<>>(dst_alloc.ptr(), expected_value, element_count); + HIP_CHECK(hipGetLastError()); + HIP_CHECK(hipSetDevice(src_device)); + + constexpr int set_value_h = 21; + std::fill_n(result.host_ptr(), element_count, set_value_h); HIP_CHECK(hipMemcpyPeer(dst_alloc.ptr(), dst_device, src_alloc.ptr(), src_device, 0)); diff --git a/catch/unit/memory/hipMemcpyPeerAsync.cc b/catch/unit/memory/hipMemcpyPeerAsync.cc index 90f9fdb8f4..a84ade3329 100644 --- a/catch/unit/memory/hipMemcpyPeerAsync.cc +++ b/catch/unit/memory/hipMemcpyPeerAsync.cc @@ -154,13 +154,19 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_ZeroSize") { const auto element_count = allocation_size / sizeof(*src_alloc.ptr()); constexpr auto thread_count = 1024; const auto block_count = element_count / thread_count + 1; - constexpr int set_value = 22; + constexpr int set_value_s = 22; HIP_CHECK(hipSetDevice(src_device)); - VectorSet<<>>(src_alloc.ptr(), set_value, element_count); + VectorSet<<>>(src_alloc.ptr(), set_value_s, element_count); HIP_CHECK(hipGetLastError()); - constexpr int expected_value = 21; - std::fill_n(src_alloc.host_ptr(), element_count, expected_value); + constexpr int expected_value = 20; + HIP_CHECK(hipSetDevice(dst_device)); + VectorSet<<>>(dst_alloc.ptr(), expected_value, element_count); + HIP_CHECK(hipGetLastError()); + HIP_CHECK(hipSetDevice(src_device)); + + constexpr int set_value_h = 21; + std::fill_n(result.host_ptr(), element_count, set_value_h); HIP_CHECK( hipMemcpyPeerAsync(dst_alloc.ptr(), dst_device, src_alloc.ptr(), src_device, 0, stream)); @@ -189,7 +195,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Negative_Parameters") { const hipStream_t stream = stream_guard.stream(); constexpr auto InvalidStream = [] { - StreamGuard sg(Streams::created); + const StreamGuard sg(Streams::created); return sg.stream(); }; From d6f2962c785f684254518c21b97575db8173b02e Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Wed, 1 Mar 2023 20:36:11 +0530 Subject: [PATCH 3/3] SWDEV-359379 - Fix for vulkan tests with STANDALONE_EXE flag (#143) Change-Id: Ib2019427ae7c1fe6a7c96efc293608ba26c27d85 --- catch/unit/vulkan_interop/CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/catch/unit/vulkan_interop/CMakeLists.txt b/catch/unit/vulkan_interop/CMakeLists.txt index 4803737598..f9da0ac406 100644 --- a/catch/unit/vulkan_interop/CMakeLists.txt +++ b/catch/unit/vulkan_interop/CMakeLists.txt @@ -1,5 +1,6 @@ +set(COMMON_SHARED_SRC vulkan_test.cc) + set(TEST_SRC - vulkan_test.cc hipExternalMemoryGetMappedBuffer.cc hipImportExternalMemory.cc hipDestroyExternalMemory.cc @@ -17,16 +18,19 @@ if(NOT Vulkan_FOUND) message(STATUS "FOUND VULKAN SDK: $ENV{VULKAN_SDK}") set(VULKAN_PATH $ENV{VULKAN_SDK}) else() - message("Error: Unable to locate Vulkan SDK. please specify VULKAN_PATH") + message(STATUS "Vulkan sdk not found, interop test not enabled. Please add VULKAN_PATH to enable the test") return() endif() endif() +if(WIN32) + set(LINKER_LIBS vulkan-1) +else() + set(LINKER_LIBS vulkan) +endif() + hip_add_exe_to_target(NAME VulkanInteropTest TEST_SRC ${TEST_SRC} - TEST_TARGET_NAME build_tests) -if (WIN32) - target_link_libraries(VulkanInteropTest vulkan-1) -else (WIN32) - target_link_libraries(VulkanInteropTest vulkan) -endif (WIN32) \ No newline at end of file + TEST_TARGET_NAME build_tests + COMMON_SHARED_SRC ${COMMON_SHARED_SRC} + LINKER_LIBS ${LINKER_LIBS})