pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Nathan Bossart <nathandbossart@gmail.com>
To: Amonson, Paul D <paul.d.amonson@intel.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Shankaran, Akash <akash.shankaran@intel.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Popcount optimization using AVX512
Date: Fri, 29 Mar 2024 11:22:11 -0500
Message-ID: <20240329162211.GB1106154@nathanxps13> (raw )
In-Reply-To: <20240329155940.GC1046039@nathanxps13 >
References: <2490633.1711379522@sss.pgh.pa.us >
<BL1PR11MB53043014C10F2D30B4231F9ADC362@BL1PR11MB5304.namprd11.prod.outlook.com >
<BL1PR11MB53049F1796E834DBE0E05864DC362@BL1PR11MB5304.namprd11.prod.outlook.com >
<20240325200551.GB2924132@nathanxps13 >
<20240327220010.GA231058@nathanxps13 >
<BL1PR11MB53047289F146DB43C9B2FC71DC342@BL1PR11MB5304.namprd11.prod.outlook.com >
<20240328213854.GA916732@nathanxps13 >
<BL1PR11MB5304E51336123CE6F041A920DC3B2@BL1PR11MB5304.namprd11.prod.outlook.com >
<BL1PR11MB5304217FFEFB15124CD2EC9EDC3B2@BL1PR11MB5304.namprd11.prod.outlook.com >
<20240329155940.GC1046039@nathanxps13 >
On Fri, Mar 29, 2024 at 10:59:40AM -0500, Nathan Bossart wrote:
> It might be nice if we conditionally built pg_popcount_avx512.o in autoconf
> builds, too, but AFAICT we still need to wrap most of that code with
> macros, so I'm not sure it's worth the trouble. I'll take another look at
> this...
If we assumed that TRY_POPCNT_FAST would be set and either
HAVE__GET_CPUID_COUNT or HAVE__CPUIDEX would be set whenever
USE_AVX512_POPCNT_WITH_RUNTIME_CHECK is set, we could probably remove the
surrounding macros and just compile pg_popcount_avx512.c conditionally
based on USE_AVX512_POPCNT_WITH_RUNTIME_CHECK. However, the surrounding
code seems to be pretty cautious about these assumptions (e.g., the CPUID
macros are checked before setting TRY_POPCNT_FAST), so this would stray
from the nearby precedent a bit.
A counterexample is the CRC32C code. AFAICT we assume the presence of
CPUID in that code (and #error otherwise). I imagine its probably safe to
assume the compiler understands CPUID if it understands AVX512 intrinsics,
but that is still mostly a guess.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
view thread (173+ messages) latest in thread
Message-ID: <20240329162211.GB1106154@nathanxps13>
Permalink: ../20240329162211.GB1106154@nathanxps13/
Also on: postgresql.org/message-id/20240329162211.GB1106154@nathanxps13
copy link · copy postgr.es
reply 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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, paul.d.amonson@intel.com, tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, andres@anarazel.de, alvherre@alvh.no-ip.org, akash.shankaran@intel.com, noah@leadboat.com, boekewurm+postgres@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Popcount optimization using AVX512
In-Reply-To: <20240329162211.GB1106154@nathanxps13>
* 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