From 554ab5dc40af4ba73aabec6c372d4e3c52fd2cdb Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 7 Feb 2023 13:54:34 +0530 Subject: [PATCH] SWDEV-369555 - Update and enable hipMemAdvise test (#126) Change-Id: If291514eeacef21dea99bc4b4a78bc98fb0bc1ca --- catch/unit/memory/hipMemAdvise_old.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/catch/unit/memory/hipMemAdvise_old.cc b/catch/unit/memory/hipMemAdvise_old.cc index cef164e2f..b95199805 100644 --- a/catch/unit/memory/hipMemAdvise_old.cc +++ b/catch/unit/memory/hipMemAdvise_old.cc @@ -232,15 +232,6 @@ TEST_CASE("Unit_hipMemAdvise_NegtveTsts") { std::string str; HIP_CHECK(hipGetDeviceCount(&NumDevs)); HIP_CHECK(hipMallocManaged(&Hmm, MEM_SIZE * 2, hipMemAttachGlobal)); -#if HT_AMD - // Passing invalid value(99) device param - IfTestPassed &= CheckError(hipMemAdvise(Hmm, MEM_SIZE * 2, - hipMemAdviseSetReadMostly, 99), __LINE__); - - // Passing invalid value(-12) device param - IfTestPassed &= CheckError(hipMemAdvise(Hmm, MEM_SIZE * 2, - hipMemAdviseSetReadMostly, -12), __LINE__); -#endif // Passing NULL as first parameter instead of valid pointer to a memory IfTestPassed &= CheckError(hipMemAdvise(NULL, MEM_SIZE * 2, hipMemAdviseSetReadMostly, 0), __LINE__); @@ -378,6 +369,12 @@ TEST_CASE("Unit_hipMemAdvise_ReadMostly") { WARN("out value: " << out); IfTestPassed = false; } + // hipMemAdvise should succeed for SetReadMostly and UnsetReadMostly + // irrespective of the device + HIP_CHECK(hipMemAdvise(Hmm, MEM_SIZE, hipMemAdviseSetReadMostly, 99)); + + HIP_CHECK(hipMemAdvise(Hmm, MEM_SIZE, hipMemAdviseUnsetReadMostly, -12)); + HIP_CHECK(hipFree(Hmm)); REQUIRE(IfTestPassed); } else {