From d5d8c022f1878654ec7c856ef00e8478ccb0d84b Mon Sep 17 00:00:00 2001 From: Kent Russell Date: Tue, 20 Jul 2021 14:36:15 -0400 Subject: [PATCH] kfdtest: Adjust KFDEvictTest memory size We were hitting memory map errors and segfaults when trying to use 7/8 VRAM on certain cards (dmesg showing "Failed to map to gpu 0/1"), as the original check didn't see if this would exceed the GTT size. Allocate the smaller of 1/3 of SRAM or 7/16 of VRAM (7/8 / 2) for the tests Signed-off-by: Kent Russell Change-Id: Ic11a5cee058535418eef903a28846e00e1839969 --- tests/kfdtest/src/KFDEvictTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/kfdtest/src/KFDEvictTest.cpp b/tests/kfdtest/src/KFDEvictTest.cpp index 126541abcf..a9544eb47c 100644 --- a/tests/kfdtest/src/KFDEvictTest.cpp +++ b/tests/kfdtest/src/KFDEvictTest.cpp @@ -478,7 +478,7 @@ TEST_F(KFDEvictTest, BasicTest) { AllocBuffers(defaultGPUNode, count, vramBufSize, pBuffers); /* Allocate gfx vram size of at most one third system memory */ - HSAuint64 size = sysMemSize / 3 < testSize ? sysMemSize / 3 : testSize; + HSAuint64 size = sysMemSize / 3 < testSize / 2 ? sysMemSize / 3 : testSize / 2; amdgpu_bo_handle handle; AllocAmdgpuBo(rn, size, handle); @@ -576,7 +576,7 @@ TEST_F(KFDEvictTest, QueueTest) { AllocBuffers(defaultGPUNode, count, vramBufSize, pBuffers); /* Allocate gfx vram size of at most one third system memory */ - HSAuint64 size = sysMemSize / 3 < testSize ? sysMemSize / 3 : testSize; + HSAuint64 size = sysMemSize / 3 < testSize / 2 ? sysMemSize / 3 : testSize / 2; amdgpu_bo_handle handle; AllocAmdgpuBo(rn, size, handle); @@ -675,7 +675,7 @@ TEST_F(KFDEvictTest, BurstyTest) { AllocBuffers(defaultGPUNode, count, vramBufSize, pBuffers); /* Allocate gfx vram size of at most one third system memory */ - HSAuint64 size = sysMemSize / 3 < testSize ? sysMemSize / 3 : testSize; + HSAuint64 size = sysMemSize / 3 < testSize / 2 ? sysMemSize / 3 : testSize / 2; amdgpu_bo_handle handle; AllocAmdgpuBo(rn, size, handle);