From f14ad3abfefc20bbc339fb604deccb798612a67d Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 10 Oct 2022 16:14:04 +0530 Subject: [PATCH 1/5] SWDEV-1 - Add missing checks in hipMemcpy2DToArray.cc [ROCm/hip commit: 86d99b5ee6a84f3431f4074b000225a72beb0fea] --- projects/hip/tests/catch/unit/memory/hipMemcpy2DToArray.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArray.cc b/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArray.cc index dc1cf73348..e75e2c6af3 100644 --- a/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArray.cc +++ b/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArray.cc @@ -191,7 +191,7 @@ TEST_CASE("Unit_hipMemcpy2DToArray_multiDevicePinnedMemPeerGpu") { HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { int canAccessPeer = 0; - hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 0, 1)); if (canAccessPeer) { HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; @@ -248,7 +248,7 @@ TEST_CASE("Unit_hipMemcpy2DToArray_multiDeviceDeviceContextChange") { HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { int canAccessPeer = 0; - hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 0, 1)); if (canAccessPeer) { HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; From 1fcc9841d944b6a5a910ee0d38c1e01b619b0c44 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 10 Oct 2022 16:15:08 +0530 Subject: [PATCH 2/5] SWDEV-1 - Add missing checks in memset.cc [ROCm/hip commit: 37dac38f54ebe7c8682ccd74f504b3aa27826d98] --- projects/hip/tests/catch/unit/memory/memset.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/hip/tests/catch/unit/memory/memset.cc b/projects/hip/tests/catch/unit/memory/memset.cc index 677d8a2d85..91f2d04601 100644 --- a/projects/hip/tests/catch/unit/memory/memset.cc +++ b/projects/hip/tests/catch/unit/memory/memset.cc @@ -6,7 +6,8 @@ TEST_CASE("Unit_hipMemset_4bytes") { REQUIRE(res == hipSuccess); res = hipMemset(d_a, 0, sizeof(int)); REQUIRE(res == hipSuccess); - hipFree(d_a); + res = hipFree(d_a); + REQUIRE(res == hipSuccess); } TEST_CASE("Unit_hipMemset_4bytes_hostMem") { @@ -15,5 +16,6 @@ TEST_CASE("Unit_hipMemset_4bytes_hostMem") { REQUIRE(res == hipSuccess); res = hipMemset(d_a, 0, sizeof(int)); REQUIRE(res == hipSuccess); - hipHostFree(d_a); + res = hipHostFree(d_a); + REQUIRE(res == hipSuccess); } From 7a9fa6f7fd27df97f1977a2b5ceb62fd365bf6b3 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 10 Oct 2022 20:54:27 +0530 Subject: [PATCH 3/5] SWDEV-1 - Add missing checks in hipMemcpy2DToArrayAsync.cc [ROCm/hip commit: 7cac37358a65f53a47dd9780cae77a6720c7a10c] --- .../hip/tests/catch/unit/memory/hipMemcpy2DToArrayAsync.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArrayAsync.cc b/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArrayAsync.cc index 5145f28aa1..990b9c651e 100644 --- a/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArrayAsync.cc +++ b/projects/hip/tests/catch/unit/memory/hipMemcpy2DToArrayAsync.cc @@ -216,7 +216,7 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_multiDevicePinnedHostMem") { HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { int canAccessPeer = 0; - hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 0, 1)); if (canAccessPeer) { HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; @@ -278,7 +278,7 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_multiDeviceDeviceContextChange") { HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { int canAccessPeer = 0; - hipDeviceCanAccessPeer(&canAccessPeer, 0, 1); + HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 0, 1)); if (canAccessPeer) { HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; From fb0c0e9949826797906118ef97645e58b12f7ed0 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 10 Oct 2022 21:22:01 +0530 Subject: [PATCH 4/5] SWDEV-1 - Add missing checks in hipMemcpy3DAsync.cc [ROCm/hip commit: a5b61aac747eaa8af5499c7c53b0a76f46206506] --- projects/hip/tests/catch/unit/memory/hipMemcpy3DAsync.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/hip/tests/catch/unit/memory/hipMemcpy3DAsync.cc b/projects/hip/tests/catch/unit/memory/hipMemcpy3DAsync.cc index 1f690fa410..451da3e4fc 100644 --- a/projects/hip/tests/catch/unit/memory/hipMemcpy3DAsync.cc +++ b/projects/hip/tests/catch/unit/memory/hipMemcpy3DAsync.cc @@ -109,10 +109,10 @@ void Memcpy3DAsync::AllocateMemory() { */ template void Memcpy3DAsync::DeAllocateMemory() { - hipFreeArray(arr); - hipFreeArray(arr1); + HIP_CHECK(hipFreeArray(arr)); + HIP_CHECK(hipFreeArray(arr1)); free(hData); - hipStreamDestroy(stream); + HIP_CHECK(hipStreamDestroy(stream)); } /* From e6abf595b0063011cbd47341a0212a445c360861 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 10 Oct 2022 22:05:39 +0530 Subject: [PATCH 5/5] SWDEV-1 - Add missing checks in hipMemcpyParam2DAsync.cc [ROCm/hip commit: 2b3432ab03d87fc299176a5ef761f03adede0e43] --- .../tests/catch/unit/memory/hipMemcpyParam2DAsync.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/hip/tests/catch/unit/memory/hipMemcpyParam2DAsync.cc b/projects/hip/tests/catch/unit/memory/hipMemcpyParam2DAsync.cc index 7efa2ef909..950082678f 100644 --- a/projects/hip/tests/catch/unit/memory/hipMemcpyParam2DAsync.cc +++ b/projects/hip/tests/catch/unit/memory/hipMemcpyParam2DAsync.cc @@ -73,7 +73,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-StreamOnDiffDevice", // Initalizing A_d with C_h HIP_CHECK(hipSetDevice(1)); hipStream_t stream; - hipStreamCreate(&stream); + HIP_CHECK(hipStreamCreate(&stream)); HIP_CHECK(hipMemcpy2DAsync(A_d, pitch_A, C_h, width, NUM_W*sizeof(TestType), NUM_H, @@ -143,7 +143,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-D2D", size_t pitch_A; size_t width{NUM_W * sizeof(TestType)}; hipStream_t stream; - hipStreamCreate(&stream); + HIP_CHECK(hipStreamCreate(&stream)); HIP_CHECK(hipMallocPitch(reinterpret_cast(&A_d), &pitch_A, width, NUM_H)); HipTest::initArrays(nullptr, nullptr, nullptr, @@ -257,7 +257,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-H2D-D2H", } else { // Host to Device hip_Memcpy2D desc = {}; - hipStreamCreate(&stream); + HIP_CHECK(hipStreamCreate(&stream)); #ifdef __HIP_PLATFORM_NVCC__ desc.srcMemoryType = CU_MEMORYTYPE_HOST; #else @@ -331,7 +331,7 @@ TEST_CASE("Unit_hipMemcpyParam2DAsync_ExtentValidation") { size_t width{NUM_W * sizeof(char)}; constexpr auto memsetval{100}; hipStream_t stream; - hipStreamCreate(&stream); + HIP_CHECK(hipStreamCreate(&stream)); // Allocating and Initializing the data HIP_CHECK(hipMallocPitch(reinterpret_cast(&A_d), @@ -409,7 +409,7 @@ TEST_CASE("Unit_hipMemcpyParam2DAsync_Negative") { size_t width{NUM_W * sizeof(float)}; constexpr auto memsetval{100}; hipStream_t stream; - hipStreamCreate(&stream); + HIP_CHECK(hipStreamCreate(&stream)); // Allocating and Initializing the data HIP_CHECK(hipMallocPitch(reinterpret_cast(&A_d),