[PATCH i-g-t] lib/intel_compute: Do not assume engine class

Kumar, Janga Rahul janga.rahul.kumar at intel.com
Fri Mar 15 09:06:16 UTC 2024



> -----Original Message-----
> From: Das, Nirmoy <nirmoy.das at intel.com>
> Sent: Friday, March 15, 2024 3:08 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Das, Nirmoy <nirmoy.das at intel.com>; Kempczynski, Zbigniew
> <zbigniew.kempczynski at intel.com>; Kumar, Janga Rahul
> <janga.rahul.kumar at intel.com>
> Subject: [PATCH i-g-t] 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 <zbigniew.kempczynski at intel.com>
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>

 LGTM,
Acked-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>

> ---
>  lib/intel_compute.c      | 20 +++-----------------
>  tests/intel/xe_compute.c | 21 ++++++++++++++++++++-
>  2 files changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c index
> 9d3b97efe..c96e60027 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -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);
>  	}
>  }
> 
> diff --git a/tests/intel/xe_compute.c b/tests/intel/xe_compute.c index
> 42f42ca0c..cb98b00d5 100644
> --- a/tests/intel/xe_compute.c
> +++ b/tests/intel/xe_compute.c
> @@ -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



More information about the igt-dev mailing list