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 1qxv71-004N2B-U4 for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2023 20:13:19 +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 1qxv70-0044TN-1j for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2023 20:13:18 +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 1qxv6z-0044TF-OO for pgsql-hackers@lists.postgresql.org; Tue, 31 Oct 2023 20:13:17 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxv6t-003L1u-5y for pgsql-hackers@postgresql.org; Tue, 31 Oct 2023 20:13:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39VKCeDH2620795; Tue, 31 Oct 2023 16:12:41 -0400 From: Tom Lane To: Nathan Bossart cc: Jeff Davis , pgsql-hackers@postgresql.org, Xiang.Gao@arm.com Subject: Re: always use runtime checks for CRC-32C instructions In-reply-to: <20231031195331.GA77436@nathanxps13> References: <20231030161706.GA3011@nathanxps13> <2427946.1698683963@sss.pgh.pa.us> <20231031033601.GA68409@nathanxps13> <20231031155518.GA70172@nathanxps13> <2613682.1698779776@sss.pgh.pa.us> <20231031195331.GA77436@nathanxps13> Comments: In-reply-to Nathan Bossart message dated "Tue, 31 Oct 2023 14:53:31 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2620793.1698783160.1@sss.pgh.pa.us> Date: Tue, 31 Oct 2023 16:12:40 -0400 Message-ID: <2620794.1698783160@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > Okay. With that in mind, I think the path forward for new instructions is > as follows: > * If the special CRC instructions can be used with the default compiler > flags, we can only use newer instructions if they can also be used with > the default compiler flags. (My M2 machine appears to add +crypto by > default, so I bet your buildfarm animals would fall into this bucket.) > * Otherwise, if the CRC instructions can be used with added flags (i.e., > the runtime check path), we can do a runtime check for the new > instructions as well. (Most other buildfarm animals would fall into this > bucket.) This seems like a reasonable proposal. > Any platform that can use the CRC instructions with default compiler flags > but not the new instructions wouldn't be able to take advantage of the > proposed optimization, but it also wouldn't be subject to the small > performance regression. Check. For now I think that's fine. If we get to a place where this policy is really leaving a lot of performance on the table, we can revisit it ... but that situation is hypothetical and may remain so. (It's worth noting also that a package builder can move the goalposts at will, since our idea of "default flags" is really whatever the user says to use.) regards, tom lane