From 2df79888e1649d14b43b8aeb0a39011b3be0a66e Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Tue, 4 Apr 2023 11:51:09 +0100 Subject: [PATCH] SWDEV-391998 - Fix and re-enable Unit_hipMallocManaged_OverSubscription Change-Id: I896ad5a4894e7a63ad15308838e15601f2e3540c [ROCm/hip-tests commit: 9290cc3c3189d57e63ac4cac3e68b8a658561ead] --- .../catch/hipTestMain/config/config_amd_linux | 2 -- .../hipTestMain/config/config_amd_windows | 1 - .../memory/hipMallocManaged_MultiScenario.cc | 20 ++++++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux index 4ae9ac3fc1..c7d994a087 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux @@ -30,7 +30,6 @@ "DisabledTests": [ #if defined COMMON "Unit_hipStreamPerThread_DeviceReset_1", - "Unit_hipMallocManaged_OverSubscription", "Unit_hipDeviceGetSharedMemConfig_Positive_Basic", "Unit_hipDeviceGetSharedMemConfig_Positive_Threaded", "Unit_hipDeviceGetCacheConfig_Positive_Basic", @@ -172,7 +171,6 @@ #endif #if defined MI2XX "Unit_hipStreamPerThread_DeviceReset_1", - "Unit_hipMallocManaged_OverSubscription", "Unit_hipDeviceGetPCIBusId_Negative_PartialFill", "Unit_hipInit_Negative", "Unit_hipMemGetAddressRange_Negative", diff --git a/projects/hip-tests/catch/hipTestMain/config/config_amd_windows b/projects/hip-tests/catch/hipTestMain/config/config_amd_windows index 8352345f5a..546f513841 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_windows +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_windows @@ -20,7 +20,6 @@ "Unit_hipMalloc3D_ValidatePitch", "Unit_hipMemAllocPitch_ValidatePitch", "Unit_hipGraphExecMemcpyNodeSetParamsToSymbol_Functional", - "Unit_hipMallocManaged_OverSubscription", "Unit_hipMallocManaged_CoherentTstWthAdvise", "Unit_hipMallocManaged_Advanced", "Unit_hipMemRangeGetAttribute_TstCountParam", diff --git a/projects/hip-tests/catch/unit/memory/hipMallocManaged_MultiScenario.cc b/projects/hip-tests/catch/unit/memory/hipMallocManaged_MultiScenario.cc index 774ec6a6fd..f6809fb93b 100644 --- a/projects/hip-tests/catch/unit/memory/hipMallocManaged_MultiScenario.cc +++ b/projects/hip-tests/catch/unit/memory/hipMallocManaged_MultiScenario.cc @@ -217,7 +217,6 @@ TEST_CASE("Unit_hipMallocManaged_MultiChunkMultiDevice") { } // The following tests oversubscription hipMallocManaged() api -// Currently disabled. TEST_CASE("Unit_hipMallocManaged_OverSubscription") { auto managed = HmmAttrPrint(); if (managed != 1) { @@ -225,15 +224,22 @@ TEST_CASE("Unit_hipMallocManaged_OverSubscription") { return; } + #if HT_AMD + int isPageableHMM = 0; + HIP_CHECK(hipDeviceGetAttribute(&isPageableHMM, + hipDeviceAttributePageableMemoryAccess, 0)); + if (!isPageableHMM) { + SUCCEED("Running on a system where all the memory requested in hipMallocManged " + "is allocated on the host.\nThis can cause instability because of out of memory failures.\n" + "Hence skipping the test with Pass result.\n"); + return; + } + #endif + void* A = nullptr; size_t total = 0, free = 0; HIP_CHECK(hipMemGetInfo(&free, &total)); - // ToDo: In case of HMM, memory over-subscription is allowed. Hence, relook - // into how out of memory can be tested. - // Demanding more mem size than available -#if HT_AMD - HIP_CHECK_ERROR(hipMallocManaged(&A, (free + 1), hipMemAttachGlobal), hipErrorOutOfMemory); -#endif + HIP_CHECK(hipMallocManaged(&A, (free + 1), hipMemAttachGlobal)); } // The following test does negative testing of hipMallocManaged() api