igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Andrzej Hajda <andrzej.hajda@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	 Priyanka Dandamudi <priyanka.dandamudi@intel.com>,
	 Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>,
	 Jan Maslak <jan.maslak@intel.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>
Subject: [PATCH 04/11] tests/intel/xe_eudebug_online: use igt_bitmap_hweight
Date: Fri, 28 Nov 2025 15:12:08 +0100	[thread overview]
Message-ID: <20251128-pagefault-one-of-many-v1-4-a8377a93da8f@intel.com> (raw)
In-Reply-To: <20251128-pagefault-one-of-many-v1-0-a8377a93da8f@intel.com>

Drop custom implementation in favor for common helper.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 tests/intel/xe_eudebug_online.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
index 1e160b0c3d8a..3e446fff5604 100644
--- a/tests/intel/xe_eudebug_online.c
+++ b/tests/intel/xe_eudebug_online.c
@@ -245,20 +245,6 @@ static struct gpgpu_shader *get_sip(int fd, const unsigned int flags)
 	return sip;
 }
 
-static int count_set_bits(void *ptr, size_t size)
-{
-	uint32_t *p = ptr;
-	int count = 0;
-	int i;
-
-	igt_assert(size % 4 == 0);
-
-	for (i = 0; i < size/4; i++)
-		count += igt_hweight(p[i]);
-
-	return count;
-}
-
 static int eu_attentions_xor_count(const uint32_t *a, const uint32_t *b, uint32_t size)
 {
 	int count = 0;
@@ -449,7 +435,7 @@ static void eu_attention_debug_trigger(struct xe_eudebug_debugger *d,
 
 	igt_debug("EVENT[%llu] eu-attenttion; threads=%d "
 		 "client[%llu], exec_queue[%llu], lrc[%llu], bitmask_size[%d]\n",
-		 att->base.seqno, count_set_bits(att->bitmask, att->bitmask_size),
+		 att->base.seqno, igt_bitmap_hweight(att->bitmask, att->bitmask_size * 8),
 				att->client_handle, att->exec_queue_handle,
 				att->lrc_handle, att->bitmask_size);
 
@@ -466,7 +452,7 @@ static void eu_attention_reset_trigger(struct xe_eudebug_debugger *d,
 
 	igt_debug("EVENT[%llu] eu-attention with reset; threads=%d "
 		 "client[%llu], exec_queue[%llu], lrc[%llu], bitmask_size[%d]\n",
-		 att->base.seqno, count_set_bits(att->bitmask, att->bitmask_size),
+		 att->base.seqno, igt_bitmap_hweight(att->bitmask, att->bitmask_size * 8),
 				att->client_handle, att->exec_queue_handle,
 				att->lrc_handle, att->bitmask_size);
 
@@ -1244,7 +1230,7 @@ static int query_attention_bitmask_size(int fd, int gt)
 		last_dss_idx++;
 	} while (last_dss >>= 1);
 
-	last_dss_idx *= count_set_bits(eu_per_dss->mask, eu_per_dss->num_bytes);
+	last_dss_idx *= igt_bitmap_hweight(eu_per_dss->mask, eu_per_dss->num_bytes * 8);
 
 	if (intel_gen_has_lockstep_eus(fd))
 		last_dss_idx /= 2;
@@ -1337,7 +1323,7 @@ static void online_session_check(struct xe_eudebug_session *s, int flags)
 
 			igt_assert(event->flags == DRM_XE_EUDEBUG_EVENT_STATE_CHANGE);
 			igt_assert_eq(ea->bitmask_size, bitmask_size);
-			sum += count_set_bits(ea->bitmask, bitmask_size);
+			sum += igt_bitmap_hweight(ea->bitmask, bitmask_size * 8);
 			igt_assert(match_attention_with_exec_queue(s->debugger->log, ea));
 		} else if (event->type == DRM_XE_EUDEBUG_EVENT_PAGEFAULT) {
 			uint32_t after_offset = bitmask_size / sizeof(uint32_t);
@@ -1402,7 +1388,7 @@ static void pagefault_trigger(struct xe_eudebug_debugger *d,
 	int threads[3], pagefault_threads, idx;
 
 	for (idx = 0; idx < 3; idx++)
-		threads[idx] = count_set_bits(ptrs[idx], attn_size);
+		threads[idx] = igt_bitmap_hweight(ptrs[idx], attn_size * 8);
 
 	pagefault_threads = eu_attentions_xor_count(ptrs[1], ptrs[2], attn_size);
 

-- 
2.43.0


  parent reply	other threads:[~2025-11-28 14:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 14:12 [PATCH 00/11] tests/intel/xe_eudebug_online: add pagefault-one-of-many test Andrzej Hajda
2025-11-28 14:12 ` [PATCH 01/11] lib/igt_aux: add hweight helper for bitmaps Andrzej Hajda
2025-11-28 14:12 ` [PATCH 02/11] lib/xe/xe_query: add helpers to return count of EUs and EU threads Andrzej Hajda
2025-11-28 14:12 ` [PATCH 03/11] lib/gpgpu_shader: use recently introduced helper to get EU thread count Andrzej Hajda
2025-11-28 14:12 ` Andrzej Hajda [this message]
2025-11-28 14:12 ` [PATCH 05/11] lib/igt_aux: add fls helper for bitmaps Andrzej Hajda
2025-11-28 14:12 ` [PATCH 06/11] tests/intel/xe_eudebug_online: use igt_bitmap_fls to calculate max dss count Andrzej Hajda
2025-11-28 14:12 ` [PATCH 07/11] tests/intel/xe_eudebug_online: add fd and flags to online_debug_data Andrzej Hajda
2025-11-28 14:12 ` [PATCH 08/11] tests/intel/xe_eudebug_online: rename threads_count to thread_hit_count Andrzej Hajda
2025-11-28 14:12 ` [PATCH 09/11] tests/intel/xe_eudebug_online: use online_debug_data in get_(shader|sip) Andrzej Hajda
2025-11-28 14:12 ` [PATCH 10/11] tests/intel/xe_eudebug_online: cache thread count value Andrzej Hajda
2025-11-28 14:12 ` [PATCH 11/11] tests/intel/xe_eudebug_online: add pagefault-one-of-many test Andrzej Hajda
2025-11-28 15:01 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-11-28 15:39 ` ✓ i915.CI.BAT: " Patchwork
2025-11-28 15:58 ` ✗ Xe.CI.Full: failure " Patchwork
2025-12-01 13:24   ` â " Hajda, Andrzej
2025-11-28 16:24 ` ✗ i915.CI.Full: " Patchwork
2025-12-01 14:54   ` â " Hajda, Andrzej
2025-12-03 11:16 ` [PATCH 00/11] " Maciej Patelczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251128-pagefault-one-of-many-v1-4-a8377a93da8f@intel.com \
    --to=andrzej.hajda@intel.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jan.maslak@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=priyanka.dandamudi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).