From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A236F606A31A for ; Tue, 1 Dec 2026 15:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=l0Nre+so Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 961C540430; Tue, 1 Dec 2026 16:16:49 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTPS id D775B4027A for ; Tue, 1 Dec 2026 16:16:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796138207; x=1827674207; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uUW2RxOlsD/6BfJx5lP9aIvGmtkKCbgKUYctcyQuur0=; b=l0Nre+soaWq+ASOmN6eas+SdJG0jt+Fuwn6yqyrH/1PZ66zJyoRp7t8I 9UzBvHXID2SpNLq0jCIMOKahOVJC6ZHs2GZmY8H8G8dSjh2HS7zc+dmza t/rWRIyLjeKNC8YJn3fD5WHPtJdQVXseT7SZUX1LoorYh10cd4NmmL/M+ tk8HCVSZLLkKjEnmaQAgknrOqmwtyvGYOI8uc2IFsgziTj6hHA7joRrH8 1VlRQzWlOOcrLuaZzyTnFyK/o8BYaaW90/XtTYsnR6jcMKdxnu6WkT8hG YNLFXVmDfJFrSdCu11t+QCTXpFiXJEj3esgvwkYVnb/r48rK2vyPM6ssL g==; X-CSE-ConnectionGUID: KuwFXzizTQyvkdL/yy0nXw== X-CSE-MsgGUID: xfCN1w4/R1SEwx1vGH78Tg== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5023485" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5023485" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 07:16:44 -0800 X-CSE-ConnectionGUID: H49fNugvT4apA/KiewYkvQ== X-CSE-MsgGUID: nAgFa2x8Qey9Ocf51d2ZUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13749383" Received: from silpixa00401385.ir.intel.com ([10.20.224.226]) by fmviesa001.fm.intel.com with ESMTP; 01 Dec 2026 07:16:43 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 02/11] test/thash_perf: test gfni thash when platform supports Date: Tue, 1 Dec 2026 15:16:14 +0000 Message-ID: <20261201151623.2240031-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261201151623.2240031-1-bruce.richardson@intel.com> References: <20261201151623.2240031-1-bruce.richardson@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The current thash performance tests only test the gfni thash functions when the max SIMD bitwidth is set to 512. To increase test coverage - and visibility of the perf benefits the functions provide - increase the max SIMD bitwidth automatically when the test is run on a supporting platform, and the build has gfni enabled. Signed-off-by: Bruce Richardson --- app/test/test_thash_perf.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/app/test/test_thash_perf.c b/app/test/test_thash_perf.c index 9dfd5d3c21..9d391fd296 100644 --- a/app/test/test_thash_perf.c +++ b/app/test/test_thash_perf.c @@ -7,10 +7,12 @@ #include #include +#include #include #include #include #include +#include #include "test.h" @@ -92,6 +94,10 @@ run_thash_test(unsigned int tuple_len) uint32_t len = RTE_ALIGN_CEIL(tuple_len, sizeof(uint32_t)); uint64_t tsc_diff; + /* with GFNI each length reports four results, so separate the groups */ + if (rte_thash_gfni_supported()) + printf("\n--- key len %u ---\n", len); + for (i = 0; i < BATCH_SZ; i++) { tuples[i] = rte_zmalloc(NULL, len, 0); for (j = 0; j < len / sizeof(uint32_t); j++) @@ -124,9 +130,42 @@ run_thash_test(unsigned int tuple_len) (double)(tsc_diff) / (double)(ITERATIONS * BATCH_SZ), len); } +/* + * The GFNI implementation is only used when 512-bit SIMD is permitted, which + * is not the default on x86, so opt in to it where the CPU can support it. + */ +static void +enable_gfni_simd_bitwidth(void) +{ +#ifdef RTE_THASH_GFNI_DEFINED + const uint16_t cur = rte_vect_get_max_simd_bitwidth(); + + if (cur >= RTE_VECT_SIMD_512) + return; + + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_GFNI) || + !rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512VBMI) || + !rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) || + !rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512VL)) + return; + + const int ret = rte_vect_set_max_simd_bitwidth(RTE_VECT_SIMD_512); + if (ret != 0) { + printf("WARNING: CPU supports GFNI, but max SIMD bitwidth is pinned at %u, so GFNI is not benchmarked\n", + cur); + return; + } + + printf("WARNING: CPU supports GFNI, raising max SIMD bitwidth from %u to %u to benchmark it\n", + cur, RTE_VECT_SIMD_512); +#endif +} + static int test_thash_perf(void) { + enable_gfni_simd_bitwidth(); + run_thash_test(IPV4_2_TUPLE_LEN); run_thash_test(IPV4_4_TUPLE_LEN); run_thash_test(IPV6_2_TUPLE_LEN); -- 2.55.0