From patchwork Thu Aug 5 07:49:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Tamura X-Patchwork-Id: 44576 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22F183988405 for ; Thu, 5 Aug 2021 07:50:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22F183988405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628149832; bh=BLjG1qEcOasJuKh4rGGCYjO6zgSq7qgzcbqp+FOt8Ik=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iVX1Sy8ElapI8GnboEb7YAnZHQigebDP+PcPojCD9H9SsWBGIFhehipbfa4Zp1a2D 3CvvUkB2T61mpMg45SCToA0/t2IpjPamqyWhpZvv5pehTg3BJyR4R90ilCTqRJ1fKW 5IFYaojOywzuGC+pn0Z3tNsWqMtdYWH41kvvQflA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) by sourceware.org (Postfix) with ESMTPS id 23E64386481A for ; Thu, 5 Aug 2021 07:50:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 23E64386481A IronPort-SDR: 71IxUUc1ITMHaGIF4KbMAdTsAQQMs+/jHstjcXaacxDW1tBn26irCh8xWIc6cQE1Kd6UkdQVc1 OnXo5FOyYJZu15NZis05DrTrYbqiuH7fB6SxsMfWDhkRNAV3a7yDS5f7u7dhDO1CAu4Fmq2dkz Akd3zlhLeEYInLFE1DiDPSuv9o2KRa9ejKjMztI1FBOaI1nDc4lT81Q+A1tIelRl/NI7MVibWh SEWo42a6UgD9m+WVDVarvte0U+XeJlrNtUPvKEG3e+M8ffKSIHoDMi51q4rntAzaL9UJxwbH55 hNNf0q/LA7eu9R30R3ooAv8j X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="19069113" X-IronPort-AV: E=Sophos;i="5.84,296,1620658800"; d="scan'208";a="19069113" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP; 05 Aug 2021 16:50:09 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 770D21CFC6F for ; Thu, 5 Aug 2021 16:50:08 +0900 (JST) Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id A3932215CF8 for ; Thu, 5 Aug 2021 16:50:07 +0900 (JST) Received: from bionic.lxd (unknown [10.126.53.116]) by m3051.s.css.fujitsu.com (Postfix) with ESMTP id 8BB86A1; Thu, 5 Aug 2021 16:50:07 +0900 (JST) To: libc-alpha@sourceware.org Subject: [PATCH v3 1/5] benchtests: Enable scripts/plot_strings.py to read stdin Date: Thu, 5 Aug 2021 07:49:53 +0000 Message-Id: <20210805074953.433483-1-naohirot@fujitsu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210805074733.433430-1-naohirot@fujitsu.com> References: <20210805074733.433430-1-naohirot@fujitsu.com> X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Naohiro Tamura via Libc-alpha From: Naohiro Tamura Reply-To: Naohiro Tamura Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This patch enables scripts/plot_strings.py to read a benchmark result file from stdin. To keep backward compatibility, that is to keep accepting multiple of benchmark result files in argument, blank argument doesn't mean stdin, but '-' does. Therefore nargs parameter of ArgumentParser.add_argument() method is not changed to '?', but keep '+'. ex: $ jq '.' bench-memset.out | plot_strings.py - $ jq '.' bench-memset.out | plot_strings.py - bench-memset-large.out $ plot_strings.py bench-memset.out bench-memset-large.out error ex: $ jq '.' bench-memset.out | plot_strings.py Reviewed-by: Siddhesh Poyarekar --- benchtests/scripts/plot_strings.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/benchtests/scripts/plot_strings.py b/benchtests/scripts/plot_strings.py index c71f0804e4de..ec634692d9ad 100755 --- a/benchtests/scripts/plot_strings.py +++ b/benchtests/scripts/plot_strings.py @@ -31,6 +31,7 @@ import json import matplotlib as mpl import numpy as np import os +import sys try: import jsonschema as validator @@ -331,8 +332,11 @@ def main(args): for filename in args.bench: bench = None - with open(filename, "r") as f: - bench = json.load(f) + if filename == '-': + bench = json.load(sys.stdin) + else: + with open(filename, "r") as f: + bench = json.load(f) validator.validate(bench, schema) @@ -354,7 +358,8 @@ if __name__ == "__main__": # Required parameter parser.add_argument("bench", nargs="+", - help="benchmark results file(s) in json format") + help="benchmark results file(s) in json format, " \ + "and/or '-' as a benchmark result file from stdin") # Optional parameters parser.add_argument("-b", "--baseline", type=str, From patchwork Thu Aug 5 07:50:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Tamura X-Patchwork-Id: 44577 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 96B23384783C for ; Thu, 5 Aug 2021 07:51:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96B23384783C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628149887; bh=6gkbPW0UGtNBOXv+RD/MqsbtVEIujyXgevCCZ72synI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rgzKpSqnUFUB+MzfSnWkfA58NwwLRiPDbd06X/l2iKbMvL7FMQqVFX1fPZsG2oKpD 02+wC4xxgwxGvekTUe9S/fZ1tWJsRqhJQZcx8GvLL2enbRGX3+9krCgE+MgGbE8XvJ Vk9hqnL1+JunZl4HmGjrZLaPKfZwCyBDoODN2g6w= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) by sourceware.org (Postfix) with ESMTPS id 9BC0B384B823 for ; Thu, 5 Aug 2021 07:51:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BC0B384B823 IronPort-SDR: OGZfymtzw8qyjDPh7SBwhC42jWymM09YxEekMkcVS172w/6QoQcl2X/XxiQCcm/Yk4DibblKCT x7k9rrGBg+77fOA9yjT+75LC8jlwKx9Aw1dSDdSy45p7yi91uPzMul4ePoLo45KP5Qav7LghBT Ro0KkYjLM6vSH/wAo0P19peoPpAuK4syLIO8U1AcW3uMTNhfClX6CG9flWtVMdTWFkK9ZlA1Uf w0TECJREeK9nLAtebdaM0v5ZoODiJdIkLez0My0wl9SKGrmzsKv+pdYJsZu8icndVr3qywHnL+ BqHZ33zX2T6ULWo7rCZHutum X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="39163996" X-IronPort-AV: E=Sophos;i="5.84,296,1620658800"; d="scan'208";a="39163996" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP; 05 Aug 2021 16:51:03 +0900 Received: from yto-m4.gw.nic.fujitsu.com (yto-nat-yto-m4.gw.nic.fujitsu.com [192.168.83.67]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 9F624EB380 for ; Thu, 5 Aug 2021 16:51:02 +0900 (JST) Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by yto-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id D63A43015B for ; Thu, 5 Aug 2021 16:51:01 +0900 (JST) Received: from bionic.lxd (unknown [10.126.53.116]) by m3051.s.css.fujitsu.com (Postfix) with ESMTP id CFCF7A1; Thu, 5 Aug 2021 16:51:01 +0900 (JST) To: "Lucas A. M. Magalhaes" , Wilco Dijkstra , Noah Goldstein , libc-alpha@sourceware.org Subject: [PATCH v3 2/5] benchtests: Add memset zero fill benchtest Date: Thu, 5 Aug 2021 07:50:53 +0000 Message-Id: <20210805075053.433538-1-naohirot@fujitsu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210805074733.433430-1-naohirot@fujitsu.com> References: <20210805074733.433430-1-naohirot@fujitsu.com> X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Naohiro Tamura via Libc-alpha From: Naohiro Tamura Reply-To: Naohiro Tamura Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Memset takes 0 as the second parameter in most cases. However, we cannot measure the zero fill performance by bench-memset.c, bench-memset-large.c and bench-memset-walk.c precisely. X86_64 micro-architecture has some zero-over-zero optimization, and AArch64 micro-architecture also has some optimization for DC ZVA instruction. This patch provides bench-memset-zerofill.c which is suitable to analyze the zero fill performance by comparing among 4 patterns, zero-over-zero, zero-over-one, one-over-zero and one-over-one, from 256B to 64MB(RAM) through L1, L2 and L3 caches. The following commands are examples to analyze a JSON output, bench-memset-zerofill.out, by 'jq' and 'plot_strings.py'. 1) compare zero-over-zero performance $ cat bench-memset-zerofill.out | \ jq -r ' .functions.memset."bench-variant"="zerofill-0o0" | del(.functions.memset.results[] | select(.char1 != 0 or .char2 != 0)) ' | \ plot_strings.py -l -p thru -v - 2) compare zero paformance $ cat bench-memset-zerofill.out | \ jq -r ' .functions.memset."bench-variant"="zerofill-zero" | del(.functions.memset.results[] | select(.char2 != 0)) ' | \ plot_strings.py -l -p thru -v - 3) compare nonzero paformance $ cat bench-memset-zerofill.out | \ jq -r ' .functions.memset."bench-variant"="zerofill-nonzero" | del(.functions.memset.results[] | select(.char2 == 0)) ' | \ plot_strings.py -l -p thru -v - --- benchtests/Makefile | 2 +- benchtests/bench-memset-zerofill.c | 134 +++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 benchtests/bench-memset-zerofill.c diff --git a/benchtests/Makefile b/benchtests/Makefile index 1530939a8ce8..21b95c736190 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -53,7 +53,7 @@ string-benchset := memccpy memchr memcmp memcpy memmem memmove \ strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \ strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok \ strcoll memcpy-large memcpy-random memmove-large memset-large \ - memcpy-walk memset-walk memmove-walk + memcpy-walk memset-walk memmove-walk memset-zerofill # Build and run locale-dependent benchmarks only if we're building natively. ifeq (no,$(cross-compiling)) diff --git a/benchtests/bench-memset-zerofill.c b/benchtests/bench-memset-zerofill.c new file mode 100644 index 000000000000..7aa7fe048574 --- /dev/null +++ b/benchtests/bench-memset-zerofill.c @@ -0,0 +1,134 @@ +/* Measure memset functions with zero fill data. + Copyright (C) 2021 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 256 +#define MIN_PAGE_SIZE (getpagesize () + 64 * 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 +__attribute__((noinline, noclone)) +do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, + int c1 __attribute ((unused)), int c2 __attribute ((unused)), + size_t n) +{ + size_t i, iters = 32; + timing_t start, stop, cur, latency = 0; + + CALL (impl, s, c2, n); // warm up + + for (i = 0; i < iters; i++) + { + memset (s, c1, n); // alternation + + TIMING_NOW (start); + + CALL (impl, s, c2, n); + + TIMING_NOW (stop); + TIMING_DIFF (cur, start, stop); + TIMING_ACCUM (latency, cur); + } + + json_element_double (json_ctx, (double) latency / (double) iters); +} + +static void +do_test (json_ctx_t *json_ctx, size_t align, int c1, int c2, size_t len) +{ + align &= getpagesize () - 1; + 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_attr_int (json_ctx, "char1", c1); + json_attr_int (json_ctx, "char2", c2); + json_array_begin (json_ctx, "timings"); + + FOR_EACH_IMPL (impl, 0) + { + do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c1, c2, 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; + int c1, c2; + + 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", "zerofill"); + + 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 (c1 = 0; c1 < 2; c1++) + for (c2 = 0; c2 < 2; c2++) + for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) + { + do_test (&json_ctx, 0, c1, c2, i); + do_test (&json_ctx, 3, c1, c2, i); + } + + 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 From patchwork Thu Aug 5 07:51:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Tamura X-Patchwork-Id: 44578 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92F2F384B823 for ; Thu, 5 Aug 2021 07:52:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92F2F384B823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628149939; bh=Z1ULZBgmPi2MP3u8XvwXcgxJWZZDhDRou5a4lB2uL8E=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RZJz4b7ZAxtfKKgb7+rbCnQT8arWgyvJI9dIWlK5Gf8TFetx9/Xb/yzM2eoIOrNkB f1prWi5Sexsls2JH6YD4fDteyyf+6jAZkunP/v3gWZW9F8QMbvtWjIwamHw4ZRHDAX nDcO8xULUP+7WEOXqvAJ907bSwr1U1RTroiE+J3A= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa8.hc1455-7.c3s2.iphmx.com (esa8.hc1455-7.c3s2.iphmx.com [139.138.61.253]) by sourceware.org (Postfix) with ESMTPS id 1203F3988432 for ; Thu, 5 Aug 2021 07:51:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1203F3988432 IronPort-SDR: i59wUk5pJG+gWpc1ZpbbZGSkBBlVKL0hTRAbFqhqSupJczgMOERPDCfNkJwbvcKnUXfl+GFIwu lpkUrQNw6gTAjF8nV6cITb3StZRUYRHsAq9cLHIek+xuQ4chMFAkDZUGiIKC4TkXO8xCCdK9vK baVglJlcCfFsOfqVlee29FVlvzrjwj6v38rSg9CQVo0HezuYVwKF7EgEKafWZ23OKsS4Qt42Mw Qi7HzZ1uajR47q3fhWUiC4ScUtf+NCVv0AZRlDn9n/LjbQyTwG3c1M75oiytBN/gcn8dOobtmM 4iSEeUVMh2BZpCEWh2QCDvEE X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="27058410" X-IronPort-AV: E=Sophos;i="5.84,296,1620658800"; d="scan'208";a="27058410" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP; 05 Aug 2021 16:51:27 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 2E577EB382 for ; Thu, 5 Aug 2021 16:51:27 +0900 (JST) Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 77E18E6742 for ; Thu, 5 Aug 2021 16:51:26 +0900 (JST) Received: from bionic.lxd (unknown [10.126.53.116]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id 6915AAB; Thu, 5 Aug 2021 16:51:26 +0900 (JST) To: "Lucas A. M. Magalhaes" , libc-alpha@sourceware.org Subject: [PATCH v3 3/5] benchtests: Remove redundant assert.h Date: Thu, 5 Aug 2021 07:51:20 +0000 Message-Id: <20210805075120.433591-1-naohirot@fujitsu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210805074733.433430-1-naohirot@fujitsu.com> References: <20210805074733.433430-1-naohirot@fujitsu.com> X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Naohiro Tamura via Libc-alpha From: Naohiro Tamura Reply-To: Naohiro Tamura Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This patch removed redundant "#include " from bench-memset-large.c and bench-memset-walk.c. Reviewed-by: Siddhesh Poyarekar --- benchtests/bench-memset-large.c | 1 - benchtests/bench-memset-walk.c | 1 - 2 files changed, 2 deletions(-) diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c index 97ed78d0d6a1..3fd20b79e53d 100644 --- a/benchtests/bench-memset-large.c +++ b/benchtests/bench-memset-large.c @@ -23,7 +23,6 @@ #define TIMEOUT (20 * 60) #include "bench-string.h" -#include #include "json-lib.h" void *generic_memset (void *, int, size_t); diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c index 0dcad09c484f..5fb315384992 100644 --- a/benchtests/bench-memset-walk.c +++ b/benchtests/bench-memset-walk.c @@ -23,7 +23,6 @@ #define TIMEOUT (20 * 60) #include "bench-string.h" -#include #include "json-lib.h" void *generic_memset (void *, int, size_t); From patchwork Thu Aug 5 07:51:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Tamura X-Patchwork-Id: 44579 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87DBB3857C65 for ; Thu, 5 Aug 2021 07:53:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87DBB3857C65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628149984; bh=vtnme6zsFx6MVE7z98T+KbfjrtZ0HVb6rW4DiikKyhs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=v4D/zNG6nl4dOh/qzUilNglwfGBsiL6DRAItG1Db3QYakAi5mOGFmv5S4GAnBIV/d q59+u1EHSGXp3gK29yrmRY6Buwbz7KBpIGoVfzBAek5TN4Fqfn/pb/Yx0/rlGjQt9/ 2qZLKVyLAGjUtNdD97AIipzEE3VC36R4U261UcYo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa2.hc1455-7.c3s2.iphmx.com (esa2.hc1455-7.c3s2.iphmx.com [207.54.90.48]) by sourceware.org (Postfix) with ESMTPS id BF9CF3988403 for ; Thu, 5 Aug 2021 07:51:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF9CF3988403 IronPort-SDR: b8J++oZwoSEgyF1kw8RjcNyPPlzoN6cq7pGkXtMYxqUa1SHG1cEfmmC3wVrrRTQKmPiDI7MnL9 KeMnP/MNktSdgxGU1a8mw/QhTmDOXFEfOkpp3ZOB0rBt+BcqMHsG50xg+qEBC5YJQMErvFozHG czl1kbsY2SHBCOfFHUPRYldiU5305+oLBjm4SMUCGQm6e+DqK4l5evjRM3ZSMx4Sf8yATrLgCT sh/UF/WIrSgTJisPHq49ytT5a0tFn4wsDvngOCqGrsinb5piw4T+mYcze0fBzTkkW9VyZqQMYL sMRki08qXFM/IPQK2EPNiCIu X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="39081497" X-IronPort-AV: E=Sophos;i="5.84,296,1620658800"; d="scan'208";a="39081497" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa2.hc1455-7.c3s2.iphmx.com with ESMTP; 05 Aug 2021 16:51:53 +0900 Received: from oym-m1.gw.nic.fujitsu.com (oym-nat-oym-m1.gw.nic.fujitsu.com [192.168.87.58]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 4D66A1CFC6F for ; Thu, 5 Aug 2021 16:51:52 +0900 (JST) Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by oym-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 7DCA3E6BA0 for ; Thu, 5 Aug 2021 16:51:51 +0900 (JST) Received: from bionic.lxd (unknown [10.126.53.116]) by m3051.s.css.fujitsu.com (Postfix) with ESMTP id 667D1A1; Thu, 5 Aug 2021 16:51:51 +0900 (JST) To: libc-alpha@sourceware.org Subject: [PATCH v3 4/5] benchtests: Fix validate_benchout.py exceptions Date: Thu, 5 Aug 2021 07:51:44 +0000 Message-Id: <20210805075144.433644-1-naohirot@fujitsu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210805074733.433430-1-naohirot@fujitsu.com> References: <20210805074733.433430-1-naohirot@fujitsu.com> X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Naohiro Tamura via Libc-alpha From: Naohiro Tamura Reply-To: Naohiro Tamura Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This patch fixed validate_benchout.py two exceptions, AttributeError if benchout_strings.schema.json is specified and json.decoder.JSONDecodeError if benchout is not JSON. --- benchtests/scripts/import_bench.py | 5 ++++- benchtests/scripts/validate_benchout.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/benchtests/scripts/import_bench.py b/benchtests/scripts/import_bench.py index a799b4e1b7dc..e3337ca5d638 100644 --- a/benchtests/scripts/import_bench.py +++ b/benchtests/scripts/import_bench.py @@ -104,7 +104,10 @@ def do_for_all_timings(bench, callback): """ for func in bench['functions'].keys(): for k in bench['functions'][func].keys(): - if 'timings' not in bench['functions'][func][k].keys(): + try: + if 'timings' not in bench['functions'][func][k].keys(): + continue + except AttributeError: continue callback(bench, func, k) diff --git a/benchtests/scripts/validate_benchout.py b/benchtests/scripts/validate_benchout.py index 47df33ed0252..00d5fa0ee5eb 100755 --- a/benchtests/scripts/validate_benchout.py +++ b/benchtests/scripts/validate_benchout.py @@ -73,11 +73,15 @@ def main(args): except bench.validator.ValidationError as e: return print_and_exit("Invalid benchmark output: %s" % e.message, - os.EX_DATAERR) + os.EX_DATAERR) except bench.validator.SchemaError as e: return print_and_exit("Invalid schema: %s" % e.message, os.EX_DATAERR) + except json.decoder.JSONDecodeError as e: + return print_and_exit("Benchmark output in %s is not JSON." % args[0], + os.EX_DATAERR) + print("Benchmark output in %s is valid." % args[0]) return os.EX_OK From patchwork Thu Aug 5 07:52:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Tamura X-Patchwork-Id: 44580 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2806D384601D for ; Thu, 5 Aug 2021 07:53:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2806D384601D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628150029; bh=7Ff1HrjauEo2GuhuyAp40RQhM91HDaZcdvZEjSYwmH0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Te7VvcrNbfWe+jDzpSkHWIs0zP+tJf6Th8Prx/bAhtXuEC+xSYLKG7JZ6yzZf0K9i hBf4xOVEPc3I/ftRKjTqw7c6+BwJFDSQAjhUptfWrrkHpeng97OnMVudhVD5vQjNJq oXPNQaYoypt7EiOfI7IzaViRemiJRm+XUp9X9IVc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa6.hc1455-7.c3s2.iphmx.com (esa6.hc1455-7.c3s2.iphmx.com [68.232.139.139]) by sourceware.org (Postfix) with ESMTPS id 636EF3988425 for ; Thu, 5 Aug 2021 07:52:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 636EF3988425 IronPort-SDR: Hx55P+44V3e3QG8b1IdOXSNEpUdmSvVLvvGuL+gN6fllvGUQMrqEAi0WOfD057x2BIIyp3YImy I41iOBoax8HeDkCsEmsBnY6UKWfB8GVrUSY5Q5Rf/S99zXo9l30p1BUFrEA5ylrbti5Y0SpGN2 UNZ8igDhmq/dTW3/BNfBcQfpQ/YtC98v1Ckv9ZPaa2JOe+lLsUqY92V2+SKXxoXFcRAVAdwXBY teCZpJXhOTHeKOUto/h9/HzTMFgwsQ+Y4ZmRLAJk0SRzwGuv1sB6jF6dCxWrmNZ+9iHw4fjWf+ CPMqrzNpv/I7SnG2kb62+yyr X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="39245997" X-IronPort-AV: E=Sophos;i="5.84,296,1620658800"; d="scan'208";a="39245997" Received: from unknown (HELO oym-r4.gw.nic.fujitsu.com) ([210.162.30.92]) by esa6.hc1455-7.c3s2.iphmx.com with ESMTP; 05 Aug 2021 16:52:14 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id D0554E0AE0 for ; Thu, 5 Aug 2021 16:52:13 +0900 (JST) Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by oym-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id 08B17DA9FA for ; Thu, 5 Aug 2021 16:52:13 +0900 (JST) Received: from bionic.lxd (unknown [10.126.53.116]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id DA70CAB; Thu, 5 Aug 2021 16:52:12 +0900 (JST) To: Andreas Schwab , libc-alpha@sourceware.org Subject: [PATCH v3 5/5] config: Rename HAVE_BUILTIN_MEMSET macro Date: Thu, 5 Aug 2021 07:52:07 +0000 Message-Id: <20210805075207.433697-1-naohirot@fujitsu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210805074733.433430-1-naohirot@fujitsu.com> References: <20210805074733.433430-1-naohirot@fujitsu.com> X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Naohiro Tamura via Libc-alpha From: Naohiro Tamura Reply-To: Naohiro Tamura Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This patch renames HAVE_BUILTIN_MEMSET macro to HAVE_NON_LIB_EXPAND_BUILTIN_MEMSET. The name "HAVE_BUILTIN_MEMSET" is very confusing. This macro cannot be removed even though GCC 6.2, that is minimum requirement to compile glibc, already supports __builtin_memset[1]. It doesn't indicate whether GCC supports __builtin_memset or not. But it indicates whether GCC supports __builtin_memset which doesn't expand to a memset libcall or not. Therefor HAVE_NON_LIB_EXPAND_BUILTIN_MEMSET is more appropriate to increase code readability. [1] https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Other-Builtins.html --- config.h.in | 4 ++-- configure | 14 +++++++------- configure.ac | 10 +++++----- elf/rtld.c | 9 +++++---- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/config.h.in b/config.h.in index 8b45a3a61d77..4700dc9eba9b 100644 --- a/config.h.in +++ b/config.h.in @@ -40,8 +40,8 @@ shared between GNU libc and GNU gettext projects. */ #define HAVE_BUILTIN_EXPECT 1 -/* Define if the compiler supports __builtin_memset. */ -#undef HAVE_BUILTIN_MEMSET +/* Define if the compiler supports non lib expand __builtin_memset. */ +#undef HAVE_NON_LIB_EXPAND_BUILTIN_MEMSET /* Define if compiler accepts -ftree-loop-distribute-patterns. */ #undef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL diff --git a/configure b/configure index 9619c10991d0..224c754cf466 100755 --- a/configure +++ b/configure @@ -6263,7 +6263,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_memset" >&5 $as_echo_n "checking for __builtin_memset... " >&6; } -if ${libc_cv_gcc_builtin_memset+:} false; then : +if ${libc_cv_gcc_non_lib_expand_builtin_memset+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.c <<\EOF @@ -6279,16 +6279,16 @@ if { ac_try='${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null' $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then - libc_cv_gcc_builtin_memset=no + libc_cv_gcc_non_lib_expand_builtin_memset=no else - libc_cv_gcc_builtin_memset=yes + libc_cv_gcc_non_lib_expand_builtin_memset=yes fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_builtin_memset" >&5 -$as_echo "$libc_cv_gcc_builtin_memset" >&6; } -if test "$libc_cv_gcc_builtin_memset" = yes ; then - $as_echo "#define HAVE_BUILTIN_MEMSET 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_non_lib_expand_builtin_memset" >&5 +$as_echo "$libc_cv_gcc_non_lib_expand_builtin_memset" >&6; } +if test "$libc_cv_gcc_non_lib_expand_builtin_memset" = yes ; then + $as_echo "#define HAVE_NON_LIB_EXPAND_BUILTIN_MEMSET 1" >>confdefs.h fi diff --git a/configure.ac b/configure.ac index 34ecbba54054..451cea7683e6 100644 --- a/configure.ac +++ b/configure.ac @@ -1508,7 +1508,7 @@ if test $libc_cv_have_section_quotes = yes; then AC_DEFINE(HAVE_SECTION_QUOTES) fi -AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl +AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_non_lib_expand_builtin_memset, [dnl cat > conftest.c <<\EOF void zero (void *x) { @@ -1518,13 +1518,13 @@ EOF dnl if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]); then - libc_cv_gcc_builtin_memset=no + libc_cv_gcc_non_lib_expand_builtin_memset=no else - libc_cv_gcc_builtin_memset=yes + libc_cv_gcc_non_lib_expand_builtin_memset=yes fi rm -f conftest* ]) -if test "$libc_cv_gcc_builtin_memset" = yes ; then - AC_DEFINE(HAVE_BUILTIN_MEMSET) +if test "$libc_cv_gcc_non_lib_expand_builtin_memset" = yes ; then + AC_DEFINE(HAVE_NON_LIB_EXPAND_BUILTIN_MEMSET) fi AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl diff --git a/elf/rtld.c b/elf/rtld.c index d733359eaf80..a18494fcd38e 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -527,11 +527,12 @@ _dl_start (void *arg) /* Partly clean the `bootstrap_map' structure up. Don't use `memset' since it might not be built in or inlined and we cannot make function calls at this point. Use '__builtin_memset' if we - know it is available. We do not have to clear the memory if we - do not have to use the temporary bootstrap_map. Global variables - are initialized to zero by default. */ + know it is available and does not expand to a memset libcall. + We do not have to clear the memory if we do not have to use the + temporary bootstrap_map. Global variables are initialized to + zero by default. */ #ifndef DONT_USE_BOOTSTRAP_MAP -# ifdef HAVE_BUILTIN_MEMSET +# ifdef HAVE_NON_LIB_EXPAND_BUILTIN_MEMSET __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info)); # else for (size_t cnt = 0;