summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLang Yu <Lang.Yu@amd.com>2021-03-29 15:52:51 +0800
committerMarek Olšák <marek.olsak@amd.com>2021-04-01 11:41:51 -0400
commita5a400c9581c3b91598623603067556b18084c5d (patch)
tree3ee18e2fd95ab97af338f09fb84547d309bcb38b
parentaf871ec1a6f017b782943a11fb1c06b18c41bfe3 (diff)
tests/amdgpu: fix bo eviction test issue
On Raven2/Picasso, the default VRAM size is 2048M, and the default GTT size is 3072M. If max_allocation of VRAM exceeds half of GTT size, GTT memory can't hold evicted bo from VRAM and bo in itself at the same time. Then amdgpu_cs_list_validate will failed with "Not enough memory for command submission" error. NOTE: The installed DRAM should be larger than 8GB, if the VRAM size is 2048M. Signed-off-by: Lang Yu <Lang.Yu@amd.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--tests/amdgpu/amdgpu_test.c3
-rw-r--r--tests/amdgpu/basic_tests.c13
2 files changed, 9 insertions, 7 deletions
diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index 77bbfbcc..60f3a508 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -496,9 +496,6 @@ static void amdgpu_disable_suites()
"gfx ring slow bad draw test (set amdgpu.lockup_timeout=50)", CU_FALSE))
fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "bo eviction Test", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
/* This test was ran on GFX8 and GFX9 only */
if (family_id < AMDGPU_FAMILY_VI || family_id > AMDGPU_FAMILY_RV)
if (amdgpu_set_test_active(BASIC_TESTS_STR, "Sync dependency Test", CU_FALSE))
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index dc9ed947..c89d15fa 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -923,6 +923,15 @@ static void amdgpu_bo_eviction_test(void)
0, &vram_info);
CU_ASSERT_EQUAL(r, 0);
+ r = amdgpu_query_heap_info(device_handle, AMDGPU_GEM_DOMAIN_GTT,
+ 0, &gtt_info);
+ CU_ASSERT_EQUAL(r, 0);
+
+ if (vram_info.max_allocation > gtt_info.heap_size/3) {
+ vram_info.max_allocation = gtt_info.heap_size/3;
+ gtt_info.max_allocation = vram_info.max_allocation;
+ }
+
r = amdgpu_bo_alloc_wrap(device_handle, vram_info.max_allocation, 4096,
AMDGPU_GEM_DOMAIN_VRAM, 0, &vram_max[0]);
CU_ASSERT_EQUAL(r, 0);
@@ -930,10 +939,6 @@ static void amdgpu_bo_eviction_test(void)
AMDGPU_GEM_DOMAIN_VRAM, 0, &vram_max[1]);
CU_ASSERT_EQUAL(r, 0);
- r = amdgpu_query_heap_info(device_handle, AMDGPU_GEM_DOMAIN_GTT,
- 0, &gtt_info);
- CU_ASSERT_EQUAL(r, 0);
-
r = amdgpu_bo_alloc_wrap(device_handle, gtt_info.max_allocation, 4096,
AMDGPU_GEM_DOMAIN_GTT, 0, &gtt_max[0]);
CU_ASSERT_EQUAL(r, 0);