[PATCH i-g-t] tests/intel/xe_compute_preempt: Extend it for more engines

Kumar, Janga Rahul janga.rahul.kumar at intel.com
Thu Feb 22 06:41:23 UTC 2024



> -----Original Message-----
> From: Das, Nirmoy <nirmoy.das at intel.com>
> Sent: Wednesday, February 21, 2024 1:35 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Das, Nirmoy <nirmoy.das at intel.com>; Kumar, Janga Rahul
> <janga.rahul.kumar at intel.com>
> Subject: [PATCH i-g-t] tests/intel/xe_compute_preempt: Extend it for more
> engines
> 
> Extend the test to run on all eligible engines.
> 
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>

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

Thanks,
Rahul
> ---
>  lib/intel_compute.c              | 21 +++++++++++++--------
>  lib/intel_compute.h              |  2 +-
>  tests/intel/xe_compute_preempt.c | 17 +++++++++++++----
>  3 files changed, 27 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c index
> eab407a0d..c5d253ebc 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -1526,7 +1526,8 @@ static void xe2lpg_compute_preempt_exec(int fd,
> const unsigned char *long_kernel
>  					const unsigned char *short_kernel,
>  					unsigned int short_kernel_size,
>  					const unsigned char *sip_kernel,
> -					unsigned int sip_kernel_size)
> +					unsigned int sip_kernel_size,
> +					struct drm_xe_engine_class_instance
> *eci)
>  {
>  #define XE2_BO_PREEMPT_DICT_ENTRIES 11
>  	struct bo_dict_entry bo_dict_long[XE2_BO_PREEMPT_DICT_ENTRIES] =
> { @@ -1578,8 +1579,8 @@ static void xe2lpg_compute_preempt_exec(int fd,
> const unsigned char *long_kernel
>  	for (int i = 0; i < XE2_BO_PREEMPT_DICT_ENTRIES; ++i)
>  		bo_dict_short[i] = bo_dict_long[i];
> 
> -	bo_execenv_create(fd, &execenv_short, NULL);
> -	bo_execenv_create(fd, &execenv_long, NULL);
> +	bo_execenv_create(fd, &execenv_short, eci);
> +	bo_execenv_create(fd, &execenv_long, eci);
> 
>  	bo_dict_long[0].size = ALIGN(long_kernel_size, 0x1000);
>  	bo_dict_short[0].size = ALIGN(short_kernel_size, 0x1000); @@ -1673,7
> +1674,8 @@ static const struct {
>  			     const unsigned char *short_kernel,
>  			     unsigned int short_kernel_size,
>  			     const unsigned char *sip_kernel,
> -			     unsigned int sip_kernel_size);
> +			     unsigned int sip_kernel_size,
> +			     struct drm_xe_engine_class_instance *eci);
>  	uint32_t compat;
>  } intel_compute_preempt_batches[] = {
>  	{
> @@ -1683,7 +1685,8 @@ static const struct {
>  	},
>  };
> 
> -static bool __run_intel_compute_kernel_preempt(int fd)
> +static bool __run_intel_compute_kernel_preempt(int fd,
> +		struct drm_xe_engine_class_instance *eci)
>  {
>  	unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
>  	unsigned int batch;
> @@ -1720,7 +1723,8 @@ static bool __run_intel_compute_kernel_preempt(int
> fd)
>  							  kernels-
> >long_kernel_size,
>  							  kernels->kernel,
> kernels->size,
>  							  kernels->sip_kernel,
> -							  kernels-
> >sip_kernel_size);
> +							  kernels-
> >sip_kernel_size,
> +							  eci);
> 
>  	return true;
>  }
> @@ -1732,7 +1736,8 @@ static bool __run_intel_compute_kernel_preempt(int
> fd)
>   *
>   * Returns true on success, false otherwise.
>   */
> -bool run_intel_compute_kernel_preempt(int fd)
> +bool run_intel_compute_kernel_preempt(int fd,
> +		struct drm_xe_engine_class_instance *eci)
>  {
> -	return __run_intel_compute_kernel_preempt(fd);
> +	return __run_intel_compute_kernel_preempt(fd, eci);
>  }
> diff --git a/lib/intel_compute.h b/lib/intel_compute.h index
> a02688ad4..fe9637b91 100644
> --- a/lib/intel_compute.h
> +++ b/lib/intel_compute.h
> @@ -37,5 +37,5 @@ extern const struct intel_compute_kernels
> intel_compute_square_kernels[];
> 
>  bool run_intel_compute_kernel(int fd);
>  bool xe_run_intel_compute_kernel_on_engine(int fd, struct
> drm_xe_engine_class_instance *eci); -bool
> run_intel_compute_kernel_preempt(int fd);
> +bool run_intel_compute_kernel_preempt(int fd, struct
> +drm_xe_engine_class_instance *eci);
>  #endif	/* INTEL_COMPUTE_H */
> diff --git a/tests/intel/xe_compute_preempt.c
> b/tests/intel/xe_compute_preempt.c
> index 31703638e..a4e0e1454 100644
> --- a/tests/intel/xe_compute_preempt.c
> +++ b/tests/intel/xe_compute_preempt.c
> @@ -24,20 +24,29 @@
>   * Functionality: compute openCL kernel
>   */
>  static void
> -test_compute_preempt(int fd)
> +test_compute_preempt(int fd, struct drm_xe_engine_class_instance *hwe)
>  {
> -	igt_require_f(run_intel_compute_kernel_preempt(fd), "GPU not
> supported\n");
> +	igt_require_f(run_intel_compute_kernel_preempt(fd, hwe), "GPU not
> +supported\n");
>  }
> 
>  igt_main
>  {
>  	int xe;
> +	struct drm_xe_engine_class_instance *hwe;
> 
>  	igt_fixture
>  		xe = drm_open_driver(DRIVER_XE);
> 
> -	igt_subtest("compute-preempt")
> -		test_compute_preempt(xe);
> +	igt_subtest_with_dynamic("compute-preempt") {
> +		xe_for_each_engine(xe, hwe) {
> +			if (hwe->engine_class !=
> DRM_XE_ENGINE_CLASS_COMPUTE &&
> +			    hwe->engine_class !=
> DRM_XE_ENGINE_CLASS_RENDER)
> +				continue;
> +
> +			igt_dynamic_f("engine-%s",
> xe_engine_class_string(hwe->engine_class))
> +				test_compute_preempt(xe, hwe);
> +		}
> +	}
> 
>  	igt_fixture
>  		drm_close_driver(xe);
> --
> 2.42.0



More information about the igt-dev mailing list