[igt-dev] [PATCH i-g-t] amdgpu/amd_basic: Restrict basic compute to only run on available compute rings

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 30 12:42:36 UTC 2019


Some time ago amdgpu changed their ABI to reject unknown compute rings,
so we should query the available set prior to execution.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/amdgpu/amd_basic.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index d3c060e32..bf626ece8 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -681,16 +681,20 @@ static void amdgpu_command_submission_compute_nop(void)
 	struct amdgpu_cs_request ibs_request;
 	struct amdgpu_cs_ib_info ib_info;
 	struct amdgpu_cs_fence fence_status;
+	struct drm_amdgpu_info_hw_ip info;
 	uint32_t *ptr;
 	uint32_t expired;
-	int i, r, instance;
+	int r, instance;
 	amdgpu_bo_list_handle bo_list;
 	amdgpu_va_handle va_handle;
 
+	r = amdgpu_query_hw_ip_info(device, AMDGPU_HW_IP_COMPUTE, 0, &info);
+	igt_assert_eq(r, 0);
+
 	r = amdgpu_cs_ctx_create(device, &context_handle);
 	igt_assert_eq(r, 0);
 
-	for (instance = 0; instance < 8; instance++) {
+	for (instance = 0; info.available_rings & (1 << instance); instance++) {
 		r = amdgpu_bo_alloc_and_map(device, 4096, 4096,
 					    AMDGPU_GEM_DOMAIN_GTT, 0,
 					    &ib_result_handle, &ib_result_cpu,
@@ -702,8 +706,8 @@ static void amdgpu_command_submission_compute_nop(void)
 		igt_assert_eq(r, 0);
 
 		ptr = ib_result_cpu;
-		for (i = 0; i < 16; ++i)
-			ptr[i] = 0xffff1000;
+		memset(ptr, 0, 16);
+		ptr[0] = PACKET3(PACKET3_NOP, 14);
 
 		memset(&ib_info, 0, sizeof(struct amdgpu_cs_ib_info));
 		ib_info.ib_mc_address = ib_result_mc_address;
-- 
2.24.0.rc1



More information about the igt-dev mailing list