pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Popcount optimization using AVX512
Date: Thu, 7 Nov 2024 14:32:09 -0600
Message-ID: <Zy0jya8nF8CPpv3B@nathan> (raw)
In-Reply-To: <Zy0c-CWHYGr0QFfC@nathan>
References: <173022983862.1162.9439822012408182864.pgcf@coridan.postgresql.org>
	<173032159044.1162.17669652767784249811.pgcf@coridan.postgresql.org>
	<ZyKgsihSKB0kAI3U@nathan>
	<ZyPYtMqDnP_lZSO0@nathan>
	<PH8PR11MB8286BFA90CC9BE11AE8ADEEDFB552@PH8PR11MB8286.namprd11.prod.outlook.com>
	<ZyjxVFCEtnmb1kN4@nathan>
	<ZywlZzPcPnlqKvt5@nathan>
	<ux3qakiuks3g32tpgmcna4jplqztkflhmmw2cdj4v3uut5qodq@5vgf6a2gwrpl>
	<Zyzo59fME1JsF3qH@nathan>
	<Zy0c-CWHYGr0QFfC@nathan>

On Thu, Nov 07, 2024 at 02:03:04PM -0600, Nathan Bossart wrote:
> Committed.

Of course, as soon as I committed this, I noticed that it's broken.  It
seems that compilers are rather picky about how multiple target options are
specified.  AFAICT the commonly supported syntax is to put the entire list
within one pair of quotes and to use only commas as delimiters, i.e., no
spaces.  I plan to commit the attached shortly once I've had a chance to
verify it fixes the problem on cfbot.

-- 
nathan

Attachments:

0001-fix-__attribute__-target-.-usage.patch (text/plain, 2.6K) download From a5ade18a867377fa424347465bbc5f631eff4f96 Mon Sep 17 00:00:00 2001 From: Nathan Bossart <nathan@postgresql.org> Date: Thu, 7 Nov 2024 14:28:57 -0600 Subject: [PATCH 1/1] fix __attribute__((target(...))) usage --- config/c-compiler.m4 | 2 +- configure | 2 +- meson.build | 2 +- src/port/pg_popcount_avx512.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index c7eb896f14..a129edb88e 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -733,7 +733,7 @@ AC_DEFUN([PGAC_AVX512_POPCNT_INTRINSICS], AC_CACHE_CHECK([for _mm512_popcnt_epi64], [Ac_cachevar], [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <immintrin.h> #if defined(__has_attribute) && __has_attribute (target) - __attribute__((target("avx512vpopcntdq","avx512bw"))) + __attribute__((target("avx512vpopcntdq,avx512bw"))) #endif static int popcount_test(void) { diff --git a/configure b/configure index 3a7332f834..4b01b682b1 100755 --- a/configure +++ b/configure @@ -17324,7 +17324,7 @@ else /* end confdefs.h. */ #include <immintrin.h> #if defined(__has_attribute) && __has_attribute (target) - __attribute__((target("avx512vpopcntdq","avx512bw"))) + __attribute__((target("avx512vpopcntdq,avx512bw"))) #endif static int popcount_test(void) { diff --git a/meson.build b/meson.build index 9eddd72a27..5b0510cef7 100644 --- a/meson.build +++ b/meson.build @@ -2184,7 +2184,7 @@ if host_cpu == 'x86_64' #include <immintrin.h> #if defined(__has_attribute) && __has_attribute (target) -__attribute__((target("avx512vpopcntdq","avx512bw"))) +__attribute__((target("avx512vpopcntdq,avx512bw"))) #endif int main(void) { diff --git a/src/port/pg_popcount_avx512.c b/src/port/pg_popcount_avx512.c index b598e86554..1ab2847bf2 100644 --- a/src/port/pg_popcount_avx512.c +++ b/src/port/pg_popcount_avx512.c @@ -106,7 +106,7 @@ pg_popcount_avx512_available(void) * pg_popcount_avx512 * Returns the number of 1-bits in buf */ -pg_attribute_target("avx512vpopcntdq", "avx512bw") +pg_attribute_target("avx512vpopcntdq,avx512bw") uint64 pg_popcount_avx512(const char *buf, int bytes) { @@ -162,7 +162,7 @@ pg_popcount_avx512(const char *buf, int bytes) * pg_popcount_masked_avx512 * Returns the number of 1-bits in buf after applying the mask to each byte */ -pg_attribute_target("avx512vpopcntdq", "avx512bw") +pg_attribute_target("avx512vpopcntdq,avx512bw") uint64 pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask) { -- 2.39.5 (Apple Git-154)

view thread (173+ messages)  latest in thread

Message-ID: <Zy0jya8nF8CPpv3B@nathan>
Permalink:  ../Zy0jya8nF8CPpv3B@nathan/
Also on:    postgresql.org/message-id/Zy0jya8nF8CPpv3B@nathan

 ·  · 

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, andres@anarazel.de, raghuveer.devulapalli@intel.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Popcount optimization using AVX512
  In-Reply-To: <Zy0jya8nF8CPpv3B@nathan>

* 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