Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vJs4v-006CHI-0o for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Nov 2025 11:34:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vJs4r-005y9V-2G for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Nov 2025 11:34:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vJs4r-005y9N-1G for pgsql-hackers@lists.postgresql.org; Fri, 14 Nov 2025 11:34:53 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vJs4o-007hyU-2p for pgsql-hackers@lists.postgresql.org; Fri, 14 Nov 2025 11:34:52 +0000 Received: by mail-qt1-x843.google.com with SMTP id d75a77b69052e-4ed59386345so7455761cf.3 for ; Fri, 14 Nov 2025 03:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763120089; x=1763724889; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VdMaQpcDRStVgMWdEyWtU0edkluSlQKb1fqL4xZHxXA=; b=ajMiRaW+gOAYr83rcWhDFYdXNh1IDKLPeUQVtj8QZllytrZkpfYU2+Pu5VRgkQVWRO AVG5TXl0l6KXjvvEr2HH3HJm3/WMbnGySGIc4fkl2Euoz6ytxXAgSsHZCgdg+mpdOpwP TSF9D/kvcTng1a8bF5+xKHveNx/ksnBu/2U+CE84muDHIBao8Jfhoa8VJBzB1K6/seYv 3n/KbFGCIR4dEjkEy3Wf3izyavtbhf0YSrYgZ3u98VgcGunp1/Z5heFJ6NTCgFXqGst6 LYbpRT76BhQE6RA7forhS0xdlx2ogrtiNOJe1i4SuM2pAKw8oMtjqBRpyF2BVGR3/vB1 m+Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763120089; x=1763724889; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VdMaQpcDRStVgMWdEyWtU0edkluSlQKb1fqL4xZHxXA=; b=eVXCo9J6nGb8g0tSM6so6Rpt1tI0q4rsSTPg1TeGduqBuub8VNhimHrKW7PvjqcGai 9EUZa83p9VC7ppS7qkts9cBpHPVRYjmtrJtHULUKgJzYKhFIAZP7E73m91RHyq+dM2kt z9li9iJ1TPMdwpYk9mPSU5Dj2LpFp1+hu/ORMAhmgFM65VUmzvmyfYues2b3FIi/GN0s Le3SD+wPZ66QRMdMZlL4S4G9UJXujnn0rg3RWpEssRGGrmBzzivnPQ+gvify3CisviUR /3bD6QX+e7j+sUvn041FSC+7GxQev5tcjE2Hp4Ap0W3VZ3+iDJTYkZC/aJPj4JwDEN9l QOfQ== X-Gm-Message-State: AOJu0YyA80hxqZLo7sJpPT3LHwhJUzmF6m0g1NgcWxRVZv1DOkEBviCz sUvu2EUdqPe4bOJa8sl+paq/O+gHiEGnBsIkNbPMn58cEsZ3InqnQ76O//kfOppAsaCCzS6DS4z 5n7LXXTIGt+Qr8m2eelrFhM2qxErKfEo= X-Gm-Gg: ASbGncv3YGmS25gzLZ0+zs8n92Cd4hbrtW3/SLk8QU/RyHP8T2evDQn7SE57gqTVMH2 IXZHnRBSakUXetg1zb6tAAWTnqq2AHaxQ0ruBMJ2q1ICjlsdYmmHHoZ7FJ6P0ZpOx2BO92ELK9B 9Orlu6a20RCyxyzlvnrMtJnpNFe1N/sg+sfvibY+df8EyFwX/SDOHcppYXVONrdOa0K6brT9f8c 3+rR/N655Dv7bfrWNlJkxHCJ13Ca9hkz+vB+qIMrzOGY2qnQtYbueN67UXN/7CEBxQfsUV+/i2F OmrB1QYYL4UiYLqSjOd6B0AFpgadEOali8RVyt+um5l30g== X-Google-Smtp-Source: AGHT+IEWKAuVXuJWnYkf5vzwFVsniDI7jrkSwDzYxgNp7N9U07qn/O2fo6DNX/8E4I2G80g2Vt2Vjswmvn53AhAYl3g= X-Received: by 2002:a05:622a:5d4:b0:4ed:70b0:8423 with SMTP id d75a77b69052e-4edf206388fmr40093611cf.19.1763120088894; Fri, 14 Nov 2025 03:34:48 -0800 (PST) MIME-Version: 1.0 References: <20250911054220.3784-1-root@ip-172-31-36-228.ec2.internal> In-Reply-To: From: John Naylor Date: Fri, 14 Nov 2025 18:34:37 +0700 X-Gm-Features: AWmQ_bm1EctmquueOIU3ch0npmQx4nOCXWg4Wucl9LYocCkzORhc9HgJdeV--wU Message-ID: Subject: Re: Proposal for enabling auto-vectorization for checksum calculations To: Andrew Kim Cc: pgsql-hackers@lists.postgresql.org, Oleg Tselebrovskiy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Nov 6, 2025 at 6:50=E2=80=AFAM Andrew Kim w= rote: > The v9 patch series is attached. Thanks! BTW, I've set the commitfest entry to "Needs Review". I spent some time with the v9-0001 refactoring patch, and I have one observation that's worth sharing now: --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -29,8 +29,7 @@ #include "getopt_long.h" #include "pg_getopt.h" #include "storage/bufpage.h" -#include "storage/checksum.h" -#include "storage/checksum_impl.h" +#include "port/checksum.h" Outside the backend it is no longer required to include the implementation header -- it just links and works correctly. That seems like a good thing. In fact... On Tue, Oct 21, 2025 I wrote: > Looking at commit f04216341dd1, we have at least one example of an > external program, pg_filedump. If we can keep this working with > minimal fuss, it should be fine everywhere. > https://github.com/df7cb/pg_filedump/blob/master/pg_filedump.c#L29 > > ``` > /* checksum_impl.h uses Assert, which doesn't work outside the server */ > #undef Assert > #define Assert(X) > > #include "storage/checksum.h" > #include "storage/checksum_impl.h" > ``` I tried building pg_filedump against the server with just the 0001 patch and it also builds fine leaving out the implementation: diff --git a/pg_filedump.c b/pg_filedump.c index 606a85b..0268381 100644 --- a/pg_filedump.c +++ b/pg_filedump.c @@ -26,12 +26,7 @@ #include -/* checksum_impl.h uses Assert, which doesn't work outside the server = */ -#undef Assert -#define Assert(X) - -#include "storage/checksum.h" -#include "storage/checksum_impl.h" +#include "port/checksum.h" #include "decode.h" #include I verified that it does in fact break when built against our master branch without the impl.h header. Further, if I replace the above CRC #include to point instead to our hardware-specific API in port/pg_crc32c.h, it builds fine after adjusting the typedef that it expects, and interprets the control file normally: ********************************************* CRC: Correct pg_control Version: 1800 Catalog Version: 202511051 ... I'll think more about this. -- John Naylor Amazon Web Services