Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: <igt-dev@lists.freedesktop.org>,
	Francois Dugast <francois.dugast@intel.com>
Subject: Re: [PATCH i-g-t] tests/xe_exec_system_allocator: Don't use NaN in an input buffer
Date: Mon, 4 May 2026 08:34:42 -0700	[thread overview]
Message-ID: <afi8khq4u8hbAXrl@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260504152820.3825451-2-zbigniew.kempczynski@intel.com>

On Mon, May 04, 2026 at 05:28:21PM +0200, Zbigniew Kempczyński wrote:
> Setting input buffer memory to random byte (in this particular case
> 0xff) and then use it as a float causes doing compute square on NaN
> numbers. It's nothing wrong about this but comparing NaN in between
> returns false according to IEEE-754 rules. Buffer compare function
> does assertion if output is not equal to expected output so we hit
> this randomly in 'eu-fault*' tests.
> 
> Replace memset to loop which sets all input floats to real numbers
> thus avoiding NaN arithmetic and comparison.
> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Francois Dugast <francois.dugast@intel.com>
> ---
>  tests/intel/xe_exec_system_allocator.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/intel/xe_exec_system_allocator.c b/tests/intel/xe_exec_system_allocator.c
> index 5580099f78..0f1d6ee9c7 100644
> --- a/tests/intel/xe_exec_system_allocator.c
> +++ b/tests/intel/xe_exec_system_allocator.c
> @@ -2339,7 +2339,8 @@ test_compute(int fd, struct drm_xe_engine_class_instance *eci, size_t size,
>  		igt_assert(compute_input);
>  		env.input_addr = to_user_pointer(compute_input);
>  
> -		memset(compute_input, rand() % 255 + 1, size);
> +		for (int j = 0; j < env.array_size; j++)
> +			compute_input[j] = rand() / (float)RAND_MAX;

This logic can still get 0xff or 0x0...

If you want to avoid 0xff or 0x0 I think this logic would work:

memset(compute_input, rand() % 254 + 1, size);

>  
>  		xe_run_intel_compute_kernel_on_engine(fd, eci, &env, EXECENV_PREF_SYSTEM);
>  
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-05-04 15:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 15:28 [PATCH i-g-t] tests/xe_exec_system_allocator: Don't use NaN in an input buffer Zbigniew Kempczyński
2026-05-04 15:34 ` Matthew Brost [this message]
2026-05-04 17:03   ` Zbigniew Kempczyński
2026-05-06  9:39     ` Francois Dugast
2026-05-06 10:38       ` Zbigniew Kempczyński
2026-05-04 18:52 ` ✓ i915.CI.BAT: success for " Patchwork
2026-05-04 19:29 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-05  0:29 ` ✓ Xe.CI.FULL: " Patchwork
2026-05-05  3:23 ` ✗ i915.CI.Full: failure " 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=afi8khq4u8hbAXrl@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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