Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Nirmoy Das <nirmoy.das@intel.com>,
	Janga Rahul Kumar <janga.rahul.kumar@intel.com>
Subject: [PATCH i-g-t] tests/intel/xe_compute_preempt: Extend it for more engines
Date: Tue, 20 Feb 2024 21:04:55 +0100	[thread overview]
Message-ID: <20240220200455.31217-1-nirmoy.das@intel.com> (raw)

Extend the test to run on all eligible engines.

Cc: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 lib/intel_compute.c              | 21 +++++++++++++--------
 lib/intel_compute.h              |  2 +-
 tests/intel/xe_compute_preempt.c | 17 +++++++++++++----
 3 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/lib/intel_compute.c b/lib/intel_compute.c
index eab407a0d..c5d253ebc 100644
--- a/lib/intel_compute.c
+++ b/lib/intel_compute.c
@@ -1526,7 +1526,8 @@ static void xe2lpg_compute_preempt_exec(int fd, const unsigned char *long_kernel
 					const unsigned char *short_kernel,
 					unsigned int short_kernel_size,
 					const unsigned char *sip_kernel,
-					unsigned int sip_kernel_size)
+					unsigned int sip_kernel_size,
+					struct drm_xe_engine_class_instance *eci)
 {
 #define XE2_BO_PREEMPT_DICT_ENTRIES 11
 	struct bo_dict_entry bo_dict_long[XE2_BO_PREEMPT_DICT_ENTRIES] = {
@@ -1578,8 +1579,8 @@ static void xe2lpg_compute_preempt_exec(int fd, const unsigned char *long_kernel
 	for (int i = 0; i < XE2_BO_PREEMPT_DICT_ENTRIES; ++i)
 		bo_dict_short[i] = bo_dict_long[i];
 
-	bo_execenv_create(fd, &execenv_short, NULL);
-	bo_execenv_create(fd, &execenv_long, NULL);
+	bo_execenv_create(fd, &execenv_short, eci);
+	bo_execenv_create(fd, &execenv_long, eci);
 
 	bo_dict_long[0].size = ALIGN(long_kernel_size, 0x1000);
 	bo_dict_short[0].size = ALIGN(short_kernel_size, 0x1000);
@@ -1673,7 +1674,8 @@ static const struct {
 			     const unsigned char *short_kernel,
 			     unsigned int short_kernel_size,
 			     const unsigned char *sip_kernel,
-			     unsigned int sip_kernel_size);
+			     unsigned int sip_kernel_size,
+			     struct drm_xe_engine_class_instance *eci);
 	uint32_t compat;
 } intel_compute_preempt_batches[] = {
 	{
@@ -1683,7 +1685,8 @@ static const struct {
 	},
 };
 
-static bool __run_intel_compute_kernel_preempt(int fd)
+static bool __run_intel_compute_kernel_preempt(int fd,
+		struct drm_xe_engine_class_instance *eci)
 {
 	unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
 	unsigned int batch;
@@ -1720,7 +1723,8 @@ static bool __run_intel_compute_kernel_preempt(int fd)
 							  kernels->long_kernel_size,
 							  kernels->kernel, kernels->size,
 							  kernels->sip_kernel,
-							  kernels->sip_kernel_size);
+							  kernels->sip_kernel_size,
+							  eci);
 
 	return true;
 }
@@ -1732,7 +1736,8 @@ static bool __run_intel_compute_kernel_preempt(int fd)
  *
  * Returns true on success, false otherwise.
  */
-bool run_intel_compute_kernel_preempt(int fd)
+bool run_intel_compute_kernel_preempt(int fd,
+		struct drm_xe_engine_class_instance *eci)
 {
-	return __run_intel_compute_kernel_preempt(fd);
+	return __run_intel_compute_kernel_preempt(fd, eci);
 }
diff --git a/lib/intel_compute.h b/lib/intel_compute.h
index a02688ad4..fe9637b91 100644
--- a/lib/intel_compute.h
+++ b/lib/intel_compute.h
@@ -37,5 +37,5 @@ extern const struct intel_compute_kernels intel_compute_square_kernels[];
 
 bool run_intel_compute_kernel(int fd);
 bool xe_run_intel_compute_kernel_on_engine(int fd, struct drm_xe_engine_class_instance *eci);
-bool run_intel_compute_kernel_preempt(int fd);
+bool run_intel_compute_kernel_preempt(int fd, struct drm_xe_engine_class_instance *eci);
 #endif	/* INTEL_COMPUTE_H */
diff --git a/tests/intel/xe_compute_preempt.c b/tests/intel/xe_compute_preempt.c
index 31703638e..a4e0e1454 100644
--- a/tests/intel/xe_compute_preempt.c
+++ b/tests/intel/xe_compute_preempt.c
@@ -24,20 +24,29 @@
  * Functionality: compute openCL kernel
  */
 static void
-test_compute_preempt(int fd)
+test_compute_preempt(int fd, struct drm_xe_engine_class_instance *hwe)
 {
-	igt_require_f(run_intel_compute_kernel_preempt(fd), "GPU not supported\n");
+	igt_require_f(run_intel_compute_kernel_preempt(fd, hwe), "GPU not supported\n");
 }
 
 igt_main
 {
 	int xe;
+	struct drm_xe_engine_class_instance *hwe;
 
 	igt_fixture
 		xe = drm_open_driver(DRIVER_XE);
 
-	igt_subtest("compute-preempt")
-		test_compute_preempt(xe);
+	igt_subtest_with_dynamic("compute-preempt") {
+		xe_for_each_engine(xe, hwe) {
+			if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COMPUTE &&
+			    hwe->engine_class != DRM_XE_ENGINE_CLASS_RENDER)
+				continue;
+
+			igt_dynamic_f("engine-%s", xe_engine_class_string(hwe->engine_class))
+				test_compute_preempt(xe, hwe);
+		}
+	}
 
 	igt_fixture
 		drm_close_driver(xe);
-- 
2.42.0


             reply	other threads:[~2024-02-20 20:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 20:04 Nirmoy Das [this message]
2024-02-20 23:12 ` ✓ CI.xeBAT: success for tests/intel/xe_compute_preempt: Extend it for more engines Patchwork
2024-02-20 23:43 ` ✓ Fi.CI.BAT: " Patchwork
2024-02-21  2:15 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-22  6:41 ` [PATCH i-g-t] " Kumar, Janga Rahul
2024-02-23  8:30   ` Nirmoy Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240220200455.31217-1-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=janga.rahul.kumar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox