public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
Date: Fri, 24 Mar 2023 11:29:50 -0500	[thread overview]
Message-ID: <CAFUsyfKV7Ndq0h6g7hG=zibWROt6SOFZDyACBJQLHeu60fh6Sw@mail.gmail.com> (raw)
In-Reply-To: <PAWPR08MB898250F97282B1772DB9A25F83879@PAWPR08MB8982.eurprd08.prod.outlook.com>

On Thu, Mar 23, 2023 at 6:01 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Noah,
>
>
> >> -  align &= 63;
> >
> > Can you replace with `align &= getpagesize () - 1`?
>
> Yes that would make more sense indeed.
>
> >> -  if ((align + len) * sizeof (CHAR) > page_size)
> >> -    return;
> >
> > Is there a reason to remove the out of bounds check?
>
> Well it can't ever go out of bounds. The allocated buffer size is
> 2 * page_size (ie. 4 times real page size or 2 times MIN_PAGE_SIZE
> due to the incorrect logic in init_sizes).
>

I disagree, we have a bounds check in nearly all other benchmarks
and I think its 1) a convenience so you don't need to add the equivalent
code in many other places and 2) a portability thing as page size varies
by system but people often write benchmark bounds with constant size
bounds.

> And if it could go out of bounds it should be an assert so we don't
> silently benchmark a bounds check!

Then I think the approach would be to output the json parameters and
report invalid in some way for the times.

In other places benchmarks rely on this bounds check and it seems more
error prone than anything else to just leave it unchecked. I would much
rather the benchmark not run or fail in some way than report a potentially
incorrect time as true.

>
> >>    align2 &= 4095;
> >
> > Might as well fix these up, can you replace 4095 with `getpagesize () - 1`?
>
> Sure.
>
> >> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
> >
> > this takes [.5, 10] seconds?
>
> Yes, it's only 1 GB written per test. It takes ~8.5 seconds on an old slow
> Cortex-A72.
>
> Cheers,
> Wilco
>
>

  reply	other threads:[~2023-03-24 16:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 11:41 Wilco Dijkstra
2023-03-23 18:17 ` Noah Goldstein
2023-03-23 23:01   ` Wilco Dijkstra
2023-03-24 16:29     ` Noah Goldstein [this message]
2024-03-18 15:08 Wilco Dijkstra
2024-03-18 19:29 ` Noah Goldstein
2024-03-18 19:34   ` Noah Goldstein
2024-03-27 17:02     ` Wilco Dijkstra
2024-03-28 19:28       ` Noah Goldstein

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='CAFUsyfKV7Ndq0h6g7hG=zibWROt6SOFZDyACBJQLHeu60fh6Sw@mail.gmail.com' \
    --to=goldstein.w.n@gmail.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).