Re: Proposal for enabling auto-vectorization for checksum calculations

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: Andrew Kim <tenistarkim(at)gmail(dot)com>
Cc: Oleg Tselebrovskiy <o(dot)tselebrovskiy(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Proposal for enabling auto-vectorization for checksum calculations
Date: 2026-03-30 12:01:02
Message-ID: CANWCAZZ49dJ7XR1dY==7cHs93H7huo9f6RA_2qevFLp9eaOk4g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 17, 2026 at 9:23 AM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
> I've attached v12 which is just a rebase over the new centralized
> feature detection. I also have some review:

Andrew Kim let me know he is not available at this time, so since I
found only minor issues and we're close to feature freeze I took care
of them myself in the attached v13. I also further updated an outdated
comment to reflect that some compilers (for the archives: at least gcc
8.5 and up) can turn a multiplication by a constant into shifts and
adds (the FNV prime is pretty sparse in one-bits), so it's no longer
true that vector multiplication is required. That works on SSE2 and
powerpc, at least.

I don't remember the last time anyone did measurements, so I went
ahead and did that:

master: 945ms
32 AVX2: 335ms
64 AVX2: 220ms

The last one is just to verify an old code comment, and assertion in
this thread, that the choice of 32 accumulators left some performance
on the table. (Even if it weren't in diminishing returns territory, we
wouldn't consider raising this because that changes the computed
value, but if I'm updating comments anyway, I wanted to check as much
as convenient.)

I'll repeat building pg_filedump with this and if that goes well I
plan to push this week unless there are objections.

--
John Naylor
Amazon Web Services

Attachment Content-Type Size
v13-0001-Enable-autovectorizing-page-checksums-with-AVX2-.patch text/x-patch 13.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-03-30 12:08:45 Re: table AM option passing
Previous Message Greg Burd 2026-03-30 11:58:57 Re: clang bug affecting greenfly