Re: autovectorize page checksum code included elsewhere

From: Ants Aasma <ants(at)cybertec(dot)at>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: autovectorize page checksum code included elsewhere
Date: 2023-11-22 12:54:13
Message-ID: CANwKhkPw2=p97pYdo3oKgtp6q1N7O+HaOMtVwho_k6msYw+S2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 22 Nov 2023 at 11:44, John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
>
> On Tue, Nov 7, 2023 at 9:47 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> >
> > Presently, we ask compilers to autovectorize checksum.c and numeric.c. The
> > page checksum code actually lives in checksum_impl.h, and checksum.c just
> > includes it. But checksum_impl.h is also used in pg_upgrade/file.c and
> > pg_checksums.c, and since we don't ask compilers to autovectorize those
> > files, the page checksum code may remain un-vectorized.
>
> Poking in those files a bit, I also see references to building with
> SSE 4.1. Maybe that's an avenue that we should pursue? (an indirect
> function call is surely worth it for page-sized data)

For reference, executing the page checksum 10M times on a AMD 3900X CPU:

clang-14 -O2 4.292s (17.8 GiB/s)
clang-14 -O2 -msse4.1 2.859s (26.7 GiB/s)
clang-14 -O2 -msse4.1 -mavx2 1.378s (55.4 GiB/s)

--
Ants Aasma
Senior Database Engineer
www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2023-11-22 13:00:00 Re: WaitEventSet resource leakage
Previous Message Alvaro Herrera 2023-11-22 12:47:21 Re: pipe_read_line for reading arbitrary strings