public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alvaro Herrera <[email protected]>
To: Nathan Bossart <[email protected]>
Cc: Ants Aasma <[email protected]>
Cc: Amonson, Paul D <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: David Rowley <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Shankaran, Akash <[email protected]>
Cc: Noah Misch <[email protected]>
Cc: Matthias van de Meent <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Popcount optimization using AVX512
Date: Tue, 2 Apr 2024 19:34:08 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <20240402155301.GA2750455@nathanxps13>

On 2024-Apr-02, Nathan Bossart wrote:

> Another idea I had is to turn pg_popcount() into a macro that just uses the
> pg_number_of_ones array when called for few bytes:
> 
> 	static inline uint64
> 	pg_popcount_inline(const char *buf, int bytes)
> 	{
> 		uint64		popcnt = 0;
> 
> 		while (bytes--)
> 			popcnt += pg_number_of_ones[(unsigned char) *buf++];
> 
> 		return popcnt;
> 	}
> 
> 	#define pg_popcount(buf, bytes) \
> 		((bytes < 64) ? \
> 		 pg_popcount_inline(buf, bytes) : \
> 		 pg_popcount_optimized(buf, bytes))
> 
> But again, I'm not sure this is really worth it for the current use-cases.

Eh, that seems simple enough, and then you can forget about that case.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Popcount optimization using AVX512
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox