Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 2/9] lib/intel_compute: Add compatibility flags for running compute
Date: Tue,  5 Sep 2023 15:33:02 +0200	[thread overview]
Message-ID: <20230905133309.365109-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230905133309.365109-1-zbigniew.kempczynski@intel.com>

Allow selectively turn on/off compute tests on both i915 and xe
drivers.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Christoph Manszewski <christoph.manszewski@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 lib/intel_compute.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lib/intel_compute.c b/lib/intel_compute.c
index 647bce0e43..dd9f686d0c 100644
--- a/lib/intel_compute.c
+++ b/lib/intel_compute.c
@@ -446,17 +446,27 @@ static void tgl_compute_exec(int fd, const unsigned char *kernel,
 }
 
 /*
- * Generic code
+ * Compatibility flags.
+ *
+ * There will be some time period in which both drivers (i915 and xe)
+ * will support compute runtime tests. Lets define compat flags to allow
+ * the code to be shared between two drivers allowing disabling this in
+ * the future.
  */
+#define COMPAT_FLAG(f) (1 << (f))
+#define COMPAT_I915 COMPAT_FLAG(INTEL_DRIVER_I915)
+#define COMPAT_XE   COMPAT_FLAG(INTEL_DRIVER_XE)
 
 static const struct {
 	unsigned int ip_ver;
 	void (*compute_exec)(int fd, const unsigned char *kernel,
 			     unsigned int size);
+	uint32_t compat;
 } compute_batches[] = {
 	{
 		.ip_ver = IP_VER(12, 0),
 		.compute_exec = tgl_compute_exec,
+		.compat = COMPAT_I915 | COMPAT_XE,
 	},
 };
 
@@ -465,6 +475,7 @@ bool run_compute_kernel(int fd)
 	unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
 	unsigned int batch;
 	const struct compute_kernels *kernels = compute_square_kernels;
+	enum intel_driver driver = get_intel_driver(fd);
 
 	for (batch = 0; batch < ARRAY_SIZE(compute_batches); batch++) {
 		if (ip_ver == compute_batches[batch].ip_ver)
@@ -473,6 +484,12 @@ bool run_compute_kernel(int fd)
 	if (batch == ARRAY_SIZE(compute_batches))
 		return false;
 
+	if (!(COMPAT_FLAG(driver) & compute_batches[batch].compat)) {
+		igt_debug("driver flag: %x\n", COMPAT_FLAG(driver));
+		igt_debug("compat flag: %x\n", compute_batches[batch].compat);
+		return false;
+	}
+
 	while (kernels->kernel) {
 		if (ip_ver == kernels->ip_ver)
 			break;
-- 
2.34.1

  parent reply	other threads:[~2023-09-05 13:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 13:33 [igt-dev] [PATCH i-g-t v2 0/9] Extend compute square to i915 and Xe Zbigniew Kempczyński
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 1/9] lib/intel_compute: Migrate xe_compute library to intel_compute Zbigniew Kempczyński
2023-09-06 16:42   ` Kamil Konieczny
2023-09-05 13:33 ` Zbigniew Kempczyński [this message]
2023-09-08  9:03   ` [igt-dev] [PATCH i-g-t v2 2/9] lib/intel_compute: Add compatibility flags for running compute Francois Dugast
2023-09-08 11:07     ` Zbigniew Kempczyński
2023-09-08 11:29     ` Mauro Carvalho Chehab
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 3/9] lib/intel_compute: Reorganize the code for i915 version preparation Zbigniew Kempczyński
2023-09-08  9:05   ` Francois Dugast
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 4/9] lib/intel_compute: Add name field for debugging purposes Zbigniew Kempczyński
2023-09-08  9:05   ` Francois Dugast
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 5/9] lib/intel_compute: Add i915 path in compute library Zbigniew Kempczyński
2023-09-08  9:13   ` Francois Dugast
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 6/9] intel/gem_compute: Add test which runs compute workload on i915 Zbigniew Kempczyński
2023-09-08  9:15   ` Francois Dugast
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 7/9] lib/intel_compute: Add XeHP implementation of compute pipeline Zbigniew Kempczyński
2023-09-08 13:55   ` Francois Dugast
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 8/9] lib/intel_compute: Adding pvc compute pipeline implementation Zbigniew Kempczyński
2023-09-08 13:56   ` Francois Dugast
2023-09-05 13:33 ` [igt-dev] [PATCH i-g-t v2 9/9] tests/gem|xe_compute: Update documentation regarding test requirements Zbigniew Kempczyński
2023-09-08 13:56   ` Francois Dugast
2023-09-05 18:23 ` [igt-dev] ✗ Fi.CI.BAT: failure for Extend compute square to i915 and Xe (rev2) 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=20230905133309.365109-3-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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