intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH i-g-t] amdgpu/amd_basic: Restrict basic compute to only run on available compute rings
@ 2019-10-30 12:42 Chris Wilson
  2019-10-30 12:42 ` [Intel-gfx] " Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2019-10-30 12:42 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

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@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Intel-gfx] [PATCH i-g-t] amdgpu/amd_basic: Restrict basic compute to only run on available compute rings
  2019-10-30 12:42 [PATCH i-g-t] amdgpu/amd_basic: Restrict basic compute to only run on available compute rings Chris Wilson
@ 2019-10-30 12:42 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2019-10-30 12:42 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

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@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-30 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 12:42 [PATCH i-g-t] amdgpu/amd_basic: Restrict basic compute to only run on available compute rings Chris Wilson
2019-10-30 12:42 ` [Intel-gfx] " Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).