Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uTj7G-008xox-If for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jun 2025 15:29:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uTj7E-004EXp-ME for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jun 2025 15:29:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uTj7E-004EV2-9p for pgsql-hackers@lists.postgresql.org; Mon, 23 Jun 2025 15:29:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uTj7C-003f48-2t for pgsql-hackers@lists.postgresql.org; Mon, 23 Jun 2025 15:29:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 55NFTWfN3366259; Mon, 23 Jun 2025 11:29:32 -0400 From: Tom Lane To: Nathan Bossart cc: John Naylor , Andy Fan , "Devulapalli, Raghuveer" , Jesper Pedersen , Tomas Vondra , "pgsql-hackers@lists.postgresql.org" , "Shankaran, Akash" Subject: Re: Improve CRC32C performance on SSE4.2 In-reply-to: References: <87bjqncl24.fsf@163.com> <3350336.1750690281@sss.pgh.pa.us> <3353158.1750691445@sss.pgh.pa.us> Comments: In-reply-to Nathan Bossart message dated "Mon, 23 Jun 2025 10:15:26 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <3366233.1750692556.0@sss.pgh.pa.us> Date: Mon, 23 Jun 2025 11:29:32 -0400 Message-ID: <3366258.1750692572@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3366233.1750692556.1@sss.pgh.pa.us> Nathan Bossart writes: > On Mon, Jun 23, 2025 at 11:10:45AM -0400, Tom Lane wrote: >> I was imagining just including _mm512_zextsi128_si512() in the >> code being tested during configure, so that we fall back to >> the non-AVX-512 code if the compiler is too old to have it. >> I don't really feel a need to work harder than that. > Sorry, my note wasn't clear. Right now, the configure test uses > _mm512_castsi512_si128(), so we can't just do a simple s/cast/zext. We'll > need to make a slightly bigger modification to the test to make sure the > zext intrinsics are understood. I agree that we needn't work any harder > than that. The code still uses _mm512_castsi512_si128, so I think removing it from the configure snippet might not be bright. I adapted what's there now to get the attached, which builds successfully on my old compiler. I still need to check it on a newer compiler. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="test-for-new-AVX-intrinsic-too.patch"; charset="us-ascii" Content-ID: <3366233.1750692556.2@sss.pgh.pa.us> Content-Description: test-for-new-AVX-intrinsic-too.patch Content-Transfer-Encoding: quoted-printable diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 5f3e1d1faf9..da40bd6a647 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -602,6 +602,7 @@ AC_CACHE_CHECK([for _mm512_clmulepi64_epi128], [Ac_cac= hevar], { __m128i z; = + x =3D _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0))= , x); y =3D _mm512_clmulepi64_epi128(x, y, 0); z =3D _mm_ternarylogic_epi64( _mm512_castsi512_si128(y), diff --git a/configure b/configure index 4f15347cc95..3d3d3db97a4 100755 --- a/configure +++ b/configure @@ -18227,6 +18227,7 @@ else { __m128i z; = + x =3D _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0))= , x); y =3D _mm512_clmulepi64_epi128(x, y, 0); z =3D _mm_ternarylogic_epi64( _mm512_castsi512_si128(y), diff --git a/meson.build b/meson.build index 474763ad19f..6ffe7b47275 100644 --- a/meson.build +++ b/meson.build @@ -2465,6 +2465,7 @@ int main(void) { __m128i z; = + x =3D _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), = x); y =3D _mm512_clmulepi64_epi128(x, y, 0); z =3D _mm_ternarylogic_epi64( _mm512_castsi512_si128(y), ------- =_aaaaaaaaaa0--