[PATCH i-g-t V2] tests/amd_basic: WIP fix eviction test failure
Zhang, Jesse(Jie)
Jesse.Zhang at amd.com
Tue Mar 26 02:32:53 UTC 2024
[AMD Official Use Only - General]
Please ignore this patch, I will send out new patch soon.
Thanks
Jesse
-----Original Message-----
From: Jesse Zhang <jesse.zhang at amd.com>
Sent: Tuesday, March 26, 2024 10:10 AM
To: igt-dev at lists.freedesktop.org
Cc: Prosyak, Vitaly <Vitaly.Prosyak at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang at amd.com>; Kamil Konieczny <kamil.konieczny at linux.intel.com>; Zhang, Jesse(Jie) <Jesse.Zhang at amd.com>
Subject: [PATCH i-g-t V2] tests/amd_basic: WIP fix eviction test failure
Test case name:igt at amdgpu/amd_basic at eviction-test-with-ip-dma@eviction_test
Fail error: "Starting subtest: eviction-test-with-IP-DMA Starting dynamic subtest: eviction_test
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: Test assertion failure function amdgpu_test_exec_cs_helper, file ../lib/amdgpu/amd_command_submission.c:77:
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: Failed assertion: r == 0
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: Last errno: 12, Cannot allocate memory
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: error: -12 != 0 Dynamic subtest eviction_test failed.
There is a case where the system size and gtt memory are smaller.
When evicting vram to gtt or system memory, there is not enough gtt or memory system memory available for allocation.
Therefore, try to reduce the use of gtt during initialization to meet the requirements for evicting vram.
V2: Added dump to the file to get the values for gtt and vram heaps (Vitaly)
Remove the space and empty line (Kamil)
Cc: Vitaly Prosyak <vitaly.prosyak at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian Koenig <christian.koenig at amd.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
---
tests/amdgpu/amd_basic.c | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c index 70e45649d..0b4159222 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -336,6 +336,7 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
struct amdgpu_heap_info vram_info, gtt_info;
int r, loop1, loop2;
+ FILE * file = NULL;
uint64_t gtt_flags[2] = {0, AMDGPU_GEM_CREATE_CPU_GTT_USWC};
@@ -358,6 +359,36 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
0, &vram_info);
igt_assert_eq(r, 0);
+ r = amdgpu_query_heap_info(device_handle, AMDGPU_GEM_DOMAIN_GTT,
+ 0, >t_info);
+ igt_assert_eq(r, 0);
+
+ file = fopen("gtt_vram.txt", "w");
+
+ fprintf(file, "gtt_info.heap_size %ld, gtt_info.max_allocation %ld gtt_info.heap_usage %ld\n",
+ gtt_info.heap_size, gtt_info.max_allocation, gtt_info.heap_usage);
+
+ fprintf(file, "gtt_info.heap_size %ld mb, gtt_info.max_allocation %ld mb gtt_info.heap_usage %ld mb\n",
+ gtt_info.heap_size>>20, gtt_info.max_allocation>>20,
+gtt_info.heap_usage>>20);
+
+ fprintf(file, "vram_info.heap_size %ld, vram_info.max_allocation %ld vram_info.heap_usage %ld\n",
+ vram_info.heap_size, vram_info.max_allocation,
+vram_info.heap_usage);
+
+ fprintf(file, "vram_info.heap_size %ld mb, vram_info.max_allocation %ld mb vram_info.heap_usage %ld mb\n",
+ vram_info.heap_size>>20, vram_info.max_allocation>>20,
+vram_info.heap_usage>>20);
+
+ fclose(file);
+
+ /* For smaller gtt memory sizes, reduce gtt usage on initialization
+ * to satisfy eviction vram requirements. Example:
+ * gtt_info.heap_size 3036569600, gtt_info.max_allocation 2114244608 gtt_info.heap_usage 12845056
+ * gtt_info.heap_size 2895 mb, gtt_info.max_allocation 2016 mb gtt_info.heap_usage 12 mb
+ * vram_info.heap_size 2114244608, vram_info.max_allocation 2114244608 vram_info.heap_usage 26951680
+ * vram_info.heap_size 2016 mb, vram_info.max_allocation 2016 mb vram_info.heap_usage 25 mb
+ */
+ if (gtt_info.heap_size - gtt_info.max_allocation < vram_info.max_allocation)
+ gtt_info.max_allocation /=3;
+
r = amdgpu_bo_alloc_wrap(device_handle, vram_info.max_allocation, 4096,
AMDGPU_GEM_DOMAIN_VRAM, 0, &ring_context->boa_vram[0]);
igt_assert_eq(r, 0);
@@ -365,10 +396,6 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
AMDGPU_GEM_DOMAIN_VRAM, 0, &ring_context->boa_vram[1]);
igt_assert_eq(r, 0);
- r = amdgpu_query_heap_info(device_handle, AMDGPU_GEM_DOMAIN_GTT,
- 0, >t_info);
- igt_assert_eq(r, 0);
-
r = amdgpu_bo_alloc_wrap(device_handle, gtt_info.max_allocation, 4096,
AMDGPU_GEM_DOMAIN_GTT, 0, &ring_context->boa_gtt[0]);
igt_assert_eq(r, 0);
--
2.25.1
More information about the igt-dev
mailing list