From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4886CDB471 for ; Mon, 22 Jun 2026 07:37:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CF5410E4F4; Mon, 22 Jun 2026 07:37:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YGaxqddy"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id A3A5410E4F4 for ; Mon, 22 Jun 2026 07:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782113797; x=1813649797; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=5SniHt4ls8oUBpA96Zorfgk5JXCLJlXOhPe1qiuU6dg=; b=YGaxqddy8yhqE1SHBVXTrdjhh9TM/3d30m7uxWnRCJJMP+rG6j+rIzRi Y+qr+7TULz4SEN5J3vZ++DDmn9FJ9cuOUWYmtoDAO6VRIsR388NrSN1VO oOEA4BOOiihf7V9VZ/ngDWjFQzyF1tdq2l9BG/d9QD1ylHUfQQFHAf7Q5 I8VeXkpiJ/FFeYdEA4VQnLK5fbBq5uiysa/UB4jHh45/a/ApfUq2Dcgbq IHVNJ+WuipKrIZ5dqzcv0KOXsfuKcgxBAICjSxUcwiq+VqWGukHRHEQEO enskxXTS6XX+2qvXrDaYiaF5xGS4u2V9uGCwptFb9G8wTvdjyPceJfpXY w==; X-CSE-ConnectionGUID: yqGSGNfZT6CAGaZ7uH9a1g== X-CSE-MsgGUID: ZcXHgFcPRCS2yxeZtbakJA== X-IronPort-AV: E=McAfee;i="6800,10657,11824"; a="93431990" X-IronPort-AV: E=Sophos;i="6.24,218,1774335600"; d="scan'208";a="93431990" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2026 00:36:36 -0700 X-CSE-ConnectionGUID: u8y72HhmRdW3ThOqSqkzBw== X-CSE-MsgGUID: 1ZwlR3zEQIecREbjJu8Skg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,218,1774335600"; d="scan'208";a="246835650" Received: from abityuts-desk.ger.corp.intel.com (HELO localhost) ([10.245.245.82]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2026 00:36:34 -0700 From: Jani Nikula To: Zbigniew =?utf-8?Q?Kempczy=C5=84ski?= Cc: igt-dev@lists.freedesktop.org Subject: Re: [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: use hars_petruska_f54_1_random() from lib/rand In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs Bertel Jungin Aukio 5, 02600 Espoo, Finland References: Date: Mon, 22 Jun 2026 10:36:31 +0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" On Fri, 19 Jun 2026, Zbigniew Kempczy=C5=84ski wrote: > On Thu, Jun 18, 2026 at 05:09:52PM +0300, Jani Nikula wrote: >> Remove the local duplicate of hars_petruska_f54_1_random() by switching >> to use lib/rand. >>=20 >> Signed-off-by: Jani Nikula >> --- >> benchmarks/gem_exec_trace.c | 12 +++--------- >> 1 file changed, 3 insertions(+), 9 deletions(-) >>=20 >> diff --git a/benchmarks/gem_exec_trace.c b/benchmarks/gem_exec_trace.c >> index 4263ccb03dbd..c27639105903 100644 >> --- a/benchmarks/gem_exec_trace.c >> +++ b/benchmarks/gem_exec_trace.c >> @@ -42,6 +42,7 @@ >> #include "drm.h" >> #include "drmtest.h" >> #include "i915/gem_create.h" >> +#include "igt_rand.h" >> #include "igt_stats.h" >> #include "intel_io.h" >> #include "ioctl_wrappers.h" >> @@ -92,14 +93,7 @@ struct trace_wait { >> uint32_t handle; >> } __attribute__((packed)); >>=20=20 >> -static uint32_t hars_petruska_f54_1_random(void) >> -{ >> - static uint32_t state =3D 0x12345678; >> - >> -#define rol(x,k) ((x << k) | (x >> (32-k))) >> - return state =3D (state ^ rol (state, 5) ^ rol (state, 24)) + 0x377988= 49; >> -#undef rol >> -} >> +static uint32_t random_state =3D 0x12345678; >>=20=20 >> static double elapsed(const struct timespec *start, const struct timesp= ec *end) >> { >> @@ -277,7 +271,7 @@ static double replay(const char *filename, long nop,= long range) >> sizeof(*exec_objects)))->handle =3D bo[0]; >>=20=20 >> if (nop > 0) { >> - eb.batch_start_offset =3D hars_petruska_f54_1_random(); >> + eb.batch_start_offset =3D hars_petruska_f54_1_random(&random_state); > > With random_state as above this offset is not random. I think adding nop > to random_state would do this. I'm only aiming to do a non-functional conversion to existing library functions. Please explain how this patch changes behaviour; I don't see it. BR, Jani. > > -- > Zbigniew > >> eb.batch_start_offset =3D >> ((uint64_t)eb.batch_start_offset * range) >> 32; >> eb.batch_start_offset =3D ALIGN(eb.batch_start_offset, 64); >> --=20 >> 2.47.3 >>=20 --=20 Jani Nikula, Intel