From 9fc1362ddc7e1deb53d60bdb8eb7fd1a5719e00c Mon Sep 17 00:00:00 2001 From: Yong Zhao Date: Wed, 18 Dec 2019 19:19:53 -0500 Subject: [PATCH] kfdtest: Improve the stablility of SignalHandling test On gfx1012, allocating 1/4 of the system memory on a 32G RAM machine could fail, resulting in this test to fail. Limit the maximum buffer to allocate to be smaller than 3G to accommodate this situation. Change-Id: I38b0a0f7da1f0b9ca851e04d2d0a51767858c801 Signed-off-by: Yong Zhao [ROCm/ROCR-Runtime commit: 2b70d73f680ee9316135051314376863b5135ed6] --- projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp b/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp index abdbfa3b5a..aa816b84e4 100644 --- a/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp +++ b/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp @@ -1569,6 +1569,13 @@ TEST_F(KFDMemoryTest, SignalHandling) { * Try to allocate 1/4th System RAM */ size = (sysMemSize >> 2) & ~(HSAuint64)(PAGE_SIZE - 1); + + /* We don't need a too large buffer for this test. If it is too large, + * on some platform, the upcoming hsaKmtAllocMemory() might fail. In + * order to avoid this flaky behavior, limit the size to 3G. + */ + size = size > (3ULL << 30) ? (3ULL << 30) : size; + m_MemoryFlags.ui32.NoNUMABind = 1; ASSERT_SUCCESS(hsaKmtAllocMemory(0 /* system */, size, m_MemoryFlags, reinterpret_cast(&pDb))); // Verify that pDb is not null before it's being used