From: Nathan Bossart <nathandbossart@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com>
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: Tue, 1 Apr 2025 11:25:23 -0500
Message-ID: <Z-wTcyia0z7i2Qnb@nathan> (raw)
In-Reply-To: <CANWCAZZ_+65KW3qUks2y15142zLYLfx0JK-wWWCJziDkR971Eg@mail.gmail.com>
References: <CANWCAZabmia25iu8Z_qRhLKoOV1VxhcSMkJuzDomQrA2RWdTUA@mail.gmail.com>
<Z89d-eRP9Tpd5Mq1@nathan>
<CANWCAZa+dtOQ50V6s85jR-B53P8MsMcGiZ9WGLAGEGiE_TtyGQ@mail.gmail.com>
<PH8PR11MB8286C653FD6629E0862FA07FFBD12@PH8PR11MB8286.namprd11.prod.outlook.com>
<CANWCAZZM=GZesOZARs1hPPFuu9p9UNOtnyn0=4KQzups9Mek4w@mail.gmail.com>
<PH8PR11MB828644925A421E20A2845B23FBD32@PH8PR11MB8286.namprd11.prod.outlook.com>
<CANWCAZYEdQJ23UpdfjJqD8S2cecqirQCi3dw1o5PWUz+XYD7fA@mail.gmail.com>
<CANWCAZYV1+zBG1PT_oLgE=uJLbHHC8YWxrA4JOq+Kv5BfFMuGw@mail.gmail.com>
<PH8PR11MB8286A559BF96E8A7068DB56FFBA62@PH8PR11MB8286.namprd11.prod.outlook.com>
<CANWCAZZ_+65KW3qUks2y15142zLYLfx0JK-wWWCJziDkR971Eg@mail.gmail.com>
On Tue, Apr 01, 2025 at 05:33:02PM +0700, John Naylor wrote:
> On Thu, Mar 27, 2025 at 2:55 AM Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com> wrote:
>> (1) zmm_regs_available() in pg_crc32c_sse42_choose.c is a duplicate of
>> pg_popcount_avx512.c but perhaps that’s fine for now. I will propose a
>> consolidated SIMD runtime check in a follow up patch.
>
> Yeah, I was thinking a small amount of duplication is tolerable.
+1. This is easy enough to change in the future if/when we add some sort
of centralized CPU feature detection.
>> (2) Might be apt to rename pg_crc32c_sse42*.c to pg_crc32c_x86*.c since
>> they contain both sse42 and avx512 versions.
>
> The name is now not quite accurate, but it's not exactly misleading
> either. I'm leaning towards keeping it the same, so for now I've just
> updated the header comment.
I'm not too worried about this one either. FWIW I'm likely going to look
into moving all the x86_64 popcount stuff into pg_popcount_avx512.c and
renaming it to pg_popcount_x86_64.c for v19. This would parallel
pg_popcount_aarch64.c a bit better, and a file per architecture seems like
a logical way to neatly organize things.
> For v16, I made another pass through made some more mostly superficial
> adjustments:
> - copied rewritten Meson comment to configure.ac
> - added some more #include guards out of paranoia
> - added tests with longer lengths that exercise the new paths
> - adjusted configure / meson messages for consistency
> - changed not-quite-accurate wording about "AVX-512 CRC instructions"
> - used "PCLMUL" only when talking about specific intrinsics and prefer
> "AVX-512" elsewhere, to head off potential future confusion with Arm
> PMULL.
I read through the code a couple of times and nothing stood out to me.
--
nathan
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: nathandbossart@gmail.com, johncnaylorls@gmail.com, raghuveer.devulapalli@intel.com, akash.shankaran@intel.com
Subject: Re: Improve CRC32C performance on SSE4.2
In-Reply-To: <Z-wTcyia0z7i2Qnb@nathan>
References: <CANWCAZabmia25iu8Z_qRhLKoOV1VxhcSMkJuzDomQrA2RWdTUA@mail.gmail.com> <Z89d-eRP9Tpd5Mq1@nathan> <CANWCAZa+dtOQ50V6s85jR-B53P8MsMcGiZ9WGLAGEGiE_TtyGQ@mail.gmail.com> <PH8PR11MB8286C653FD6629E0862FA07FFBD12@PH8PR11MB8286.namprd11.prod.outlook.com> <CANWCAZZM=GZesOZARs1hPPFuu9p9UNOtnyn0=4KQzups9Mek4w@mail.gmail.com> <PH8PR11MB828644925A421E20A2845B23FBD32@PH8PR11MB8286.namprd11.prod.outlook.com> <CANWCAZYEdQJ23UpdfjJqD8S2cecqirQCi3dw1o5PWUz+XYD7fA@mail.gmail.com> <CANWCAZYV1+zBG1PT_oLgE=uJLbHHC8YWxrA4JOq+Kv5BfFMuGw@mail.gmail.com> <PH8PR11MB8286A559BF96E8A7068DB56FFBA62@PH8PR11MB8286.namprd11.prod.outlook.com> <CANWCAZZ_+65KW3qUks2y15142zLYLfx0JK-wWWCJziDkR971Eg@mail.gmail.com> <Z-wTcyia0z7i2Qnb@nathan>
* 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