From c2a62d99a081f1e520a421e3eed80945e1f633ef Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 23 Aug 2022 09:35:39 +0530 Subject: [PATCH] SWDEV-344135 - Enable stream ordered memory and mempool tests (#2837) - Enable stream ordered memory and mempool tests for Nvidia platform - Fix build errors Change-Id: I90337e73d7b5df944a72cb41f2bde9ab2eec653c [ROCm/hip-tests commit: 53480a31279c918c23111967567a695307bb865a] --- .../catch/unit/memory/CMakeLists.txt | 1 + .../catch/unit/memory/hipMemPoolApi.cc | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/hip-tests/catch/unit/memory/CMakeLists.txt b/projects/hip-tests/catch/unit/memory/CMakeLists.txt index aff4c7ef5e..f24c63ad8c 100644 --- a/projects/hip-tests/catch/unit/memory/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/memory/CMakeLists.txt @@ -138,6 +138,7 @@ set(TEST_SRC hipMemRangeGetAttribute.cc hipMemcpyFromSymbol.cc hipPtrGetAttribute.cc + hipMemPoolApi.cc hipMemcpyPeer.cc hipMemcpyPeerAsync.cc hipMemcpyWithStream.cc diff --git a/projects/hip-tests/catch/unit/memory/hipMemPoolApi.cc b/projects/hip-tests/catch/unit/memory/hipMemPoolApi.cc index e799c4feec..bdb8ccfef4 100644 --- a/projects/hip-tests/catch/unit/memory/hipMemPoolApi.cc +++ b/projects/hip-tests/catch/unit/memory/hipMemPoolApi.cc @@ -65,7 +65,7 @@ TEST_CASE("Unit_hipMemPoolApi_Basic") { hipStream_t stream; HIP_CHECK(hipStreamCreate(&stream)); - HIP_CHECK(hipMallocAsync(&A, numElements * sizeof(float), stream)); + HIP_CHECK(hipMallocAsync(reinterpret_cast(&A), numElements * sizeof(float), stream)); INFO("hipMallocAsync result: " << A); HIP_CHECK(hipFreeAsync(A, stream)); @@ -84,16 +84,25 @@ TEST_CASE("Unit_hipMemPoolApi_Basic") { HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value)); - hipMemAccessDesc desc_list = {}; + hipMemAccessDesc desc_list = { + { + hipMemLocationTypeDevice, + 0 + }, + hipMemAccessFlagsProtReadWrite + }; int count = 1; HIP_CHECK(hipMemPoolSetAccess(mem_pool, &desc_list, count)); hipMemAccessFlags flags = hipMemAccessFlagsProtNone; - hipMemLocation location = {}; + hipMemLocation location = { + hipMemLocationTypeDevice, + 0 + }; HIP_CHECK(hipMemPoolGetAccess(&flags, mem_pool, &location)); HIP_CHECK(hipMemPoolCreate(&mem_pool, &kPoolProps)); - HIP_CHECK(hipMallocFromPoolAsync(&B, numElements * sizeof(float), mem_pool, stream)); + HIP_CHECK(hipMallocFromPoolAsync(reinterpret_cast(&B), numElements * sizeof(float), mem_pool, stream)); HIP_CHECK(hipMemPoolDestroy(mem_pool)); HIP_CHECK(hipStreamDestroy(stream)); @@ -527,8 +536,8 @@ TEST_CASE("Unit_hipMemPoolApi_Default") { std::uint64_t value64 = 0; attr = hipMemPoolAttrReservedMemCurrent; HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value64)); - // Make sure the current reserved just 4KB alloc - REQUIRE(sizeof(float) * 1024 == value64); + // Make sure the current reserved is at least allocation size of buffer C (4KB) + REQUIRE(sizeof(float) * 1024 <= value64); attr = hipMemPoolAttrUsedMemHigh; HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value64));