Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t95Fo-007frq-T8 for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Nov 2024 16:21:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t95Fm-00H9df-0Q for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Nov 2024 16:21:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t95Fl-00H9dX-Mn for pgsql-hackers@lists.postgresql.org; Thu, 07 Nov 2024 16:21:02 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t95Fi-000hWg-Dv for pgsql-hackers@lists.postgresql.org; Thu, 07 Nov 2024 16:21:01 +0000 Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-82cd93a6617so40667839f.3 for ; Thu, 07 Nov 2024 08:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730996458; x=1731601258; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=17jxl0Pwrc9Fihoz2jzhumgkzKCDVCmTGnWketiu2u8=; b=WvFiYpFAJ8smQav8DloZnGlsPYhJodbTP/DkCZeEvWtSAxELcUULxmDdrfCxzPHxGE cwLZ0abe2mdIRVvGeY3hTefrzx6C52bPuf80rW4BA0vhiv9/Tx7m3bMoVRuF51pIvjQh 8WTdoXSNK6WoUMB+IDzbTrgyWT4CagQa1En2dV9YTxCESSfZrtwOj9MXwv8j0tK7PmFc I4EziqFQQighPxtYj0T+jFMb/p9YdOBEMj+0m8l+686XbExB9wqZiSmcqNqnO09qibht UfE2Syumvzev/8SXoV7GViajXA4Jvq7xuhmKXIXQtVkpQubNaehud++BaE+ke3E3Aj0E kD3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730996458; x=1731601258; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=17jxl0Pwrc9Fihoz2jzhumgkzKCDVCmTGnWketiu2u8=; b=cF4w48CjftOS3PVinGgUNvECxKoAqdzqQC+JL3ckIYYnNh2IOR+s9B3pDkndOnxsO0 svwKPQfjgERkQ2EeS3U9gTipPVrmtvtJ3yi+H1j219mAGm/gtuNEVmmQtO+od3WVzuch 10E9tS6wBYM3SkWXVr2w4sUaSBCBuDDW1y0jMwq1kw3WUod6i7H85R9xGQartOGg6RMP vjddJVIsrdZOZGhTcEcf9S8MHmRq/XEJTfZDmIELrFeFs0tpN+p6Kv6gE1lmpVgLaVGp gAV52EH3ruWq4VYqG8PHr1p2U5oHUFXwQojq1RnIYJAmDgG9fYCJnB+0nA7afIZOCKAu R/0w== X-Forwarded-Encrypted: i=1; AJvYcCU6gzlkRwbLUuwqa5TFEOmdi1sH7jseGHNe9FBfL7T/02pxq25SBMYRpy7bmCcI3QZB8SGAPAA2zekQs0E2@lists.postgresql.org X-Gm-Message-State: AOJu0Yw0kc0BYnbfdEWhG2BbmAfHNJ8hfFeCV3IpvwFZNLSmUss7e9R7 SIl0RisX161TzOlrRuaufMUQNeUXJjTQGt/IkzrOdFq7J6zl0dGZ X-Google-Smtp-Source: AGHT+IHkLxdLX2+nxVY6bw1j5R374etgzQd5QoNq2CJm0wmhvr/6GGRIRUy4f648WGkKgUKMTxV4Hg== X-Received: by 2002:a05:6602:619b:b0:83b:28e2:4985 with SMTP id ca18e2360f4ac-83b28e24d1dmr3898126939f.12.1730996457368; Thu, 07 Nov 2024 08:20:57 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4de5f811979sm374171173.48.2024.11.07.08.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 08:20:57 -0800 (PST) Date: Thu, 7 Nov 2024 10:20:55 -0600 From: Nathan Bossart To: Andres Freund Cc: "Devulapalli, Raghuveer" , "pgsql-hackers@lists.postgresql.org" Subject: Re: Popcount optimization using AVX512 Message-ID: References: <173022983862.1162.9439822012408182864.pgcf@coridan.postgresql.org> <173032159044.1162.17669652767784249811.pgcf@coridan.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Nov 07, 2024 at 11:12:37AM -0500, Andres Freund wrote: > One thing that'd I'd like to see this being used is to elide the indirection > when the current target platform *already* supports the necessary > intrinsics. Adding a bunch of indirection for short & common operations is > decidedly not great. It doesn't have to be part of the same commit, but it > seems like it's worth doing as part of the same series, as I think it'll lead > to rather different looking configure checks. The main hurdle, at least for AVX-512, is that we still need to check (at runtime) whether the OS supports XGETBV and whether the ZMM registers are fully enabled. We might be able to skip those checks in limited cases (e.g., you are building on the target machine and can perhaps just check it once at build time), but that probably won't help packagers. >> +/* >> + * pg_attribute_target allows specifying different target options that the >> + * function should be compiled with (e.g., for using special CPU instructions). >> + */ >> +#if __has_attribute (target) >> +#define pg_attribute_target(...) __attribute__((target(__VA_ARGS__))) >> +#else >> +#define pg_attribute_target(...) >> +#endif > > Think it'd be good to mention that there still needs to be configure check to > verify that specific target attribute is understood by the compiler. Will do. -- nathan