[PATCH 3/3] tests/xe_eudebug_online: update thread count handling in query_attention_bitmask_size()

Grzegorzek, Dominik dominik.grzegorzek at intel.com
Thu Nov 21 10:18:40 UTC 2024


On Wed, 2024-11-20 at 22:28 +0000, Jan Maslak wrote:
> Update query_attention_bitmask_size() function to fetch the EU thread
> count from hwconfig, instead of being hardcoded.
> 
> Signed-off-by: Jan Maslak <jan.maslak at intel.com>
> ---
>  tests/intel/xe_eudebug_online.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
> index 0ef0d8093..78d9d4bc3 100644
> --- a/tests/intel/xe_eudebug_online.c
> +++ b/tests/intel/xe_eudebug_online.c
> @@ -1118,7 +1118,9 @@ static bool intel_gen_has_lockstep_eus(int fd)
>  
>  static int query_attention_bitmask_size(int fd, int gt)
>  {
> -	const unsigned int threads = 8;
> +	uint32_t thread_count_len;
> +	uint32_t *thread_count_ptr;
> +	uint32_t thread_count;
>  	struct drm_xe_query_topology_mask *c_dss = NULL, *g_dss = NULL, *eu_per_dss = NULL;
>  	struct drm_xe_query_topology_mask *topology;
>  	struct drm_xe_device_query query = {
> @@ -1130,6 +1132,11 @@ static int query_attention_bitmask_size(int fd, int gt)
>  	int pos = 0, eus;
>  	uint8_t *any_dss;
>  
> +	thread_count_ptr = xe_hwconfig_lookup_value(fd, INTEL_HWCONFIG_NUM_THREADS_PER_EU,
> +						    &thread_count_len);
> +	igt_assert(thread_count_ptr);
I would assert as well thread_count_len to be desired size. Other than that, it is:

Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>

Regards, 
Dominik
> +	thread_count = *thread_count_ptr;
> +
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  	igt_assert_neq(query.size, 0);
>  
> @@ -1178,8 +1185,9 @@ static int query_attention_bitmask_size(int fd, int gt)
>  
>  	free(any_dss);
>  	free(topology);
> +	free(thread_count_ptr);
>  
> -	return eus * threads / 8;
> +	return eus * DIV_ROUND_UP(thread_count, 8);
>  }
>  
>  static struct drm_xe_eudebug_event_exec_queue *



More information about the igt-dev mailing list