Re: add AVX2 support to simd.h

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Ants Aasma <ants(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: add AVX2 support to simd.h
Date: 2024-03-15 19:40:16
Message-ID: 20240315194016.GA3896616@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 15, 2024 at 12:41:49PM -0500, Nathan Bossart wrote:
> I've also attached the results of running this benchmark on my machine at
> HEAD, after applying 0001, and after applying both 0001 and 0002. 0001
> appears to work pretty well. When there is a small "tail," it regresses a
> small amount, but overall, it seems to improve more cases than it harms.
> 0002 does regress searches on smaller arrays quite a bit, since it
> postpones the SIMD optimizations until the arrays are longer. It might be
> possible to mitigate by using 2 registers when the "tail" is long enough,
> but I have yet to try that.

The attached 0003 is a sketch of what such mitigation might look like. It
appears to help with the regressions nicely. I omitted the benchmarking
patch in v3 to appease cfbot.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-pg_lfind32-process-tail-with-SIMD-intructions.patch text/x-diff 1.5 KB
v3-0002-add-avx2-support-in-simd.h.patch text/x-diff 4.7 KB
v3-0003-optimize-pg_lfind32-by-processing-tail-with-fewer.patch text/x-diff 1.8 KB
image/jpeg 25.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-03-15 19:47:55 Re: [HACKERS] make async slave to wait for lsn to be replayed
Previous Message Thomas Munro 2024-03-15 19:11:08 Re: Weird test mixup