Skip to contentSkip to conversation

lib/intel_compute: Do not assume engine class

PATCH In review Nirmoy Das 4 participants 6 messages Mar 14, 2024 – Mar 18, 2024 Library code

lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 lib/intel_compute: Do not assume engine class

Let the test decide what engine class to use instead of a lib function deciding it for tests.

Cc Zbigniew Kempczyński <[email protected]>
Cc Janga Rahul Kumar <[email protected]>
---
 lib/intel_compute.c      | 20 +++-----------------
 tests/intel/xe_compute.c | 21 ++++++++++++++++++++-
 2 files changed, 23 insertions(+), 18 deletions(-)
lib/intel_compute.c +3 -17
index 9d3b97efe..c96e60027 100644
@@ -81,24 +81,10 @@ static void bo_execenv_create(int fd, struct bo_execenv *execenv,
 	execenv->driver = get_intel_driver(fd);
 
 	if (execenv->driver == INTEL_DRIVER_XE) {
+		igt_fail_on(eci == NULL);
 		execenv->vm = xe_vm_create(fd, 0, 0);
-
-		if (eci) {
-			execenv->exec_queue = xe_exec_queue_create(fd, execenv->vm,
-								   eci, 0);
-		} else {
-			uint16_t engine_class;
-			uint32_t devid = intel_get_drm_devid(fd);
-			const struct intel_device_info *info = intel_get_device_info(devid);
-
-			if (info->graphics_ver >= 12 && info->graphics_rel < 60)
-				engine_class = DRM_XE_ENGINE_CLASS_RENDER;
-			else
-				engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
-
-			execenv->exec_queue = xe_exec_queue_create_class(fd, execenv->vm,
-									 engine_class);
-		}
+		execenv->exec_queue = xe_exec_queue_create(fd, execenv->vm, eci,
+							   0);
 	}
 }
 
tests/intel/xe_compute.c +20 -1
index 42f42ca0c..cb98b00d5 100644
@@ -163,9 +163,28 @@ test_compute_kernel_with_ccs_mode(int num_gt)
 static void
 test_compute_square(int fd)
 {
-	igt_require_f(run_intel_compute_kernel(fd), "GPU not supported\n");
+	struct drm_xe_engine_class_instance *hwe;
+	const struct intel_device_info *info;
+	uint16_t engine_class;
+	uint32_t devid = intel_get_drm_devid(fd);
+
+	info = intel_get_device_info(devid);
+
+	if (info->graphics_ver >= 12 && info->graphics_rel < 60)
+		engine_class = DRM_XE_ENGINE_CLASS_RENDER;
+	else
+		engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
+
+	xe_for_each_engine(fd, hwe) {
+		if (hwe->engine_class != engine_class)
+			continue;
+
+		igt_require_f(xe_run_intel_compute_kernel_on_engine(fd, hwe),
+			      "GPU not supported\n");
+	}
 }
 
+
 igt_main
 {
 	int xe, num_gt;
Signature · 1 line
2.42.0
#1 lore raw

✓ CI.xeBAT: success for lib/intel_compute: Do not assume engine class

== Series Details ==

== Series Details ==

Series: lib/intel_compute: Do not assume engine class
URL : https://patchwork.freedesktop.org/series/131154/
State : success

== Summary ==

CI Bug Log - changes from XEIGT_7766_BAT -> XEIGTPW_10838_BAT
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Participating hosts (4 -> 4)
------------------------------

No changes in participating hosts

Changes
-------

No changes found

Build changes
-------------

* IGT: IGT_7766 -> IGTPW_10838
* Linux: xe-943-c44e29a7b62293355744fd857aad93cbf43e5126 -> xe-945-349b729c661c449da8151a079c6f237f0c796b24

IGTPW_10838: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/index.html
IGT_7766: 08cf1b2fa6b2f422f417ea74f41b12b93e91156f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
xe-943-c44e29a7b62293355744fd857aad93cbf43e5126: c44e29a7b62293355744fd857aad93cbf43e5126 xe-945-349b729c661c449da8151a079c6f237f0c796b24: 349b729c661c449da8151a079c6f237f0c796b24

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10838/index.html

#2 lore raw

✗ Fi.CI.BAT: failure for lib/intel_compute: Do not assume engine class

In reply to Nirmoy Das
== Series Details ==

== Series Details ==

Series: lib/intel_compute: Do not assume engine class
URL : https://patchwork.freedesktop.org/series/131154/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_14436 -> IGTPW_10838
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_10838 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in IGTPW_10838, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/index.html

Participating hosts (36 -> 33)
------------------------------

Missing (3): fi-blb-e6850 bat-dg1-7 fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_10838:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@gem_contexts:
- bat-mtlp-8: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14436/bat-mtlp-8/igt@i915_selftest@live@gem_contexts.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-mtlp-8/igt@i915_selftest@live@gem_contexts.html

Known issues
------------

Here are the changes found in IGTPW_10838 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- bat-jsl-1: NOTRUN -> [SKIP][3] ([i915#9318])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- bat-jsl-1: NOTRUN -> [SKIP][4] ([i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

* igt@gem_lmem_swapping@verify-random:
- bat-jsl-1: NOTRUN -> [SKIP][5] ([i915#4613]) +3 other tests skip
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-jsl-1: NOTRUN -> [SKIP][6] ([i915#4103]) +1 other test skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

* igt@kms_dsc@dsc-basic:
- bat-jsl-1: NOTRUN -> [SKIP][7] ([i915#3555] / [i915#9886])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-jsl-1: NOTRUN -> [SKIP][8]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

* igt@kms_setmode@basic-clone-single-crtc:
- bat-jsl-1: NOTRUN -> [SKIP][9] ([i915#3555])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/bat-jsl-1/igt@[email protected]

[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#9318]: https://gitlab.freedesktop.org/drm/intel/issues/9318
[i915#9886]: https://gitlab.freedesktop.org/drm/intel/issues/9886

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7766 -> IGTPW_10838

CI-20190529: 20190529
CI_DRM_14436: 349b729c661c449da8151a079c6f237f0c796b24 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_10838: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/index.html
IGT_7766: 08cf1b2fa6b2f422f417ea74f41b12b93e91156f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10838/index.html

Acked-by on v1 1/1
#3 lore raw
In reply to Nirmoy Das
Quoted 11 lines

-----Original Message-----
From: Das, Nirmoy <[email protected]>
Sent: Friday, March 15, 2024 3:08 AM
To: [email protected]
Cc: Das, Nirmoy <[email protected]>; Kempczynski, Zbigniew <[email protected]>; Kumar, Janga Rahul <[email protected]>
Subject: [PATCH i-g-t] lib/intel_compute: Do not assume engine class

Quoted 6 lines

Let the test decide what engine class to use instead of a lib function deciding it for tests.

Cc Zbigniew Kempczyński <[email protected]>
Cc Janga Rahul Kumar <[email protected]>

LGTM,

Quoted 81 lines
---
 lib/intel_compute.c      | 20 +++-----------------
 tests/intel/xe_compute.c | 21 ++++++++++++++++++++-
 2 files changed, 23 insertions(+), 18 deletions(-)
lib/intel_compute.c index renamed from lib/intel_compute.c +0 -0

9d3b97efe..c96e60027 100644

lib/intel_compute.c +1 -13
@@ -81,24 +81,10 @@ static void bo_execenv_create(int fd, struct
 bo_execenv *execenv,
 	execenv->driver = get_intel_driver(fd);
 
 	if (execenv->driver == INTEL_DRIVER_XE) {
+		igt_fail_on(eci == NULL);
 		execenv->vm = xe_vm_create(fd, 0, 0);
-
-		if (eci) {
-			execenv->exec_queue = xe_exec_queue_create(fd,
 execenv->vm,
-								   eci, 0);
-		} else {
-			uint16_t engine_class;
-			uint32_t devid = intel_get_drm_devid(fd);
-			const struct intel_device_info *info =
 intel_get_device_info(devid);
-
-			if (info->graphics_ver >= 12 && info->graphics_rel <
 60)
-				engine_class =
 DRM_XE_ENGINE_CLASS_RENDER;
-			else
-				engine_class =

DRM_XE_ENGINE_CLASS_COMPUTE;

lib/intel_compute.c +0 -2
-
-			execenv->exec_queue =

xe_exec_queue_create_class(fd, execenv->vm,
-
engine_class);

lib/intel_compute.c +1 -1
-		}
+		execenv->exec_queue = xe_exec_queue_create(fd, execenv-
Quoted 1 line

vm, eci,

lib/intel_compute.c +1 -0
+							   0);
 	}
 }
tests/intel/xe_compute.c index renamed from tests/intel/xe_compute.c +0 -0

42f42ca0c..cb98b00d5 100644

tests/intel/xe_compute.c +20 -2
@@ -163,9 +163,28 @@ test_compute_kernel_with_ccs_mode(int num_gt)
 static void  test_compute_square(int fd)  {
-	igt_require_f(run_intel_compute_kernel(fd), "GPU not supported\n");
+	struct drm_xe_engine_class_instance *hwe;
+	const struct intel_device_info *info;
+	uint16_t engine_class;
+	uint32_t devid = intel_get_drm_devid(fd);
+
+	info = intel_get_device_info(devid);
+
+	if (info->graphics_ver >= 12 && info->graphics_rel < 60)
+		engine_class = DRM_XE_ENGINE_CLASS_RENDER;
+	else
+		engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
+
+	xe_for_each_engine(fd, hwe) {
+		if (hwe->engine_class != engine_class)
+			continue;
+
+		igt_require_f(xe_run_intel_compute_kernel_on_engine(fd,
 hwe),
+			      "GPU not supported\n");
+	}
 }
 
+
 igt_main
 {
 	int xe, num_gt;
--

2.42.0

#4 lore raw
In reply to Nirmoy Das
Quoted 33 lines · Nirmoy Das

Let the test decide what engine class to use instead of a lib function deciding it for tests.

Cc Zbigniew Kempczyński <[email protected]>
Cc Janga Rahul Kumar <[email protected]>
---
 lib/intel_compute.c      | 20 +++-----------------
 tests/intel/xe_compute.c | 21 ++++++++++++++++++++-
 2 files changed, 23 insertions(+), 18 deletions(-)
lib/intel_compute.c +1 -12
index 9d3b97efe..c96e60027 100644
@@ -81,24 +81,10 @@ static void bo_execenv_create(int fd, struct bo_execenv *execenv,
 	execenv->driver = get_intel_driver(fd);
 
 	if (execenv->driver == INTEL_DRIVER_XE) {
+		igt_fail_on(eci == NULL);
 		execenv->vm = xe_vm_create(fd, 0, 0);
-
-		if (eci) {
-			execenv->exec_queue = xe_exec_queue_create(fd, execenv->vm,
-								   eci, 0);
-		} else {
-			uint16_t engine_class;
-			uint32_t devid = intel_get_drm_devid(fd);
-			const struct intel_device_info *info = intel_get_device_info(devid);
-
-			if (info->graphics_ver >= 12 && info->graphics_rel < 60)
-				engine_class = DRM_XE_ENGINE_CLASS_RENDER;
-			else

lib/intel_compute.c static void bo_execenv_create(int fd, struct bo_execenv *execenv, · line 90

Quoted 10 lines
lib/intel_compute.c +2 -5
-				engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
-
-			execenv->exec_queue = xe_exec_queue_create_class(fd, execenv->vm,
-									 engine_class);
-		}
+		execenv->exec_queue = xe_exec_queue_create(fd, execenv->vm, eci,
+							   0);
 	}
 }
 

I don't like this. You're moving logic which is common for compute users outside, giving possibility to pass invalid queue. I vote to not merge this.

--
Zbigniew

Quoted 37 lines
tests/intel/xe_compute.c +20 -1
index 42f42ca0c..cb98b00d5 100644
@@ -163,9 +163,28 @@ test_compute_kernel_with_ccs_mode(int num_gt)
 static void
 test_compute_square(int fd)
 {
-	igt_require_f(run_intel_compute_kernel(fd), "GPU not supported\n");
+	struct drm_xe_engine_class_instance *hwe;
+	const struct intel_device_info *info;
+	uint16_t engine_class;
+	uint32_t devid = intel_get_drm_devid(fd);
+
+	info = intel_get_device_info(devid);
+
+	if (info->graphics_ver >= 12 && info->graphics_rel < 60)
+		engine_class = DRM_XE_ENGINE_CLASS_RENDER;
+	else
+		engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
+
+	xe_for_each_engine(fd, hwe) {
+		if (hwe->engine_class != engine_class)
+			continue;
+
+		igt_require_f(xe_run_intel_compute_kernel_on_engine(fd, hwe),
+			      "GPU not supported\n");
+	}
 }
 
+
 igt_main
 {
 	int xe, num_gt;
Signature · 1 line
2.42.0
author
#5 lore raw
Quoted 47 lines · Zbigniew Kempczyński
Quoted 33 lines · Nirmoy Das

Let the test decide what engine class to use instead of a lib function deciding it for tests.

Cc Zbigniew Kempczyński <[email protected]>
Cc Janga Rahul Kumar <[email protected]>
---
  lib/intel_compute.c      | 20 +++-----------------
  tests/intel/xe_compute.c | 21 ++++++++++++++++++++-
  2 files changed, 23 insertions(+), 18 deletions(-)
lib/intel_compute.c +1 -12
index 9d3b97efe..c96e60027 100644
@@ -81,24 +81,10 @@ static void bo_execenv_create(int fd, struct bo_execenv *execenv,
  	execenv->driver = get_intel_driver(fd);
 
  	if (execenv->driver == INTEL_DRIVER_XE) {
+		igt_fail_on(eci == NULL);
  		execenv->vm = xe_vm_create(fd, 0, 0);
-
-		if (eci) {
-			execenv->exec_queue = xe_exec_queue_create(fd, execenv->vm,
-								   eci, 0);
-		} else {
-			uint16_t engine_class;
-			uint32_t devid = intel_get_drm_devid(fd);
-			const struct intel_device_info *info = intel_get_device_info(devid);
-
-			if (info->graphics_ver >= 12 && info->graphics_rel < 60)
-				engine_class = DRM_XE_ENGINE_CLASS_RENDER;
-			else

lib/intel_compute.c static void bo_execenv_create(int fd, struct bo_execenv *execenv, · line 90

Quoted 10 lines
lib/intel_compute.c +2 -5
-				engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
-
-			execenv->exec_queue = xe_exec_queue_create_class(fd, execenv->vm,
-									 engine_class);
-		}
+		execenv->exec_queue = xe_exec_queue_create(fd, execenv->vm, eci,
+							   0);
  	}
  }
 

I don't like this. You're moving logic which is common for compute users outside, giving possibility to pass invalid queue.

Quoted 2 lines

I vote
to not merge this.

Yes, I waited for that :) Let's ignore the patch. I am fine with having a default eci if user doesn't pass anything.,

Quoted 41 lines

--
Zbigniew

Quoted 37 lines
tests/intel/xe_compute.c +20 -1
index 42f42ca0c..cb98b00d5 100644
@@ -163,9 +163,28 @@ test_compute_kernel_with_ccs_mode(int num_gt)
  static void
  test_compute_square(int fd)
  {
-	igt_require_f(run_intel_compute_kernel(fd), "GPU not supported\n");
+	struct drm_xe_engine_class_instance *hwe;
+	const struct intel_device_info *info;
+	uint16_t engine_class;
+	uint32_t devid = intel_get_drm_devid(fd);
+
+	info = intel_get_device_info(devid);
+
+	if (info->graphics_ver >= 12 && info->graphics_rel < 60)
+		engine_class = DRM_XE_ENGINE_CLASS_RENDER;
+	else
+		engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
+
+	xe_for_each_engine(fd, hwe) {
+		if (hwe->engine_class != engine_class)
+			continue;
+
+		igt_require_f(xe_run_intel_compute_kernel_on_engine(fd, hwe),
+			      "GPU not supported\n");
+	}
  }
 
+
  igt_main
  {
  	int xe, num_gt;
Signature · 1 line
2.42.0