Re: use SIMD in GetPrivateRefCountEntry()

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(at)vondra(dot)me>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Georgios <gkokolatos(at)protonmail(dot)com>, Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: use SIMD in GetPrivateRefCountEntry()
Date: 2025-10-24 20:32:54
Message-ID: CAH2-Wzm1=u8KOGOeMgGfC9GPFNq=zUAf5ohkDXqK2DjyVGDbUA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 3, 2025 at 10:48 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> I quickly hacked together some patches for this. 0001 adds new static
> variables so that we have a separate array of the buffers and the index for
> the current ReservedRefCountEntry. 0002 optimizes the linear search in
> GetPrivateRefCountEntry() using our simd.h routines. This stuff feels
> expensive (see vector8_highbit_mask()'s implementation for AArch64), but if
> the main goal is to avoid branches, I think this is about as "branchless"
> as we can make it. I'm going to stare at this a bit longer, but I figured
> I'd get something on the lists while it is fresh in my mind.

I was unable to notice any improvements in any of the microbenchmarks
that I've been using to test the index prefetching patch set. For
whatever reason, these test cases are neither improved nor regressed
by your patch series.

I've never really played around with SIMD before. Is the precise CPU
microarchitecture relevant? Are power management settings important?

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2025-10-24 20:56:13 Re: use SIMD in GetPrivateRefCountEntry()
Previous Message Jim Jones 2025-10-24 20:31:41 Re: display hot standby state in psql prompt