Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sobin Thomas <sobin.thomas@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: zbigniew.kempczynski@intel.com, kamil.konieczny@intel.com,
	Sobin Thomas <sobin.thomas@intel.com>
Subject: [PATCH i-g-t 1/1] tests/intel/xe_compute_preempt: GPU Compatibility check
Date: Wed,  3 Sep 2025 06:03:06 +0000	[thread overview]
Message-ID: <20250903060306.1516598-2-sobin.thomas@intel.com> (raw)
In-Reply-To: <20250903060306.1516598-1-sobin.thomas@intel.com>

Add a check to verify the GPU version prior to launching the
xe_compute_preempt test. This prevents the unnecessary forking of
multiple child processes that would later be skipped due to a GPU
version mismatch.

Signed-off-by: Sobin Thomas <sobin.thomas@intel.com>
---
 lib/intel_compute.c              | 25 +++++++++++++++++++++++++
 lib/intel_compute.h              |  1 +
 tests/intel/xe_compute_preempt.c |  4 ++++
 3 files changed, 30 insertions(+)

diff --git a/lib/intel_compute.c b/lib/intel_compute.c
index 147dd2916..d8627c78b 100644
--- a/lib/intel_compute.c
+++ b/lib/intel_compute.c
@@ -2211,6 +2211,31 @@ static const struct {
 	},
 };
 
+bool check_gpu_compatibility(int fd)
+{
+	unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
+	unsigned int batch;
+	enum intel_driver driver = get_intel_driver(fd);
+
+	for (batch = 0; batch < ARRAY_SIZE(intel_compute_preempt_batches); batch++)
+		if (ip_ver == intel_compute_preempt_batches[batch].ip_ver)
+			break;
+
+	if (batch == ARRAY_SIZE(intel_compute_preempt_batches)) {
+		igt_debug("GPU version 0x%x not supported\n", ip_ver);
+		return false;
+	}
+
+	if (!(COMPAT_DRIVER_FLAG(driver) & intel_compute_preempt_batches[batch].compat)) {
+		igt_debug("Driver is not supported: flags %x & %x\n",
+			COMPAT_DRIVER_FLAG(driver),
+			intel_compute_preempt_batches[batch].compat);
+		return false;
+	}
+
+	return true;
+}
+
 static bool __run_intel_compute_kernel_preempt(int fd,
 		struct drm_xe_engine_class_instance *eci,
 		bool threadgroup_preemption,
diff --git a/lib/intel_compute.h b/lib/intel_compute.h
index 412791d07..6c8414c56 100644
--- a/lib/intel_compute.h
+++ b/lib/intel_compute.h
@@ -78,6 +78,7 @@ bool run_intel_compute_kernel(int fd, struct user_execenv *user,
 bool xe_run_intel_compute_kernel_on_engine(int fd, struct drm_xe_engine_class_instance *eci,
 					   struct user_execenv *user,
 					   enum execenv_alloc_prefs alloc_prefs);
+bool check_gpu_compatibility(int fd);
 bool run_intel_compute_kernel_preempt(int fd, struct drm_xe_engine_class_instance *eci,
 				      bool threadgroup_preemption,
 				      enum execenv_alloc_prefs alloc_prefs);
diff --git a/tests/intel/xe_compute_preempt.c b/tests/intel/xe_compute_preempt.c
index c9b194869..65ad5d4d5 100644
--- a/tests/intel/xe_compute_preempt.c
+++ b/tests/intel/xe_compute_preempt.c
@@ -98,6 +98,7 @@ igt_main
 				 * CONTEXT_MB * 2 (long and short) job
 				 */
 				child_count = ram_mb / 2 / CONTEXT_MB / 2;
+				igt_require_f(check_gpu_compatibility(xe), "GPU not supported\n");
 
 				igt_debug("RAM: %" PRIu64 ", child count: %d\n",
 					  ram_mb, child_count);
@@ -118,6 +119,7 @@ igt_main
 
 			igt_dynamic_f("engine-%s", xe_engine_class_string(hwe->engine_class)) {
 				int child_count;
+				igt_require_f(check_gpu_compatibility(xe), "GPU not supported\n");
 
 				/*
 				 * Get whole ram, then divide by
@@ -153,6 +155,7 @@ igt_main
 
 				igt_debug("VRAM: %" PRIu64 ", child count: %d\n",
 					  vram_mb, child_count);
+				igt_require_f(check_gpu_compatibility(xe), "GPU not supported\n");
 
 				igt_fork(child, child_count)
 					test_compute_preempt(xe, hwe, false, EXECENV_PREF_VRAM);
@@ -179,6 +182,7 @@ igt_main
 
 				igt_debug("VRAM: %" PRIu64 ", child count: %d\n",
 					  vram_mb, child_count);
+				igt_require_f(check_gpu_compatibility(xe), "GPU not supported\n");
 
 				igt_fork(child, child_count)
 					test_compute_preempt(xe, hwe, false, EXECENV_PREF_VRAM);
-- 
2.34.1


  reply	other threads:[~2025-09-03  6:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  6:03 [PATCH i-g-t 0/1] tests/intel/xe_compute_preempt: GPU Compatibility check Sobin Thomas
2025-09-03  6:03 ` Sobin Thomas [this message]
2025-09-03  6:27   ` [PATCH i-g-t 1/1] " Dandamudi, Priyanka
2025-09-03 20:30 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-09-03 20:49 ` ✓ i915.CI.BAT: " Patchwork
2025-09-04  2:34 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-05  0:42 ` ✗ i915.CI.Full: " Patchwork

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=20250903060306.1516598-2-sobin.thomas@intel.com \
    --to=sobin.thomas@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@intel.com \
    --cc=zbigniew.kempczynski@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