Re: Proposal for enabling auto-vectorization for checksum calculations - Mailing list pgsql-hackers

From John Naylor
Subject Re: Proposal for enabling auto-vectorization for checksum calculations
Date
Msg-id CANWCAZbigzGc_Kzsqf3NB+FgfnvJCas_KovCXg3GROJTVjuS9Q@mail.gmail.com
Whole thread
In response to Re: Proposal for enabling auto-vectorization for checksum calculations  (Andrew Kim <tenistarkim@gmail.com>)
Responses Re: Proposal for enabling auto-vectorization for checksum calculations
Re: Proposal for enabling auto-vectorization for checksum calculations
List pgsql-hackers
On Mon, Mar 16, 2026 at 3:00 PM Andrew Kim <tenistarkim@gmail.com> wrote:
>
> It looks like your PostgreSQL build on Cirrus CI is failing during the
> Meson configuration phase because it cannot find the libedit
> libraries.
> Should we add these to the pacman installation command in our CI
> scripts, or is there a preferred way to handle terminal library
> dependencies for the Windows Meson builds?

I'll leave that to the people who maintain it. Sometimes intermittent
glitches happen. And please don't top-post.

I've attached v12 which is just a rebase over the new centralized
feature detection. I also have some review:

+# Check if the compiler supports AVX2 target attribute.
+# This is used for optimized checksum calculations with runtime detection.

It could possibly be used for other things, in which case this will
get out of date. It's most reliable to grep for the symbol to see
where something is used.

Also, the first statement is not true:

+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdint.h>
+    #if defined(__has_attribute) && __has_attribute (target)
+    __attribute__((target("avx2")))
+    static int avx2_test(void)
+    {
+      return 0;
+    }
+    #endif],

With these guards, I think any compiler will pass the test, and CI
does show it passes on MSVC:

[01:09:52.888] Checking if "AVX2 support" links: YES

The consequence is that two functions get built with identical
non-AVX2 contents. Then at runtime we pick one of them, but it doesn't
matter which. This needs to test what it says it's testing.

--
John Naylor
Amazon Web Services

Attachment

pgsql-hackers by date:

Previous
From: Sami Imseih
Date:
Subject: Re: Refactor query normalization into core query jumbling
Next
From: John Naylor
Date:
Subject: Re: Proposal for enabling auto-vectorization for checksum calculations