kfdtest: KFDSVMEvictTest support large VRAM or small system memory
For xnack off, skip SVM evict tests if memory allocation size is larger than 15/16 total system memory, because the test may fail to allocate CWSR svm range to create queue after allocating test memory. Limit eviction size from total VRAM size to 1/2 total VRAM size, because for 192GB VRAM, evict 192GB may takes more than 120 seconds and cause test timeout failed. Change-Id: Ib1483b9aab580a8539187b2943cadea0fd5a7c71 Signed-off-by: Philip Yang <Philip.Yang@amd.com>
This commit is contained in:
@@ -66,14 +66,17 @@ HSAint32 KFDSVMEvictTest::GetBufferCounter(HSAuint64 vramSize, HSAuint64 vramBuf
|
||||
|
||||
/* use one third of total system memory for eviction buffer to test
|
||||
* limit max allocate size to double of vramSize
|
||||
* count is zero if not enough memory (sysMemSize/3 + vramSize) < (vramBufSize * N_PROCESSES)
|
||||
* count is zero if not enough memory for XNACK off case
|
||||
*/
|
||||
size = sysMemSize / 3 + vramSize;
|
||||
size = size > vramSize << 1 ? vramSize << 1 : size;
|
||||
/* Check if there is enough system memory to pass test,
|
||||
size = MIN(sysMemSize / 3, vramSize / 2);
|
||||
size += vramSize;
|
||||
|
||||
/* Check if there is enough system memory to pass test for XNACK off
|
||||
* KFD system memory limit is 15/16.
|
||||
*/
|
||||
if (size > (sysMemSize - (sysMemSize >> 4)))
|
||||
HSAint32 xnack_enable = 0;
|
||||
EXPECT_SUCCESS(hsaKmtGetXNACKMode(&xnack_enable));
|
||||
if (!xnack_enable && size > (sysMemSize - (sysMemSize >> 4)))
|
||||
return 0;
|
||||
|
||||
sizeInPages = size >> PAGE_SHIFT;
|
||||
@@ -89,12 +92,20 @@ HSAint64 KFDSVMEvictTest::GetBufferSize(HSAuint64 vramSize, HSAuint32 count) {
|
||||
|
||||
LOG() << "Found System RAM of " << std::dec << (sysMemSize >> 20) << "MB" << std::endl;
|
||||
|
||||
/* use one third of total system memory for eviction buffer to test
|
||||
* limit max allocate size to duoble of vramSize
|
||||
* count is zero if not enough memory (sysMemSize/3 + vramSize) < (vramBufSize * N_PROCESSES)
|
||||
/* use up to one third of total system memory for eviction buffer to test
|
||||
* limit max eviction size to 1/2 of vramSize.
|
||||
*/
|
||||
size = sysMemSize / 3 + vramSize;
|
||||
size = size > vramSize << 1 ? vramSize << 1 : size;
|
||||
size = MIN(sysMemSize / 3, vramSize / 2);
|
||||
size += vramSize;
|
||||
|
||||
/* Check if there is enough system memory to pass test for XNACK off
|
||||
* KFD system memory limit is 15/16.
|
||||
*/
|
||||
HSAint32 xnack_enable = 0;
|
||||
EXPECT_SUCCESS(hsaKmtGetXNACKMode(&xnack_enable));
|
||||
if (!xnack_enable && size > (sysMemSize - (sysMemSize >> 4)))
|
||||
return 0;
|
||||
|
||||
sizeInPages = size >> PAGE_SHIFT;
|
||||
vramBufSizeInPages = sizeInPages / (count * N_PROCESSES);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user