From: Nathan Bossart <nathandbossart@gmail.com>
To: Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Shankaran, Akash <akash.shankaran@intel.com>
Subject: Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C
Date: Fri, 8 Nov 2024 12:07:45 -0600
Message-ID: <Zy5Tceeb4Ybfx39q@nathan> (raw)
In-Reply-To: <PH8PR11MB8286A700203AAE91C5AFCB18FB5D2@PH8PR11MB8286.namprd11.prod.outlook.com>
References: <PH8PR11MB8286BE735A463468415D46B5FB5C2@PH8PR11MB8286.namprd11.prod.outlook.com>
<Zy0qg7cnI3uMr-qn@nathan>
<PH8PR11MB82868168DEB5CA1FBE9EEDC1FB5C2@PH8PR11MB8286.namprd11.prod.outlook.com>
<Zy0y5qZi27ITnC1q@nathan>
<PH8PR11MB82866E2249ABC8AA2E97497CFB5C2@PH8PR11MB8286.namprd11.prod.outlook.com>
<Zy5K5Qmlb3Z4dsd4@nathan>
<PH8PR11MB8286A700203AAE91C5AFCB18FB5D2@PH8PR11MB8286.namprd11.prod.outlook.com>
On Fri, Nov 08, 2024 at 05:52:23PM +0000, Devulapalli, Raghuveer wrote:
>> So, for meson builds, we do test with and without __attribute___((target(..."))),
>> but for autoconf builds, we check for __SSE4_2__ to determine whether we need
>> a runtime check. This difference isn't the fault of your patch, but it's a little odd.
>> That being said, I'm not sure there's a problem with either approach.
>
> I just realized, isn't this a problem on MSVC? When building with MSVC,
> USE_SSE42_CRC32C is always set to true (because MSVC doesn't require a
> specific SSE42 flag to build with): see
> https://gcc.godbolt.org/z/eoc1Ec33j. This means it is always running the
> SSE42 without a runtime check which can technically SEGILL on a really
> old CPU (SSE42 is nearly 18 years old though). This problem exists in the
> master branch too.
I believe we expect MSVC builds to use meson at this point, which is
probably why there's this extra check:
if cc.get_id() == 'msvc'
cdata.set('USE_SSE42_CRC32C', false)
cdata.set('USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 1)
have_optimized_crc = true
There used to be special MSVC scripts (removed in commit 1301c80), and it
looks like those just set USE_SSE42_CRC32C_WITH_RUNTIME_CHECK
unconditionally, too.
--
nathan
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, raghuveer.devulapalli@intel.com, akash.shankaran@intel.com
Subject: Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C
In-Reply-To: <Zy5Tceeb4Ybfx39q@nathan>
References: <PH8PR11MB8286BE735A463468415D46B5FB5C2@PH8PR11MB8286.namprd11.prod.outlook.com> <Zy0qg7cnI3uMr-qn@nathan> <PH8PR11MB82868168DEB5CA1FBE9EEDC1FB5C2@PH8PR11MB8286.namprd11.prod.outlook.com> <Zy0y5qZi27ITnC1q@nathan> <PH8PR11MB82866E2249ABC8AA2E97497CFB5C2@PH8PR11MB8286.namprd11.prod.outlook.com> <Zy5K5Qmlb3Z4dsd4@nathan> <PH8PR11MB8286A700203AAE91C5AFCB18FB5D2@PH8PR11MB8286.namprd11.prod.outlook.com> <Zy5Tceeb4Ybfx39q@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