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: Sat, 30 Mar 2024 15:03:29 -0500
Message-ID: <20240330200329.GA2047466@nathanxps13> (raw )
In-Reply-To: <20240330032209.GA2018686@nathanxps13 >
References: <20240328213854.GA916732@nathanxps13 >
<BL1PR11MB5304E51336123CE6F041A920DC3B2@BL1PR11MB5304.namprd11.prod.outlook.com >
<BL1PR11MB5304217FFEFB15124CD2EC9EDC3B2@BL1PR11MB5304.namprd11.prod.outlook.com >
<20240329155940.GC1046039@nathanxps13 >
<20240329162211.GB1106154@nathanxps13 >
<BL1PR11MB5304D41D49B56986097713AFDC3A2@BL1PR11MB5304.namprd11.prod.outlook.com >
<20240329191312.GA1411904@nathanxps13 >
<20240329200828.GB1411904@nathanxps13 >
<20240329205741.GA1593561@nathanxps13 >
<20240330032209.GA2018686@nathanxps13 >
I used John Naylor's test_popcount module [0] to put together the attached
graphs (note that the "small arrays" one is semi-logarithmic). For both
graphs, the X-axis is the number of 64-bit words in the array, and Y-axis
is the amount of time in milliseconds to run pg_popcount() on it 100,000
times (along with a bit of overhead). This test didn't show any
regressions with a relatively small number of bytes, and it showed the
expected improvements with many bytes.
There isn't a ton of use of pg_popcount() in Postgres, but I do see a few
places that call it with enough bytes for the AVX512 optimization to take
effect. There may be more callers in the future, though, and it seems
generally useful to have some of the foundational work for using AVX512
instructions in place. My current plan is to add some new tests for
pg_popcount() with many bytes, and then I'll give it a few more days for
any additional feedback before committing.
[0] https://postgr.es/m/CAFBsxsE7otwnfA36Ly44zZO+b7AEWHRFANxR1h1kxveEV=ghLQ@mail.gmail.com
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
Attachments:
avx512_popcnt.jpg (image/jpeg, 17.0K) download
view image
avx512_popcnt_small_arrays.jpg (image/jpeg, 13.8K) download
view image
view thread (173+ messages) latest in thread
Message-ID: <20240330200329.GA2047466@nathanxps13>
Permalink: ../20240330200329.GA2047466@nathanxps13/
Also on: postgresql.org/message-id/20240330200329.GA2047466@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: <20240330200329.GA2047466@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