Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sharma, Swati2" <swati2.sharma@intel.com>
To: Jani Nikula <jani.nikula@intel.com>, <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand
Date: Fri, 19 Jun 2026 00:26:11 +0530	[thread overview]
Message-ID: <17cfae47-c50f-461d-b298-08d933dd3d14@intel.com> (raw)
In-Reply-To: <d4eef997aef5064ec0e797e36d7196c0dcc1f4f6.1781791747.git.jani.nikula@intel.com>

Hi Jani

On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Remove the local duplicate of hars_petruska_f54_1_random() by switching
> to use lib/rand.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Patch LGTM

Reviewed-by: Swati Sharma <swati2.sharma@intel.com>

> ---
>   benchmarks/gem_exec_reloc.c | 15 ++++-----------
>   1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/benchmarks/gem_exec_reloc.c b/benchmarks/gem_exec_reloc.c
> index 0610308669f2..ff25a3b3b59a 100644
> --- a/benchmarks/gem_exec_reloc.c
> +++ b/benchmarks/gem_exec_reloc.c
> @@ -41,6 +41,7 @@
>   #include "i915/gem_create.h"
>   #include "i915/gem_mman.h"
>   #include "igt_debugfs.h"
> +#include "igt_rand.h"
>   #include "intel_reg.h"
>   #include "ioctl_wrappers.h"
>   
> @@ -52,15 +53,7 @@
>   #define REVERSE_OFFSET 0x40
>   #define RANDOM_OFFSET 0x80
>   
> -static uint32_t
> -hars_petruska_f54_1_random (void)
> -{
> -	static uint32_t state = 0x12345678;
> -
> -#define rol(x,k) ((x << k) | (x >> (32-k)))
> -	return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
> -#undef rol
> -}
> +static uint32_t random_state = 0x12345678;
>   
>   #define ELAPSED(a,b) (1e6*((b)->tv_sec - (a)->tv_sec) + ((b)->tv_usec - (a)->tv_usec))
>   static int run(unsigned batch_size,
> @@ -106,7 +99,7 @@ static int run(unsigned batch_size,
>   			mem_reloc[n].offset = batch_size - 8 - (8*n % (batch_size - 16));
>   		else if (flags & RANDOM_OFFSET)
>   			mem_reloc[n].offset = 8 +
> -				8*hars_petruska_f54_1_random() % (batch_size - 16);
> +				8*hars_petruska_f54_1_random(&random_state) % (batch_size - 16);
>   		else
>   			mem_reloc[n].offset = 1024;
>   		mem_reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;
> @@ -135,7 +128,7 @@ static int run(unsigned batch_size,
>   		execbuf.flags |= I915_EXEC_NO_RELOC;
>   
>   	for (n = 0; n < num_relocs; n++) {
> -		target[n] = hars_petruska_f54_1_random() % num_objects;
> +		target[n] = hars_petruska_f54_1_random(&random_state) % num_objects;
>   		if (flags & LUT)
>   			reloc[n].target_handle = target[n];
>   		else

  reply	other threads:[~2026-06-18 18:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
2026-06-18 14:09 ` [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc() Jani Nikula
2026-06-18 18:54   ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions Jani Nikula
2026-06-18 18:55   ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand Jani Nikula
2026-06-18 18:56   ` Sharma, Swati2 [this message]
2026-06-18 14:09 ` [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: " Jani Nikula
2026-06-18 18:56   ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: " Jani Nikula
2026-06-18 18:56   ` Sharma, Swati2
2026-06-18 17:49 ` ✓ Xe.CI.BAT: success for igt: cleanups to random functions Patchwork
2026-06-18 18:30 ` ✓ i915.CI.BAT: " Patchwork

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=17cfae47-c50f-461d-b298-08d933dd3d14@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@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