From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by sourceware.org (Postfix) with ESMTPS id DEE7A3858CD1 for ; Mon, 18 Mar 2024 19:34:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEE7A3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DEE7A3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710790491; cv=none; b=nxe2x6fk4TLRiX3Rz0Z7eEi+2ELCe/7OW45Z5jd5RQLJd8LCWXrnWTQcGUvOHHqlwr3riMZS6KEUylb1ERzIugkhNHGyjeDPgoBm1iWWQHgbhgcC+QaFN/w5G93zTOFxMv8+lLISEQcG2emo6W8C0XsrBBc8I1sep76+x5zKHBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710790491; c=relaxed/simple; bh=xwOMy2rQopUh2gOTRoMv9N8l5Bj4wRGk/sQWdtHTl/8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=GaQdnlasLK8NbpZ2A59t6RV4W1zxUYe8JQmppi+Pmwgr7tEqJ+waGfKK0z0O5inum+Sm6ojYF3p0/pQB6+y7kocexJk8hr/EvB8iGt7RGOEewC90CnD2KhCtXTh/U8ByZAQj09Zk4BxB20RRgCuKdpD8bkwxat/nivG7qIMzct8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-221830f6643so2524438fac.2 for ; Mon, 18 Mar 2024 12:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710790488; x=1711395288; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yyjEVzoTYkl98tqjIw4PwoBMbdTLiKYu7IabsjljgCE=; b=Kj94OftZh5vlcIxzDzRQ7y0XPN9+t3Oh0eKCFvkxvdAraWIgyYvBR0YbKgBY34p6RA ZruDyqgeCJCIVQbeyrZjdWiTThJePsdKPruVVlZ8123/397275kdUioN5W5MlfC31C8S xx0D6V5nFTCZyAjszkJWEGupV14Jmjo5G0y/ySjITZH36Nkhh7yZ5MCBOxpcGckd1Pwu 3zL8563H92C3WM11D4JizNAvA/m89aiVzxOXuyysE42an2tbfRMJhUQyLDWjBeoOtB6m VeyljL147xfZyVsONKbhv3VGgqbgq075+Jterz3DVT5dWuIbz2AKlenVV5MTBJ9AsqNV CvUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710790488; x=1711395288; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yyjEVzoTYkl98tqjIw4PwoBMbdTLiKYu7IabsjljgCE=; b=xN41zbYt1fAEAOGWnXUEqTmMCbZt1gcawdyiYc5DdZPxy3LVkZWaL2khycuJvcCi/p lWqbkeCAwt+kxCSGoCrM3N+/2Zrr4nFzn2q3uWetwMCvzEc0sQqD1LbvcQlW4rG8HCay I3vsRBV9FtT81XW6OiJj7VZcV1ORD12VFQOKFpsBcsBQBIjd8Zod28U8cqQ9VxmOWOC0 ewDUvPoqJJXQUO7UBhjPpSTMeEFhjpmbh86uxJcYYIFkTXS/8DvjpoXTylJXOomzRscN zzE1HkQKjFzihTc2mAhzmzbcT2qjD+JEJQDO3PvKDbh3TKZnetvTgvIXLp8mGo+bSE0A dxcQ== X-Gm-Message-State: AOJu0YzcecAkwIZajHMjDtTr+Z0jf/izbl0y5SKRnQDkzyXAVMSfWDFa Qj+hZs0LSByAUfY4ljgHjWA44hzrXcjV0EttJPPupx//j6VnL8L+d0ZSJQ/ydFNujsE29yqxzcY 3Kv2mhKkLWaAwfSSrl46sFe0OVRazIJGh X-Google-Smtp-Source: AGHT+IENTjEiXg6jWHPzrXOXjrZcmoeuhByyYJtEJpjPZhQAGe3ThLBlaCRSQ8NrVagKYNSLATW59OPPbkwzR07Cobw= X-Received: by 2002:a05:6871:5c46:b0:221:f921:4672 with SMTP id os6-20020a0568715c4600b00221f9214672mr712764oac.14.1710790488159; Mon, 18 Mar 2024 12:34:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Noah Goldstein Date: Mon, 18 Mar 2024 14:34:36 -0500 Message-ID: Subject: Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks To: Wilco Dijkstra Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_LOTSOFHASH,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Mar 18, 2024 at 2:29=E2=80=AFPM Noah Goldstein wrote: > > On Mon, Mar 18, 2024 at 10:08=E2=80=AFAM Wilco Dijkstra wrote: > > > > Adjust sizes between 64KB and 16MB and iterations based on length. > > Remove incorrect uses of alloc_bufs (since we're not interested in meas= uring > > Linux clear_page time). > > > > OK for commit? > > > > --- > > > > diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-la= rge.c > > index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb1604097259= 96244178ee4fa93fd 100644 > > --- a/benchtests/bench-bzero-large.c > > +++ b/benchtests/bench-bzero-large.c > > @@ -22,9 +22,8 @@ > > #else > > # define TEST_NAME "bzero" > > #endif > > -#define START_SIZE (128 * 1024) > > -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024) > > -#define TIMEOUT (20 * 60) > > +#define START_SIZE (64 * 1024) > > +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > > #include "bench-string.h" > > > > #include "json-lib.h" > > @@ -52,7 +51,7 @@ IMPL (memset_zero, 0) > > static void > > do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n) > > { > > - size_t i, iters =3D 16; > > + size_t i, iters =3D (MIN_PAGE_SIZE * 64) / n; > > timing_t start, stop, cur; > > > > TIMING_NOW (start); > > @@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CH= AR *s, size_t n) > > static void > > do_test (json_ctx_t *json_ctx, size_t align, size_t len) > > { > > - align &=3D 63; > > - if ((align + len) * sizeof (CHAR) > page_size) > > - return; > > - > > json_element_object_begin (json_ctx); > > json_attr_uint (json_ctx, "length", len); > > json_attr_uint (json_ctx, "alignment", align); > > json_array_begin (json_ctx, "timings"); > > > > FOR_EACH_IMPL (impl, 0) > > - { > > - do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len); > > - alloc_bufs (); > > - } > > + do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len); > > > > json_array_end (json_ctx); > > json_element_object_end (json_ctx); > > diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-= large.c > > index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb09= 2ec225004b586d197 100644 > > --- a/benchtests/bench-memcpy-large.c > > +++ b/benchtests/bench-memcpy-large.c > > @@ -19,10 +19,9 @@ > > #ifndef MEMCPY_RESULT > > # define MEMCPY_RESULT(dst, len) dst > > # define START_SIZE (64 * 1024) > > -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) > > +# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > > # define TEST_MAIN > > # define TEST_NAME "memcpy" > > -# define TIMEOUT (20 * 60) > > # include "bench-string.h" > > > > IMPL (memcpy, 1) > > @@ -36,7 +35,7 @@ static void > > do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char= *src, > > size_t len) > > { > > - size_t i, iters =3D 16; > > + size_t i, iters =3D (MIN_PAGE_SIZE * 8) / len; > > timing_t start, stop, cur; > > > > TIMING_NOW (start); > > @@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t= align2, size_t len, > > char *s1, *s2; > > size_t repeats; > > align1 &=3D 4095; > > - if (align1 + len >=3D page_size) > > - return; > > - > > align2 &=3D 4095; > > - if (align2 + len >=3D page_size) > > - return; > > > > s1 =3D (char *) (buf1 + align1); > > s2 =3D (char *) (buf2 + align2); > > diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmov= e-large.c > > index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34= e054cc745180aa4fa 100644 > > --- a/benchtests/bench-memmove-large.c > > +++ b/benchtests/bench-memmove-large.c > > @@ -16,12 +16,10 @@ > > License along with the GNU C Library; if not, see > > . */ > > > > -#define BASE_PAGE_SIZE (1024 * 1024) > > -#define START_SIZE (4 * 1024) > > +#define START_SIZE (64 * 1024) > > #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > > #define TEST_MAIN > > #define TEST_NAME "memmove" > > -#define TIMEOUT (20 * 60) > > #include "bench-string.h" > > #include "json-lib.h" > > > > @@ -33,7 +31,7 @@ static void > > do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, > > size_t len) > > { > > - size_t i, iters =3D 16; > > + size_t i, iters =3D (MIN_PAGE_SIZE * 8) / len; > maybe MAX(16, (MIN_PAGE_SIZE * )/ len). Likewise above. Also, can you include the iter count in the output? > > timing_t start, stop, cur; > > > > TIMING_NOW (start); > > @@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t= align2, size_t len) > > size_t i, j; > > char *s1, *s2; > > > > - align1 &=3D 127; > > - if (align1 + len >=3D page_size) > > - return; > > - > > - align2 &=3D 127; > > - if (align2 + len >=3D page_size) > > - return; > > + align1 &=3D 4095; > > + align2 &=3D 4095; > > > > s1 =3D (char *) (buf2 + align1); > > s2 =3D (char *) (buf2 + align2); > > diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-= large.c > > index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df= 15672f895c111fc28 100644 > > --- a/benchtests/bench-memset-large.c > > +++ b/benchtests/bench-memset-large.c > > @@ -18,9 +18,8 @@ > > > > #define TEST_MAIN > > #define TEST_NAME "memset" > > -#define START_SIZE (128 * 1024) > > -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024) > > -#define TIMEOUT (20 * 60) > > +#define START_SIZE (64 * 1024) > > +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024) > > #include "bench-string.h" > > > > #include "json-lib.h" > > @@ -35,7 +34,7 @@ static void > > do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, > > int c __attribute ((unused)), size_t n) > > { > > - size_t i, iters =3D 16; > > + size_t i, iters =3D (MIN_PAGE_SIZE * 64) / n; > > timing_t start, stop, cur; > > > > TIMING_NOW (start); > > @@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHA= R *s, > > static void > > do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len) > > { > > - align &=3D 63; > > - if ((align + len) * sizeof (CHAR) > page_size) > > - return; > > - > > json_element_object_begin (json_ctx); > > json_attr_uint (json_ctx, "length", len); > > json_attr_uint (json_ctx, "alignment", align); > > @@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, = size_t len) > > json_array_begin (json_ctx, "timings"); > > > > FOR_EACH_IMPL (impl, 0) > > - { > > - do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len); > > - alloc_bufs (); > > - } > > + do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len); > > > > json_array_end (json_ctx); > > json_element_object_end (json_ctx); > >