pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: John Naylor <johncnaylorls@gmail.com>
Cc: Andy Fan <zhihuifan1213@163.com>
Cc: Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com>
Cc: Jesper Pedersen <jesperpedersen.db@gmail.com>
Cc: Tomas Vondra <tomas@vondra.me>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Shankaran, Akash <akash.shankaran@intel.com>
Subject: Re: Improve CRC32C performance on SSE4.2
Date: Mon, 23 Jun 2025 11:29:32 -0400
Message-ID: <3366258.1750692572@sss.pgh.pa.us> (raw)
In-Reply-To: <aFlvjuCZGdRTUOPf@nathan>
References: <CANWCAZZ+iVxz5QAadZrTCyps3Wewjy45POnqOkSi4KE_Y4YQtw@mail.gmail.com>
	<PH8PR11MB8286A89AF2B104044187E54DFB70A@PH8PR11MB8286.namprd11.prod.outlook.com>
	<aFCXO7MztuZezdpH@nathan>
	<PH8PR11MB82866B07AA6758D12F699C00FB70A@PH8PR11MB8286.namprd11.prod.outlook.com>
	<87bjqncl24.fsf@163.com>
	<CANWCAZZK0hVk-N71JsuXPOB0ALy8BBOfRjSA4Nz2Kpt2RCLU0Q@mail.gmail.com>
	<CANWCAZY01_SOeMjoz8UZrULysYhbkQMD_0YOGPfyM5vHZTw3SQ@mail.gmail.com>
	<3350336.1750690281@sss.pgh.pa.us>
	<aFltTRTPOvQYsAnD@nathan>
	<3353158.1750691445@sss.pgh.pa.us>
	<aFlvjuCZGdRTUOPf@nathan>

Nathan Bossart <nathandbossart@gmail.com> 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

Attachments:

test-for-new-AVX-intrinsic-too.patch (text/x-diff, 1.2K) download 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_cachevar], { __m128i z; + x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x); y = _mm512_clmulepi64_epi128(x, y, 0); z = _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 = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x); y = _mm512_clmulepi64_epi128(x, y, 0); z = _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 = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x); y = _mm512_clmulepi64_epi128(x, y, 0); z = _mm_ternarylogic_epi64( _mm512_castsi512_si128(y),

view thread (82+ messages)  latest in thread

Message-ID: <3366258.1750692572@sss.pgh.pa.us>
Permalink:  ../3366258.1750692572@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3366258.1750692572@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, johncnaylorls@gmail.com, zhihuifan1213@163.com, raghuveer.devulapalli@intel.com, jesperpedersen.db@gmail.com, tomas@vondra.me, akash.shankaran@intel.com
  Subject: Re: Improve CRC32C performance on SSE4.2
  In-Reply-To: <3366258.1750692572@sss.pgh.pa.us>
  References: <CANWCAZZ+iVxz5QAadZrTCyps3Wewjy45POnqOkSi4KE_Y4YQtw@mail.gmail.com> <PH8PR11MB8286A89AF2B104044187E54DFB70A@PH8PR11MB8286.namprd11.prod.outlook.com> <aFCXO7MztuZezdpH@nathan> <PH8PR11MB82866B07AA6758D12F699C00FB70A@PH8PR11MB8286.namprd11.prod.outlook.com> <87bjqncl24.fsf@163.com> <CANWCAZZK0hVk-N71JsuXPOB0ALy8BBOfRjSA4Nz2Kpt2RCLU0Q@mail.gmail.com> <CANWCAZY01_SOeMjoz8UZrULysYhbkQMD_0YOGPfyM5vHZTw3SQ@mail.gmail.com> <3350336.1750690281@sss.pgh.pa.us> <aFltTRTPOvQYsAnD@nathan> <3353158.1750691445@sss.pgh.pa.us> <aFlvjuCZGdRTUOPf@nathan> <3366258.1750692572@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox