[PATCH i-g-t] tests/intel/xe_compute_preempt: Add compute-preempt-many
Nirmoy Das
nirmoy.das at linux.intel.com
Tue Feb 27 07:31:54 UTC 2024
ping
On 2/23/2024 8:39 PM, Nirmoy Das wrote:
> Add compute-preempt-many which should exercise multiple
> mid-thread preemption at a time for multiple contexts.
>
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
> lib/intel_compute.c | 24 +++++++++++++++---------
> lib/intel_compute.h | 4 +++-
> tests/intel/xe_compute_preempt.c | 27 ++++++++++++++++++++++++---
> 3 files changed, 42 insertions(+), 13 deletions(-)
>
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c
> index c5d253ebc..8853b5cd3 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -1686,7 +1686,8 @@ static const struct {
> };
>
> static bool __run_intel_compute_kernel_preempt(int fd,
> - struct drm_xe_engine_class_instance *eci)
> + struct drm_xe_engine_class_instance *eci,
> + unsigned int count)
> {
> unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
> unsigned int batch;
> @@ -1719,12 +1720,16 @@ static bool __run_intel_compute_kernel_preempt(int fd,
> if (!kernels->kernel || !kernels->sip_kernel || !kernels->long_kernel)
> return 0;
>
> - intel_compute_preempt_batches[batch].compute_exec(fd, kernels->long_kernel,
> - kernels->long_kernel_size,
> - kernels->kernel, kernels->size,
> - kernels->sip_kernel,
> - kernels->sip_kernel_size,
> - eci);
> + igt_fork(child, count) {
> + intel_compute_preempt_batches[batch].compute_exec(fd, kernels->long_kernel,
> + kernels->long_kernel_size,
> + kernels->kernel, kernels->size,
> + kernels->sip_kernel,
> + kernels->sip_kernel_size,
> + eci);
> + }
> +
> + igt_waitchildren();
>
> return true;
> }
> @@ -1737,7 +1742,8 @@ static bool __run_intel_compute_kernel_preempt(int fd,
> * Returns true on success, false otherwise.
> */
> bool run_intel_compute_kernel_preempt(int fd,
> - struct drm_xe_engine_class_instance *eci)
> + struct drm_xe_engine_class_instance *eci,
> + unsigned int count)
> {
> - return __run_intel_compute_kernel_preempt(fd, eci);
> + return __run_intel_compute_kernel_preempt(fd, eci, count);
> }
> diff --git a/lib/intel_compute.h b/lib/intel_compute.h
> index fe9637b91..430bae562 100644
> --- a/lib/intel_compute.h
> +++ b/lib/intel_compute.h
> @@ -37,5 +37,7 @@ 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, struct drm_xe_engine_class_instance *eci);
> +bool run_intel_compute_kernel_preempt(int fd,
> + struct drm_xe_engine_class_instance *eci,
> + unsigned int count);
> #endif /* INTEL_COMPUTE_H */
> diff --git a/tests/intel/xe_compute_preempt.c b/tests/intel/xe_compute_preempt.c
> index a4e0e1454..fd245b655 100644
> --- a/tests/intel/xe_compute_preempt.c
> +++ b/tests/intel/xe_compute_preempt.c
> @@ -22,11 +22,18 @@
> * Description:
> * Exercise compute walker mid thread preemption scenario
> * Functionality: compute openCL kernel
> + *
> + * SUBTEST: compute-preempt-many
> + * GPU requirement: LNL
> + * Description:
> + * Exercise parallel compute walker mid thread preemption scenario
> + * Functionality: compute openCL kernel
> */
> static void
> -test_compute_preempt(int fd, struct drm_xe_engine_class_instance *hwe)
> +test_compute_preempt(int fd, struct drm_xe_engine_class_instance *hwe,
> + unsigned int count)
> {
> - igt_require_f(run_intel_compute_kernel_preempt(fd, hwe), "GPU not supported\n");
> + igt_require_f(run_intel_compute_kernel_preempt(fd, hwe, count), "GPU not supported\n");
> }
>
> igt_main
> @@ -44,7 +51,21 @@ igt_main
> continue;
>
> igt_dynamic_f("engine-%s", xe_engine_class_string(hwe->engine_class))
> - test_compute_preempt(xe, hwe);
> + test_compute_preempt(xe, hwe, 1);
> + }
> + }
> +
> + igt_subtest_with_dynamic("compute-preempt-many") {
> + xe_for_each_engine(xe, hwe) {
> + /*
> + * TODO: Render engine is getting timed out when count is high,
> + * so for now only test with compute engine
> + */
> + if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COMPUTE)
> + continue;
> +
> + igt_dynamic_f("engine-%s", xe_engine_class_string(hwe->engine_class))
> + test_compute_preempt(xe, hwe, 100);
> }
> }
>
More information about the igt-dev
mailing list