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 1t94RN-007a3t-Ca for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Nov 2024 15:28:56 +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 1t94RK-00GY3k-Ll for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Nov 2024 15:28:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t94RK-00GY3c-Ao for pgsql-bugs@lists.postgresql.org; Thu, 07 Nov 2024 15:28:54 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t94RE-000eSk-5x for pgsql-bugs@lists.postgresql.org; Thu, 07 Nov 2024 15:28:53 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3a6af694220so4073785ab.1 for ; Thu, 07 Nov 2024 07:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730993327; x=1731598127; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=rqZd8/xtTXwRBzBaDrbwePsBsvkedcOMKi4NXXiTIBw=; b=YvDwYiKVliUQ05S+J+3RO0zq4uy/cUbwRczj4er1Ic1UfnFfBLYYoGuTkYMj25Cp2n EpCWTyu7N+J8ebs2kCQ/clkyqwO4eIZyKB/2b21Ov860UkiHlenQua3V666MIRZqW61q oW7mwz1/vwB1D00AyyZYOyiZU25Yae4SR6i/kgG971rETQUEE+xzItvxTQ7GqyIDe6Vn QWwRmYJj2ztYlpGv6PoJr4VETs8zjrBxC/s7R5G58NkFkqqMpKr/ql6JGpEAzbj+Vuq3 IuPrD8UUpTO2q6nBn09t+5+MhqC803pIhGHxQOCoLHXje17IHAhbeCfu11gEpQJt0li+ /fGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730993327; x=1731598127; h=in-reply-to:content-transfer-encoding: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=rqZd8/xtTXwRBzBaDrbwePsBsvkedcOMKi4NXXiTIBw=; b=eBfDBCK4Ukc0q3j7G2Hk5cY+QnK90tIVRUYfh8qDEJu20qZJThD1XStb8CFFOEgMUb RmTvgjyROiCUvFQXoEpbP1gBWylgrmV36TzEpDs/S+Q2hhMIxrvX/+ifszymvoyMTdne 6a//DbusBM9GHOf2qbAbscpywATzRvefRIfwjoyWNjcb0HFohGNoLtr8Iclhz2jDMSU7 qslpw4JqnIfx0Y0eLopPk9J/zc0r8hG9LNujKMss66BnJXpAMKZA+aVWKcpYDQN2oxtQ AiCOY58Nw7/kyzrYXpY1wCIoE9pIpAnPGbu2/YHSNAfHxdWfCxbiRbpTUaofj55Kkfde y2mg== X-Forwarded-Encrypted: i=1; AJvYcCWKKcUIGu7XmUgRP+fkyN6qacOVeynnCzd+aO5JE6jidvlXhmnlgDcSg/icg9UZDxy2TjNtCIpN+001@lists.postgresql.org X-Gm-Message-State: AOJu0YyM7dcTCj6+iqCIF3pqn+ii0qSbbf4Hyq5kPF9L1UVxhLlGp39I 1kBhyIR8LcJ307oiH/trAJrr3q8vmhu3OXTrji0jolpYoTX3xib1 X-Google-Smtp-Source: AGHT+IGwirtA/rHUBzjW+d/3UHw/L2KnMfodPL+89wTQXV13KqbiRwg0B8YAQh0dTtCYy9bjZFNNqw== X-Received: by 2002:a05:6e02:b2e:b0:3a3:b45b:fb92 with SMTP id e9e14a558f8ab-3a6b03bfd5emr221661005ab.23.1730993327252; Thu, 07 Nov 2024 07:28:47 -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-4de5f8e2aa7sm341437173.114.2024.11.07.07.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 07:28:46 -0800 (PST) Date: Thu, 7 Nov 2024 09:28:44 -0600 From: Nathan Bossart To: Thomas Munro Cc: Tom Lane , Heikki Linnakangas , Bastien =?iso-8859-1?Q?Roucari=E8s?= , pgsql-bugs@lists.postgresql.org Subject: Re: Detection of hadware feature => please do not use signal Message-ID: References: <4496616.iHFcN1HehY@portable-bastien> <1156374.1730396928@sss.pgh.pa.us> <7ec1c65c-1a28-49a7-af43-f77c260a3df6@iki.fi> <1292593.1730399134@sss.pgh.pa.us> <1624905.1730436275@sss.pgh.pa.us> <1637254.1730441792@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Nov 02, 2024 at 06:11:33PM +1300, Thomas Munro wrote: > On Fri, Nov 1, 2024 at 7:16 PM Tom Lane wrote: >> Actually, after chewing on that second point awhile longer, >> how about this modest proposal: >> >> * Drop all code for run-time determination of ARM CRC support. >> Assume it's there unless user builds with a -march option that >> says it definitely isn't. > > For CRC32, that would work (and already does via configure tests) for > macOS (I'd forgotten about that in my earlier message, Macs never even > compile the CRC32 "choose" code because the system compiler targets M1 > by default), recent RHEL (see below), and presumably others, but it > would penalise Debian, FreeBSD (using the standard binary package > repo) and others if we didn't have the runtime check due to their > conservative choice of baseline arch (as Bastien just said about > Debian in a crossed email). I've been wondering about what to do > about all this for a while... There are also other features we aren't > using yet, but should, or single instructions that we are calling > through function pointers, preventing automatic vectorisation etc. One small improvement in this area that I'm working on (and about to commit for the AVX-512 stuff) is using __attribute__((target(...))) instead of special -march options for specific files [0]. Among other things, this simplifies the configure checks and eliminates the need to put chunks of code in separate files. However, I found that until recently, it wasn't possible to include arm_acle.h without the -march flag [1], which means we likely won't be able to make the switch for the ARM CRC stuff for a few more years. More to the point, until the baseline moves, I think we'll end up adding checks in header files so that we only take the function pointer overhead when it's likely to be worth it (e.g., pg_popcount() in pg_bitutils.h). It might be worth doing that for the CRC-32C code, too, since we are still quite reliant on the runtime check. [0] https://commitfest.postgresql.org/50/5305/ [1] https://postgr.es/m/ZwXsE0KG_wh6_heU%40nathan -- nathan