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 v3 1/9] lib/intel_compute: Migrate xe_compute library to intel_compute
Date: Mon, 11 Sep 2023 08:03:37 +0200	[thread overview]
Message-ID: <20230911060345.324372-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230911060345.324372-1-zbigniew.kempczynski@intel.com>

During my work on adding xe-compute support to DG2 I hit some issues
on Xe driver so instead of limiting workload to Xe only I decided to
handle i915 as well. Such attitude might be handy on driver feature
status comparison.

Patch does preparation step to share the code between i915 and Xe.

v2: Add intel_ prefix as compute code is in the library and globally
    visible (Kamil)

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>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/{xe/xe_compute.c => intel_compute.c}      | 21 +++++++++----------
 lib/{xe/xe_compute.h => intel_compute.h}      | 12 +++++------
 ...rnels.c => intel_compute_square_kernels.c} |  4 ++--
 lib/meson.build                               |  4 ++--
 tests/intel/xe_compute.c                      |  4 ++--
 5 files changed, 22 insertions(+), 23 deletions(-)
 rename lib/{xe/xe_compute.c => intel_compute.c} (97%)
 rename lib/{xe/xe_compute.h => intel_compute.h} (72%)
 rename lib/{xe/xe_compute_square_kernels.c => intel_compute_square_kernels.c} (97%)

diff --git a/lib/xe/xe_compute.c b/lib/intel_compute.c
similarity index 97%
rename from lib/xe/xe_compute.c
rename to lib/intel_compute.c
index 3e8112a048..c0f5b1c937 100644
--- a/lib/xe/xe_compute.c
+++ b/lib/intel_compute.c
@@ -9,11 +9,10 @@
 #include <stdint.h>
 
 #include "igt.h"
-#include "xe_drm.h"
+#include "intel_compute.h"
 #include "lib/igt_syncobj.h"
 #include "lib/intel_reg.h"
-
-#include "xe_compute.h"
+#include "xe_drm.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 
@@ -453,24 +452,24 @@ static const struct {
 	unsigned int ip_ver;
 	void (*compute_exec)(int fd, const unsigned char *kernel,
 			     unsigned int size);
-} xe_compute_batches[] = {
+} intel_compute_batches[] = {
 	{
 		.ip_ver = IP_VER(12, 0),
 		.compute_exec = tgl_compute_exec,
 	},
 };
 
-bool run_xe_compute_kernel(int fd)
+bool run_intel_compute_kernel(int fd)
 {
 	unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
 	unsigned int batch;
-	const struct xe_compute_kernels *kernels = xe_compute_square_kernels;
+	const struct intel_compute_kernels *kernels = intel_compute_square_kernels;
 
-	for (batch = 0; batch < ARRAY_SIZE(xe_compute_batches); batch++) {
-		if (ip_ver == xe_compute_batches[batch].ip_ver)
+	for (batch = 0; batch < ARRAY_SIZE(intel_compute_batches); batch++) {
+		if (ip_ver == intel_compute_batches[batch].ip_ver)
 			break;
 	}
-	if (batch == ARRAY_SIZE(xe_compute_batches))
+	if (batch == ARRAY_SIZE(intel_compute_batches))
 		return false;
 
 	while (kernels->kernel) {
@@ -481,8 +480,8 @@ bool run_xe_compute_kernel(int fd)
 	if (!kernels->kernel)
 		return 1;
 
-	xe_compute_batches[batch].compute_exec(fd, kernels->kernel,
-					       kernels->size);
+	intel_compute_batches[batch].compute_exec(fd, kernels->kernel,
+						  kernels->size);
 
 	return true;
 }
diff --git a/lib/xe/xe_compute.h b/lib/intel_compute.h
similarity index 72%
rename from lib/xe/xe_compute.h
rename to lib/intel_compute.h
index b2e7e98278..ba153f064b 100644
--- a/lib/xe/xe_compute.h
+++ b/lib/intel_compute.h
@@ -6,8 +6,8 @@
  *    Francois Dugast <francois.dugast@intel.com>
  */
 
-#ifndef XE_COMPUTE_H
-#define XE_COMPUTE_H
+#ifndef INTEL_COMPUTE_H
+#define INTEL_COMPUTE_H
 
 /*
  * OpenCL Kernels are generated using:
@@ -19,14 +19,14 @@
  * For each GPU model desired. A list of supported models can be obtained with: ocloc compile --help
  */
 
-struct xe_compute_kernels {
+struct intel_compute_kernels {
 	int ip_ver;
 	unsigned int size;
 	const unsigned char *kernel;
 };
 
-extern const struct xe_compute_kernels xe_compute_square_kernels[];
+extern const struct intel_compute_kernels intel_compute_square_kernels[];
 
-bool run_xe_compute_kernel(int fd);
+bool run_intel_compute_kernel(int fd);
 
-#endif	/* XE_COMPUTE_H */
+#endif	/* INTEL_COMPUTE_H */
diff --git a/lib/xe/xe_compute_square_kernels.c b/lib/intel_compute_square_kernels.c
similarity index 97%
rename from lib/xe/xe_compute_square_kernels.c
rename to lib/intel_compute_square_kernels.c
index f9c07dc778..9303a41fb3 100644
--- a/lib/xe/xe_compute_square_kernels.c
+++ b/lib/intel_compute_square_kernels.c
@@ -8,7 +8,7 @@
  */
 
 #include "intel_chipset.h"
-#include "lib/xe/xe_compute.h"
+#include "lib/intel_compute.h"
 
 static const unsigned char tgllp_kernel_square_bin[] = {
 	0x61, 0x00, 0x03, 0x80, 0x20, 0x02, 0x05, 0x03, 0x04, 0x00, 0x10, 0x00,
@@ -61,7 +61,7 @@ static const unsigned char tgllp_kernel_square_bin[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-const struct xe_compute_kernels xe_compute_square_kernels[] = {
+const struct intel_compute_kernels intel_compute_square_kernels[] = {
 	{
 		.ip_ver = IP_VER(12, 0),
 		.size = sizeof(tgllp_kernel_square_bin),
diff --git a/lib/meson.build b/lib/meson.build
index 21ea9d5ac4..a45f7d677f 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -58,6 +58,8 @@ lib_sources = [
 	'intel_bufops.c',
 	'intel_chipset.c',
 	'intel_cmds_info.c',
+	'intel_compute.c',
+	'intel_compute_square_kernels.c',
 	'intel_ctx.c',
 	'intel_device_info.c',
 	'intel_mmio.c',
@@ -103,8 +105,6 @@ lib_sources = [
 	'veboxcopy_gen12.c',
 	'igt_msm.c',
 	'igt_dsc.c',
-	'xe/xe_compute.c',
-	'xe/xe_compute_square_kernels.c',
 	'xe/xe_gt.c',
 	'xe/xe_ioctl.c',
 	'xe/xe_query.c',
diff --git a/tests/intel/xe_compute.c b/tests/intel/xe_compute.c
index 2cf536701a..c3a6625960 100644
--- a/tests/intel/xe_compute.c
+++ b/tests/intel/xe_compute.c
@@ -14,8 +14,8 @@
 #include <string.h>
 
 #include "igt.h"
+#include "intel_compute.h"
 #include "xe/xe_query.h"
-#include "xe/xe_compute.h"
 
 /**
  * SUBTEST: compute-square
@@ -29,7 +29,7 @@
 static void
 test_compute_square(int fd)
 {
-	igt_require_f(run_xe_compute_kernel(fd), "GPU not supported\n");
+	igt_require_f(run_intel_compute_kernel(fd), "GPU not supported\n");
 }
 
 igt_main
-- 
2.34.1

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11  6:03 [igt-dev] [PATCH i-g-t v3 0/9] Extend compute square to i915 and Xe Zbigniew Kempczyński
2023-09-11  6:03 ` Zbigniew Kempczyński [this message]
2023-09-11  9:49   ` [igt-dev] [PATCH i-g-t v3 1/9] lib/intel_compute: Migrate xe_compute library to intel_compute Kamil Konieczny
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 2/9] lib/intel_compute: Add compatibility flags for running compute Zbigniew Kempczyński
2023-09-11  9:58   ` Kamil Konieczny
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 3/9] lib/intel_compute: Reorganize the code for i915 version preparation Zbigniew Kempczyński
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 4/9] lib/intel_compute: Add name field for debugging purposes Zbigniew Kempczyński
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 5/9] lib/intel_compute: Add i915 path in compute library Zbigniew Kempczyński
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 6/9] intel/gem_compute: Add test which runs compute workload on i915 Zbigniew Kempczyński
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 7/9] lib/intel_compute: Add XeHP implementation of compute pipeline Zbigniew Kempczyński
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 8/9] lib/intel_compute: Adding pvc compute pipeline implementation Zbigniew Kempczyński
2023-09-11  6:03 ` [igt-dev] [PATCH i-g-t v3 9/9] tests/gem|xe_compute: Update documentation regarding test requirements Zbigniew Kempczyński
2023-09-11  6:57 ` [igt-dev] ✓ CI.xeBAT: success for Extend compute square to i915 and Xe (rev3) Patchwork
2023-09-11  7:04 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-09-11  8:17   ` Zbigniew Kempczyński
2023-09-11 10:10     ` Yedireswarapu, SaiX Nandan
2023-09-11 10:09 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-09-11 12:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20230911060345.324372-2-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