From patchwork Tue Feb 6 17:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 770401 Delivered-To: patch@linaro.org Received: by 2002:adf:a40c:0:b0:33b:4b49:db74 with SMTP id d12csp79590wra; Tue, 6 Feb 2024 09:44:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjxNgxmMJpezo4CBEhajl+o3H7JfQWUPGW0+fWlVoaVW3rNa/LZty6a0k2W8VVzlZWzrD5 X-Received: by 2002:a05:622a:1647:b0:42b:e367:89 with SMTP id y7-20020a05622a164700b0042be3670089mr14638810qtj.18.1707241474319; Tue, 06 Feb 2024 09:44:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707241474; cv=pass; d=google.com; s=arc-20160816; b=gOD/pl78lsf52R8+l+OKpqCrzg9Bfzk3hg1kexw+QQJ1rk2TI570LtMyxdpA1K5OVL 7F6Ro185m5axYytm783ZZZzHnP8lNLQtb+S36g69HTX76WH0gxFnCX9qwe/WD1fya+5T fMNDAzOqwVssgIGxRXi6BsnY07NLW4BmFZda0MElopjfNO1zcjTMKoQjWaV8OdmoKp65 GH7ruSxsqiI5QIx6lcH+LMPy09w1XRRbzv5KZQlrVvxL0lZXzyo9VN447li2++KsXpAF 5K8mtQuCYrqwMVIjQlQE064AxIX1CKaET/3RS+bjBanrON6gShMYYTfDINQUH8eyrcmk 5P/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=3oOZZr816s5uQyedz/JUAmFcTNBOpuoMQNZAubL+RKU=; fh=Uxfe9xwOOoXnuMehuJVa71E52uGgBkisiqi9I6344eg=; b=yYDCnuD2KgDvcG8JphHawfLZxLV4iBRKwqrCLKQQvMGcWK6G699CA27qH9bSTnZcAT FxGdOdQbOUqRlNuZ8M75PHtgYJOYU4ySYZBXYgIcJByYCMF3TfS2NUd5sHp7iV07phlK tEqIb+p+b/ergztFVaO1oTomPNw/1ULdJ7HHplJECMFGPbIMJhRcSP+mmMZN5TGnf7C9 6bfNgGPzho32d0S7ROKx0f720XkeEUtFfAmYmIv63ov6w7+ZrdPcA/544Wn+mRGkm7Eb XoNfEe1M64/slbJdTrX000trQrHgSmYyln5NzgMKNGe9QA/aavNyWlYnm0bf9O27K8S/ 9J0w==; darn=linaro.org ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UGja9J2k; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCVHAoAmNVWkJ6kMdKK8fekVfrCFLJfOIm3Y63lYslEm7djan5yqyCpS9J8FWz9jShuuJaZrZ1V50nCKw8q1LJKg Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s21-20020ac85cd5000000b0042aa62cdbf7si2960245qta.444.2024.02.06.09.44.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 09:44:34 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UGja9J2k; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F141D38582A8 for ; Tue, 6 Feb 2024 17:44:33 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 2AF8F3858C53 for ; Tue, 6 Feb 2024 17:43:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2AF8F3858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2AF8F3858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::536 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707241417; cv=none; b=A47GTeQXL/ppz6vQ5QCxkTa7ZQW+lhQaStgCTnvXN4V4RjTNjSD/lOm+opuwNpXnUEAAywFeIqp6CJnNbcSJPLyRVlgoeDY3HfeaMu3NL8iUYNBTGssweHHdlecIkYaG9imtzlIkovNnOceeZUSjKjFjpEZo0rH2GlWpVzJ3GdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707241417; c=relaxed/simple; bh=GhNpOfF+xAXLWq4jTg1EvkZwYefR6E416wileLgaZMw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=boMJdu2E2UHlHKDjmkrsGWdXZ9ZVtD2Q+TVj9cw2uxapJyz8BXVFAhU6vfID6kJIxULurM5Bj3Z16d/IYGO5LOHg9oxaZ4IWTvw/DbV9YB26HG7Y47Yepis8u+qPNX4mr8SBTGL/Y/Ku2ZE8qs8xCQ5t87HUV5Yszl9PzNqh9UA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5d8df34835aso723894a12.0 for ; Tue, 06 Feb 2024 09:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707241413; x=1707846213; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3oOZZr816s5uQyedz/JUAmFcTNBOpuoMQNZAubL+RKU=; b=UGja9J2kTLA2Tdp4aFgoWmrau0YvxJtES+Uo75FO06Ke90OFE2tCrfCL/WvkiL+cLo iQ9sijIHxx/t33C/SKwnirost1+fkDrhucYf8WT6SeNOZk5XQUsK3YSAUG5nwNlwKDQ6 GHFFfW1ZAZaq3ZTOV/tkLRAlcdtjvQCOqN0uawKpveRO+yWlwuB1x0YGftHLeNS/Ik3y hH9eP8cy3TNHkQNUZEljO16iV6EDR0n09fQagdgJ1oj/UcSeAbLvi2PYb19VM51fGKQV m9q8F781/i+QsXA078GMq8Oy1MZT67txcFAv6KMnn7TFRkCII3qqg4CytCPPT4vqRYUW 1N+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707241413; x=1707846213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3oOZZr816s5uQyedz/JUAmFcTNBOpuoMQNZAubL+RKU=; b=Amh4DSz0OMNzu2c7f8n6zaHvvXtO2ycjKE+IDnMC67jfhhEItL+OXfqGTGhPXk6P3r v0AWpiOCO5payDNwbU7yyvxnXhhmGbYlsezs7Lz9uUJGRmy9G1DAD7FeqJDiI91BQvDF nPATyCk0OPmDeD2drw3+66LRpN+VUAVoFJIb9tQuNZ7FNKn1cWTDkMHVqV+cgf0J8pKQ GLik5J2QIshteXLhf/1Ax9AsUplRWTwMv11TS61xvPWfgLT97GADmnVC724i+VczP5qb UelEB62MmGtAw4KWQwkD4s7EHKWDutt62Cg6WNB24c5CIyuian2fvXLrYeJ3nMd8RTm0 a6wQ== X-Gm-Message-State: AOJu0YwxZjmCVyyyv/1W0ICW7/vwgz76w2mrMa/EyO3EaLHyAKBXHYTV lr8Wu9L3zQz7/rHYI8xNkgrOfi+OpnlWHWWwImPzfsJnwMlqk1Qo0niqWLccLV7i3/mqh3Xnj6J m X-Received: by 2002:a05:6a20:7da4:b0:19e:9d92:b692 with SMTP id v36-20020a056a207da400b0019e9d92b692mr1245621pzj.28.1707241413455; Tue, 06 Feb 2024 09:43:33 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXfRB6BZq9AiHCqkdGc4gPtR/yeSQLUYdW7ad69MtpQUTnqKn9FkziZmI5FJrMrvipHO4optoRuRWIYfj+XQw2qjV1mWJ8pRMePlw2G2un2JpkPWw2I07pmX8zALP/og2QAD1fTLJYaewUl6b3KBPS6r4j5Ml06q/ni8YKyUztoPzm8T3R3Gy2SAg== Received: from mandiga.. ([2804:1b3:a7c0:378:b5ab:9c4b:bdc3:2870]) by smtp.gmail.com with ESMTPSA id d22-20020aa78696000000b006e04a659ed6sm2248598pfo.67.2024.02.06.09.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 09:43:32 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" , Noah Goldstein , Sajan Karumanchi , bmerry@sarao.ac.za, pmallapp@amd.com Subject: [PATCH v2 2/3] x86: Do not prefer ERMS for memset on Zen3+ Date: Tue, 6 Feb 2024 14:43:21 -0300 Message-Id: <20240206174322.2317679-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206174322.2317679-1-adhemerval.zanella@linaro.org> References: <20240206174322.2317679-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org For AMD Zen3+ architecture, the performance of the vectorized loop is slightly better than ERMS. Checked on x86_64-linux-gnu on Zen3. --- sysdeps/x86/dl-cacheinfo.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h index 74b804c5e6..f2cd6f179d 100644 --- a/sysdeps/x86/dl-cacheinfo.h +++ b/sysdeps/x86/dl-cacheinfo.h @@ -1010,11 +1010,17 @@ dl_init_cacheinfo (struct cpu_features *cpu_features) if (tunable_size > minimum_rep_movsb_threshold) rep_movsb_threshold = tunable_size; - /* NB: The default value of the x86_rep_stosb_threshold tunable is the - same as the default value of __x86_rep_stosb_threshold and the - minimum value is fixed. */ - rep_stosb_threshold = TUNABLE_GET (x86_rep_stosb_threshold, - long int, NULL); + /* For AMD Zen3+ architecture, the performance of the vectorized loop is + slightly better than ERMS. */ + if (cpu_features->basic.kind == arch_kind_amd) + rep_stosb_threshold = SIZE_MAX; + + if (TUNABLE_IS_INITIALIZED (x86_rep_stosb_threshold)) + /* NB: The default value of the x86_rep_stosb_threshold tunable is the + same as the default value of __x86_rep_stosb_threshold and the + minimum value is fixed. */ + rep_stosb_threshold = TUNABLE_GET (x86_rep_stosb_threshold, + long int, NULL); TUNABLE_SET_WITH_BOUNDS (x86_data_cache_size, data, 0, SIZE_MAX); TUNABLE_SET_WITH_BOUNDS (x86_shared_cache_size, shared, 0, SIZE_MAX);