From patchwork Thu Mar 23 11:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 1760272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=M8PbLgLl; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pj3hD6Krsz1yXr for ; Thu, 23 Mar 2023 22:55:56 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A138C3850200 for ; Thu, 23 Mar 2023 11:55:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A138C3850200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679572554; bh=4CeCNxklCFrEONWYTT/3V3wvKsQaGmeoAoMOl5x5/MQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=M8PbLgLlkZoCtH6NGLtQrx+TqlYqnvxpKYr6Sy0gA359QVFQ6p8xNsFiWQ2eXZi6O AG3dWFm/niQrOQuJiP0vyKOg5AJdH5cf7UMJv8z8yn6m6EFiCpuBGlli/DB0iGcU58 ayTPce2X8Z4U3PMURs/GIcB67iQTeVc6fLSv+QVU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2050.outbound.protection.outlook.com [40.107.6.50]) by sourceware.org (Postfix) with ESMTPS id BED4B3858C20 for ; Thu, 23 Mar 2023 11:55:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BED4B3858C20 Received: from AM6P193CA0054.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::31) by GV2PR08MB8194.eurprd08.prod.outlook.com (2603:10a6:150:74::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Thu, 23 Mar 2023 11:55:31 +0000 Received: from AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::31) by AM6P193CA0054.outlook.office365.com (2603:10a6:209:8e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38 via Frontend Transport; Thu, 23 Mar 2023 11:55:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT037.mail.protection.outlook.com (100.127.140.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Thu, 23 Mar 2023 11:55:31 +0000 Received: ("Tessian outbound b29c0599cbc9:v135"); Thu, 23 Mar 2023 11:55:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8216968a0d1ed225 X-CR-MTA-TID: 64aa7808 Received: from 2491efd95b55.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E95CDB7C-2FD9-4C1B-9A0D-943E62C0473F.1; Thu, 23 Mar 2023 11:55:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2491efd95b55.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Mar 2023 11:55:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=amm0Of9qiDjxlT78tyGRRuW7mzuN/1K64pbAhfhwnfiHn+dv7j1nyQEc3DzAAmkT4hfjojk32wijZKtoW+/dtnG62GWkqkSQy4Of6M5LeBo+Zh6WSv0MrmpShRz6VqmLFV+gPuYsMFFfFh1RZN4AhCSy56YCgYNpglM9JAHX9QILYixr8V8FkmAMmA4CV15Qy1ikeJ5QmhyrX95CSxxz/xamnKLvDn0OKMJYGcUuSCDL6b5Zod5CnHEteZarNJpO+5blShtPMKQjSOnJpcDOo77Y0rgtMiubZof3VZyyfPdQgRf2OEF1ZyrincPTspLgo0oVT3AWXaaNapshURfiGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4CeCNxklCFrEONWYTT/3V3wvKsQaGmeoAoMOl5x5/MQ=; b=NIqNYoHsLs7vm5p7cBzlsHTUazh3zsP6dqCpyCwUN+R7VXNlXlRmkTaI/Ju8q0NER+9cPwACImCjT/RyTvu7FysGr9WBjFS6rBI10rjx9qFkzHQDqySrB62DjoJzGuFi7JI1YSZWVQvsSX+3u9gMnk1GDdKENx3J5UeN2n7HhUYi0/0FZQwlWieUkn5iu+nudmy451zSA7do7ncrpQa7k7ooLiBuz99lguiGny2Soxa310cBN4bu96rHBruJLWUwqjNFPKSscFgLg58178jj7g534l8INN1PFPeerP7pbyzRYv9Hg7LJgAj6XIOwQrIh1cbo0LPHDh9ehVw59Fd4Jg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from PAWPR08MB8982.eurprd08.prod.outlook.com (2603:10a6:102:33f::20) by AS8PR08MB6680.eurprd08.prod.outlook.com (2603:10a6:20b:397::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 11:55:20 +0000 Received: from PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::dc17:8fa2:cce5:3573]) by PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::dc17:8fa2:cce5:3573%8]) with mapi id 15.20.6178.037; Thu, 23 Mar 2023 11:55:20 +0000 To: 'GNU C Library' Subject: [PATCH] Benchtests: Remove broken walk benchmarks Thread-Topic: [PATCH] Benchtests: Remove broken walk benchmarks Thread-Index: AQHZXXznUfXV2KZcg0202r/6BbHHxw== Date: Thu, 23 Mar 2023 11:55:20 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: PAWPR08MB8982:EE_|AS8PR08MB6680:EE_|AM7EUR03FT037:EE_|GV2PR08MB8194:EE_ X-MS-Office365-Filtering-Correlation-Id: 38e9119c-8892-4321-7cff-08db2b9580dd x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: gC52ttRivwW5PSyy70yj5HPC0Kj/JF95cD6IhuiySAvsMZ9vt21DeeNS3LAg5LSUsKBvhFWNjEkHrusRf4uaqQzFVp1SfPN4Dd7kkLS9DNMDDIpf8601v/sYgn7cOhoszrmLfPlbvrx+0exS855cJuZSLhWZAhSSrb2L2n8oL4xDLLzdWW7Cq2wGCEnYTL1InBu4iZqzefVLFAK8yZZFdELo0M03c0TbX4ehmTEo9JNuCO2H8bv8WpNit5x9x5FVwKX/xskeGN9Q10vL2c2bxbl6GBFiNwXlRFVcq/SmjMZPg/7kWzwuXsTrYW9JAVJQc4cEn0En+lyaYkZVSVmFiaGJufNbv9xOdzJl6uAqNBDa8kipMB/amjLaOb2W95+nhngXpapmVSHQl+qehQa8T949t/QhZiTyo3N8da9c+soTzQI4bZqPwkGnmIC4P9j90Y00tN5D5oBNTBUOBsP8Qs2S2iWK8wolMsTi+3Cef7iVwti7mi4tY6gZcQmf9LeYq5YOmqV7fcu+Ms3cmjwotwjMMWGeWMHK1JzFVhihHc3uYS9thvWg2+GmgHds7KpDxalvWxhdE2zB/ExnCDVlSTIv93XRBAd9KN24/0hUzgPYMMJGdoT76uSbTMKkVYTem7zEx8wqbSenE2yUKqCG7iBo3H3vhvBOsLUULoBuLcsFyuM0+lmTPZ51m6+w/30r+w1JvHfsc2nyJMGKSeim6Q== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8982.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(396003)(136003)(39860400002)(366004)(346002)(376002)(451199018)(38100700002)(55016003)(2906002)(38070700005)(478600001)(83380400001)(7696005)(186003)(9686003)(86362001)(33656002)(71200400001)(316002)(91956017)(66556008)(66476007)(66446008)(64756008)(8676002)(66946007)(6916009)(76116006)(52536014)(8936002)(30864003)(26005)(6506007)(122000001)(5660300002)(41300700001)(2004002)(579004); DIR:OUT; SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6680 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: fa808505-b643-437b-e3bb-08db2b957a52 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TxILNo6hWk+gMX0sm4Lap521BnRLGoFe6PsRXJxyFqzI5yQiTrNEjWRCwSg2/KnNGrlXzm+ohYjhkODMn562wB96dkQh4PvE8esbUNG6OJuf//Gkq+q/2Hn3NOykXeDWmXwzWleuIoEZPZdaaUI6eIAnXUxnz310dRu0mi5wCIhISJvSc/UJFKv+wjkcHHZeEDmVB2dTSSQZ1ecy7T39oChHbkr/lZBg6XCjz0zz/rX1WdbfSNqm4z29XGCZ9e/iwHWRlcoQEvcL5N5PkbKhKpGawz0Da17JvUl0JtnyiUxLNJAUAp7COW1Y+RIIMY/Yikh0vJeiR5RHThxZygC1w7tQtipbMzVw/Zz/PMCwbbd8AtlTbPr68+zgVcTCPNFJQqsi2jXD3lmQ5mhF2IK/ab+eNquyD6pf93kUh4UFY4pzR2ppc5ohQZzabeltxfsPerBECM3s2ouSFYBuLvQsNFUsuE0CbH5N2W9UdynfQepQo2DiUr40cDKOI20VFitkxxdRESabQYRx1WTj2/CJHzxN497WAbeArlHcub7NhrLOAQXx7YKDerv9v+B9CgTcjLrsER0eV0pI8S6rM/g473gza+YEK8ON1ayQO7QhWr6rNoFY1RvN4tcGqpSWOFp2LJZU4EcdXYQl/q68i/PDzbU7fijU9dlpXDh6qGS6ptxpG59mVzuKhtfPiVA1QXLLWcUQ2xB+F1NXcc0I0vwQxg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230025)(4636009)(376002)(136003)(396003)(39860400002)(346002)(451199018)(36840700001)(46966006)(40470700004)(82310400005)(83380400001)(47076005)(7696005)(316002)(336012)(5660300002)(33656002)(186003)(26005)(9686003)(478600001)(8936002)(6506007)(40480700001)(55016003)(86362001)(30864003)(36860700001)(81166007)(8676002)(70586007)(356005)(52536014)(70206006)(40460700003)(82740400003)(6916009)(41300700001)(2906002)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2023 11:55:31.4396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38e9119c-8892-4321-7cff-08db2b9580dd X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8194 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The walk benchmarks don't measure anything useful - memory is not initialized properly so doing a single walk in 32MB just measures reading the 4KB zero page for reads and clear_page overhead for writes. The memset variants don't even manage to do a walk in the 32MB region due to using incorrect pointer increments... Neither is it clear why it is walking backwards since this won't confuse modern prefetchers. If you fix the benchmark and print the bandwidth, the results are identical for all sizes larger than ~1KB since it is just testing memory bandwidth of a single 32MB block. This case is already tested by the large benchmark, so overall it doesn't seem useful to keep these. Reviewed-by: Carlos O'Donell diff --git a/benchtests/Makefile b/benchtests/Makefile index 721f32afdbc93da42b4f4ce6ba09e92c18613607..0c2b396d6935ecb3fbd5620c076a8ba33e7f3f7a 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -125,7 +125,6 @@ bench-string := \ string-benchset := \ bzero \ bzero-large \ - bzero-walk \ memccpy \ memchr \ memcmp \ @@ -133,19 +132,15 @@ string-benchset := \ memcpy \ memcpy-large \ memcpy-random \ - memcpy-walk \ memmem \ memmove \ memmove-large \ - memmove-walk \ mempcpy \ memrchr \ memset \ memset-large \ - memset-walk \ memset-zero \ memset-zero-large \ - memset-zero-walk \ rawmemchr \ stpcpy \ stpcpy_chk \ diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c deleted file mode 100644 index 77bdabeb0d44d7150a78bd345c97edf88b133735..0000000000000000000000000000000000000000 --- a/benchtests/bench-bzero-walk.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Measure memset function throughput with large data sizes. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define TEST_MAIN -#ifdef DO_MEMSET -# define TEST_NAME "memset" -#else -# define TEST_NAME "bzero" -#endif -#define START_SIZE 128 -#define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) -#define TIMEOUT (20 * 60) -#include "bench-string.h" - -#include "json-lib.h" - -#ifdef DO_MEMSET -void *generic_memset (void *, int, size_t); - -typedef void *(*proto_t) (void *, int, size_t); - -IMPL (memset, 1) -IMPL (generic_memset, 0) - -#else -static void -memset_zero (void * s, size_t len) -{ - memset (s, '\0', len); -} - -typedef void (*proto_t) (void *, size_t); - -IMPL (bzero, 1) -IMPL (memset_zero, 0) -#endif - -static void -do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, CHAR *s_end, - size_t n) -{ - size_t i, iters = MIN_PAGE_SIZE / n; - timing_t start, stop, cur; - - TIMING_NOW (start); - for (i = 0; i < iters && s <= s_end; s_end -= n, i++) -#ifdef DO_MEMSET - CALL (impl, s, 0, n); -#else - CALL (impl, s, n); -#endif - TIMING_NOW (stop); - - TIMING_DIFF (cur, start, stop); - - /* Get time taken per function call. */ - json_element_double (json_ctx, (double) cur / i); -} - -static void -do_test (json_ctx_t *json_ctx, size_t len) -{ - json_element_object_begin (json_ctx); - json_attr_uint (json_ctx, "length", len); - json_array_begin (json_ctx, "timings"); - - FOR_EACH_IMPL (impl, 0) - { - do_one_test (json_ctx, impl, (CHAR *) buf1, - (CHAR *) buf1 + MIN_PAGE_SIZE - len, len); - alloc_bufs (); - } - - json_array_end (json_ctx); - json_element_object_end (json_ctx); -} - -int -test_main (void) -{ - json_ctx_t json_ctx; - size_t i; - - test_init (); - - json_init (&json_ctx, 0, stdout); - - json_document_begin (&json_ctx); - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); - - json_attr_object_begin (&json_ctx, "functions"); - json_attr_object_begin (&json_ctx, TEST_NAME); - json_attr_string (&json_ctx, "bench-variant", "walk"); - - json_array_begin (&json_ctx, "ifuncs"); - FOR_EACH_IMPL (impl, 0) - json_element_string (&json_ctx, impl->name); - json_array_end (&json_ctx); - - json_array_begin (&json_ctx, "results"); - for (i = 1; i <= 64; i++) - do_test (&json_ctx, i); - - for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) - { - do_test (&json_ctx, i); - do_test (&json_ctx, i + 1); - } - - json_array_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_document_end (&json_ctx); - - return ret; -} - -#include - -#ifdef DO_MEMSET -# define libc_hidden_builtin_def(X) -# define libc_hidden_def(X) -# define libc_hidden_weak(X) -# define weak_alias(X,Y) -# undef MEMSET -# define MEMSET generic_memset -# include -#endif diff --git a/benchtests/bench-memcpy-walk.c b/benchtests/bench-memcpy-walk.c deleted file mode 100644 index 12de8a9e819e02d3c608532640e955688ac8415a..0000000000000000000000000000000000000000 --- a/benchtests/bench-memcpy-walk.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Measure memcpy function combined throughput for different alignments. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This microbenchmark measures the throughput of memcpy for various sizes from - 1 byte to 32MiB, doubling every iteration and then misaligning by 0-15 - bytes. The copies are done from source to destination and then back and the - source walks forward across the array and the destination walks backward by - one byte each, thus measuring misaligned accesses as well. The idea is to - avoid caching effects by copying a different string and far enough from each - other, walking in different directions so that we can measure prefetcher - efficiency (software or hardware) more closely than with a loop copying the - same data over and over, which eventually only gives us L1 cache - performance. */ - -#ifndef MEMCPY_RESULT -# define MEMCPY_RESULT(dst, len) dst -# define START_SIZE 128 -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) -# define TEST_MAIN -# define TEST_NAME "memcpy" -# define TIMEOUT (20 * 60) -# include "bench-string.h" - -IMPL (memcpy, 1) -#endif - -#include "json-lib.h" - -typedef char *(*proto_t) (char *, const char *, size_t); - -static void -do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, - size_t len) -{ - size_t i = 0; - timing_t start, stop, cur; - - char *dst_end = dst + MIN_PAGE_SIZE - len; - char *src_end = src + MIN_PAGE_SIZE - len; - - TIMING_NOW (start); - /* Copy the entire buffer backwards, LEN at a time. */ - for (; src_end >= src && dst_end >= dst; src_end -= len, dst_end -= len, i++) - CALL (impl, src_end, dst_end, len); - TIMING_NOW (stop); - - TIMING_DIFF (cur, start, stop); - - /* Get time taken per function call. */ - json_element_double (json_ctx, (double) cur / i); -} - -static void -do_test (json_ctx_t *json_ctx, size_t len, int both_ways) -{ - - char *s1, *s2; - size_t repeats; - s1 = (char *) (buf1); - s2 = (char *) (buf2); - - for (repeats = both_ways ? 2 : 1; repeats; --repeats) - { - json_element_object_begin (json_ctx); - json_attr_uint (json_ctx, "length", (double) len); - json_attr_uint (json_ctx, "dst > src", (double) (s2 > s1)); - json_array_begin (json_ctx, "timings"); - - FOR_EACH_IMPL (impl, 0) - do_one_test (json_ctx, impl, s2, s1, len); - - json_array_end (json_ctx); - json_element_object_end (json_ctx); - - s1 = (char *) (buf2); - s2 = (char *) (buf1); - } -} - -int -test_main (void) -{ - json_ctx_t json_ctx; - - test_init (); - - json_init (&json_ctx, 0, stdout); - - json_document_begin (&json_ctx); - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); - - json_attr_object_begin (&json_ctx, "functions"); - json_attr_object_begin (&json_ctx, "memcpy"); - json_attr_string (&json_ctx, "bench-variant", "walk"); - - json_array_begin (&json_ctx, "ifuncs"); - FOR_EACH_IMPL (impl, 0) - json_element_string (&json_ctx, impl->name); - json_array_end (&json_ctx); - - json_array_begin (&json_ctx, "results"); - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) - { - do_test (&json_ctx, i, 1); - do_test (&json_ctx, i + 1, 1); - } - - json_array_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_document_end (&json_ctx); - - return ret; -} - -#include diff --git a/benchtests/bench-memmove-walk.c b/benchtests/bench-memmove-walk.c deleted file mode 100644 index c93ada461880f21b898ac244130a80ffe380a269..0000000000000000000000000000000000000000 --- a/benchtests/bench-memmove-walk.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Measure memmove function combined throughput for different alignments. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This microbenchmark measures the throughput of memmove for various sizes from - 1 byte to 32MiB, doubling every iteration and then misaligning by 0-15 - bytes. The copies are done from source to destination and then back and the - source walks forward across the array and the destination walks backward by - one byte each, thus measuring misaligned accesses as well. The idea is to - avoid caching effects by copying a different string and far enough from each - other, walking in different directions so that we can measure prefetcher - efficiency (software or hardware) more closely than with a loop copying the - same data over and over, which eventually only gives us L1 cache - performance. */ - -#ifndef MEMMOVE_RESULT -# define MEMMOVE_RESULT(dst, len) dst -# define START_SIZE 128 -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) -# define TEST_MAIN -# define TEST_NAME "memmove" -# define TIMEOUT (20 * 60) -# include "bench-string.h" - -#define NO_OVERLAP 0 -#define PARTIAL_OVERLAP 1 -#define COMPLETE_OVERLAP 2 - -IMPL (memmove, 1) -#endif - -#include "json-lib.h" - -typedef char *(*proto_t) (char *, const char *, size_t); - -static void -do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, - size_t len) -{ - size_t i = 0; - timing_t start, stop, cur; - - char *dst_end = dst + MIN_PAGE_SIZE - len; - char *src_end = src + MIN_PAGE_SIZE - len; - - TIMING_NOW (start); - /* Copy the entire buffer backwards, LEN at a time. */ - for (; src_end >= src && dst <= dst_end; dst += len, src_end -= len, i++) - CALL (impl, dst, src_end, len); - TIMING_NOW (stop); - - TIMING_DIFF (cur, start, stop); - - /* Get time taken per function call. */ - json_element_double (json_ctx, (double) cur / i); -} - -static void -do_test (json_ctx_t *json_ctx, size_t len, int overlap, int both_ways) -{ - char *s1, *s2, *tmp; - size_t repeats; - - s1 = (char *) (buf1); - s2 = (char *) (buf2); - if (overlap != NO_OVERLAP) - s2 = s1; - if (overlap == PARTIAL_OVERLAP) - s2 += len / 2; - - for (repeats = both_ways ? 2 : 1; repeats; --repeats) - { - json_element_object_begin (json_ctx); - json_attr_uint (json_ctx, "length", (double) len); - json_attr_string(json_ctx, "overlap", - overlap == NO_OVERLAP ? "none" - : overlap == PARTIAL_OVERLAP ? "partial" - : "complete"); - json_attr_uint (json_ctx, "dst > src", (double) (s2 > s1)); - json_array_begin (json_ctx, "timings"); - - - FOR_EACH_IMPL (impl, 0) - do_one_test (json_ctx, impl, (char *) buf2, (char *) buf1, len); - - json_array_end (json_ctx); - json_element_object_end (json_ctx); - - tmp = s1; - s1 = s2; - s2 = tmp; - } -} - -int -test_main (void) -{ - json_ctx_t json_ctx; - - test_init (); - - json_init (&json_ctx, 0, stdout); - - json_document_begin (&json_ctx); - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); - - json_attr_object_begin (&json_ctx, "functions"); - json_attr_object_begin (&json_ctx, "memmove"); - json_attr_string (&json_ctx, "bench-variant", "walk"); - - json_array_begin (&json_ctx, "ifuncs"); - FOR_EACH_IMPL (impl, 0) - json_element_string (&json_ctx, impl->name); - json_array_end (&json_ctx); - - json_array_begin (&json_ctx, "results"); - /* Non-overlapping buffers. */ - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) - { - do_test (&json_ctx, i, NO_OVERLAP, 1); - do_test (&json_ctx, i + 1, NO_OVERLAP, 1); - } - - /* Partially-overlapping buffers. */ - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE / 2; i <<= 1) - { - do_test (&json_ctx, i, PARTIAL_OVERLAP, 1); - do_test (&json_ctx, i + 1, PARTIAL_OVERLAP, 1); - } - - /* Complete-overlapping buffers. */ - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) - { - do_test (&json_ctx, i, COMPLETE_OVERLAP, 0); - do_test (&json_ctx, i + 1, COMPLETE_OVERLAP, 0); - } - - json_array_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_document_end (&json_ctx); - - return ret; -} - -#include diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c deleted file mode 100644 index d838b8421730a7b9b916b05f6c01529170b69a8b..0000000000000000000000000000000000000000 --- a/benchtests/bench-memset-walk.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Measure memset function throughput with large data sizes. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define TEST_MAIN -#define TEST_NAME "memset" -#define START_SIZE 128 -#define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) -#define TIMEOUT (20 * 60) -#include "bench-string.h" - -#include "json-lib.h" - -void *generic_memset (void *, int, size_t); -typedef void *(*proto_t) (void *, int, size_t); - -IMPL (MEMSET, 1) -IMPL (generic_memset, 0) - -static void -do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, CHAR *s_end, - int c __attribute ((unused)), size_t n) -{ - size_t i, iters = MIN_PAGE_SIZE / n; - timing_t start, stop, cur; - - TIMING_NOW (start); - for (i = 0; i < iters && s <= s_end; s_end -= n, i++) - CALL (impl, s, c, n); - TIMING_NOW (stop); - - TIMING_DIFF (cur, start, stop); - - /* Get time taken per function call. */ - json_element_double (json_ctx, (double) cur / i); -} - -static void -do_test (json_ctx_t *json_ctx, int c, size_t len) -{ - json_element_object_begin (json_ctx); - json_attr_uint (json_ctx, "length", len); - json_attr_uint (json_ctx, "char", c); - json_array_begin (json_ctx, "timings"); - - FOR_EACH_IMPL (impl, 0) - { - do_one_test (json_ctx, impl, (CHAR *) buf1, - (CHAR *) buf1 + MIN_PAGE_SIZE - len, c, len); - alloc_bufs (); - } - - json_array_end (json_ctx); - json_element_object_end (json_ctx); -} - -int -test_main (void) -{ - json_ctx_t json_ctx; - size_t i; - - test_init (); - - json_init (&json_ctx, 0, stdout); - - json_document_begin (&json_ctx); - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); - - json_attr_object_begin (&json_ctx, "functions"); - json_attr_object_begin (&json_ctx, TEST_NAME); - json_attr_string (&json_ctx, "bench-variant", "walk"); - - json_array_begin (&json_ctx, "ifuncs"); - FOR_EACH_IMPL (impl, 0) - json_element_string (&json_ctx, impl->name); - json_array_end (&json_ctx); - - json_array_begin (&json_ctx, "results"); - for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) - { - do_test (&json_ctx, 65, i); - do_test (&json_ctx, 65, i + 1); - } - - for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) - { - do_test (&json_ctx, 0, i); - do_test (&json_ctx, 0, i + 1); - } - - json_array_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_attr_object_end (&json_ctx); - json_document_end (&json_ctx); - - return ret; -} - -#include - -#define libc_hidden_builtin_def(X) -#define libc_hidden_def(X) -#define libc_hidden_weak(X) -#define weak_alias(X,Y) -#undef MEMSET -#define MEMSET generic_memset -#include diff --git a/benchtests/bench-memset-zero-walk.c b/benchtests/bench-memset-zero-walk.c deleted file mode 100644 index 53d7d712b9976cc8da437bbe0c21cc2d266595a7..0000000000000000000000000000000000000000 --- a/benchtests/bench-memset-zero-walk.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Measure memset functions for zeroing throughput with large data sizes. - Copyright (C) 2022-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define DO_MEMSET 1 -#include "bench-bzero-walk.c"