From 2d17c32468f3644b3b81bb77bb3a2f9b2e23ecdf Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Thu, 19 Oct 2023 10:59:30 +0000 Subject: [PATCH] SWDEV-427345 - Address catch test failures Change-Id: Ie3abbb50e1a2d0563c63c7fbb2bf7f341ac3aaa6 --- catch/unit/memory/CMakeLists.txt | 4 ++++ catch/unit/memory/hipHostRegister_exe.cc | 2 ++ catch/unit/memory/hipMemCoherencyTst.cc | 14 ++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/catch/unit/memory/CMakeLists.txt b/catch/unit/memory/CMakeLists.txt index 2f32e74b1d..e10be81cc5 100644 --- a/catch/unit/memory/CMakeLists.txt +++ b/catch/unit/memory/CMakeLists.txt @@ -176,3 +176,7 @@ endif() hip_add_exe_to_target(NAME MemoryTest2 TEST_SRC ${TEST_SRC} TEST_TARGET_NAME build_tests COMMON_SHARED_SRC ${COMMON_SHARED_SRC}) + +if(HIP_PLATFORM MATCHES "amd") + add_dependencies(build_tests hipHostRegisterPerf) +endif() diff --git a/catch/unit/memory/hipHostRegister_exe.cc b/catch/unit/memory/hipHostRegister_exe.cc index 40c42a82bb..c9f5dd356f 100644 --- a/catch/unit/memory/hipHostRegister_exe.cc +++ b/catch/unit/memory/hipHostRegister_exe.cc @@ -25,6 +25,8 @@ THE SOFTWARE. #include // NOLINT #include "hip/hip_runtime_api.h" +#pragma clang diagnostic ignored "-Wunused-parameter" + #define ITERATION 1000 #define SIZE (64*1024*1024) #define ARRAY_SIZE 20 diff --git a/catch/unit/memory/hipMemCoherencyTst.cc b/catch/unit/memory/hipMemCoherencyTst.cc index ce1fbdaed8..a5dbaed656 100644 --- a/catch/unit/memory/hipMemCoherencyTst.cc +++ b/catch/unit/memory/hipMemCoherencyTst.cc @@ -206,7 +206,7 @@ TEST_CASE("Unit_hipMalloc_CoherentTst") { hipExtMallocWithFlags()*/ #if HT_AMD TEST_CASE("Unit_hipExtMallocWithFlags_CoherentTst") { - int *Ptr = nullptr, SIZE = sizeof(int), InitVal = 9, Pageable = 0, managed = 0; + int *Ptr = nullptr, SIZE = sizeof(int), InitVal = 9, Pageable = 0, managed = 0, finegrain = 0; bool FineGrain = true; YES_COHERENT = false; @@ -214,14 +214,16 @@ TEST_CASE("Unit_hipExtMallocWithFlags_CoherentTst") { hipDeviceAttributePageableMemoryAccess, 0)); INFO("hipDeviceAttributePageableMemoryAccess: " << Pageable); - HIP_CHECK(hipDeviceGetAttribute(&managed, hipDeviceAttributeManagedMemory, - 0)); + HIP_CHECK(hipDeviceGetAttribute(&managed, hipDeviceAttributeManagedMemory, 0)); INFO("hipDeviceAttributeManagedMemory: " << managed); if (managed == 1 && Pageable == 1) { // Allocating hipExtMallocWithFlags() memory with flags - SECTION("hipExtMallocWithFlags with hipDeviceMallocFinegrained flag") { - HIP_CHECK(hipExtMallocWithFlags(reinterpret_cast(&Ptr), SIZE*2, - hipDeviceMallocFinegrained)); + HIP_CHECK(hipDeviceGetAttribute(&finegrain, hipDeviceAttributeFineGrainSupport, 0)); + if (finegrain == 1) { + SECTION("hipExtMallocWithFlags with hipDeviceMallocFinegrained flag") { + HIP_CHECK(hipExtMallocWithFlags(reinterpret_cast(&Ptr), SIZE*2, + hipDeviceMallocFinegrained)); + } } SECTION("hipExtMallocWithFlags with hipDeviceMallocSignalMemory flag") { // for hipMallocSignalMemory flag the size of memory must be 8