Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-27 Thread Nathan Bossart
On Wed, Nov 27, 2024 at 05:09:17PM +, Devulapalli, Raghuveer wrote: > LGTM. Committed. -- nathan

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-27 Thread Devulapalli, Raghuveer
> Here's what I have staged for commit (except for the commit message, which > needs some work). LGTM. Raghuveer

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-26 Thread Nathan Bossart
Here's what I have staged for commit (except for the commit message, which needs some work). -- nathan >From c405f5a41cca9ce5de9c0e69e00d11b16ba93986 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 26 Nov 2024 14:17:03 -0600 Subject: [PATCH v6 1/1] Use __attribute__((target(...))) for S

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-26 Thread Nathan Bossart
On Mon, Nov 25, 2024 at 11:28:52PM +, Devulapalli, Raghuveer wrote: >> Thanks. I think my only remaining feedback is that we should probably add a >> comment to explain why we aren't doing this for ARM yet [0]. > > Sounds good. Where would you like me to add this comment? Meson.build and > co

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-25 Thread Devulapalli, Raghuveer
> > Thanks. I think my only remaining feedback is that we should probably add a > comment to explain why we aren't doing this for ARM yet [0]. Sounds good. Where would you like me to add this comment? Meson.build and configure?

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-25 Thread Nathan Bossart
On Fri, Nov 22, 2024 at 09:00:01PM +, Devulapalli, Raghuveer wrote: > Sure. Updated patch. Thanks. I think my only remaining feedback is that we should probably add a comment to explain why we aren't doing this for ARM yet [0]. [0] https://postgr.es/m/ZwXsE0KG_wh6_heU%40nathan -- nathan

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-22 Thread Devulapalli, Raghuveer
> I think we should still use the test program even when __SSE4_2__ is defined, > but > we can use that macro to determine whether to use a runtime check. I think > that > would keep autoconf and meson consistent. Sure. Updated patch. v5-0001-Use-__attribute__-target-sse4.2-for-SSE42-CRC32C.p

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-22 Thread Nathan Bossart
On Thu, Nov 21, 2024 at 11:07:59PM +, Devulapalli, Raghuveer wrote: > Thanks for the review! We can actually leverage meson's built in option > to check for a macro: cc.get_define('__SSE4_2__') != ''. This should keep > the logic consistent across configure and meson. I think we should still

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-21 Thread Devulapalli, Raghuveer
> I think it is in pretty good shape. After a read-through, the only thing > that stands > out to me is the difference in configure tests between autoconf and meson. I > think we should consider picking one approach, although I'm not sure I have a > strong preference. Thanks for the review! We

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-21 Thread Nathan Bossart
On Wed, Nov 20, 2024 at 05:37:33PM +, Devulapalli, Raghuveer wrote: > Anymore feedback on this patch? Hoping this is a straightforward one. I think it is in pretty good shape. After a read-through, the only thing that stands out to me is the difference in configure tests between autoconf and

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-20 Thread Devulapalli, Raghuveer
; Shankaran, Akash > > Subject: RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C > > V3: With the suggested changes. > > Raghuveer > > > -Original Message- > > From: Devulapalli, Raghuveer > > Sent: Friday, November 8, 2024 10:43 AM > >

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-08 Thread Devulapalli, Raghuveer
V3: With the suggested changes. Raghuveer > -Original Message- > From: Devulapalli, Raghuveer > Sent: Friday, November 8, 2024 10:43 AM > To: Nathan Bossart > Cc: pgsql-hackers@lists.postgresql.org; Shankaran, Akash > > Subject: RE: Use __attribute__((targe

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-08 Thread Devulapalli, Raghuveer
> 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 > Ah, I missed this.

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-08 Thread Nathan Bossart
On Fri, Nov 08, 2024 at 05:52:23PM +, 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 y

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-08 Thread Devulapalli, Raghuveer
> -prog = ''' > +sse42_crc_prog = ''' > > nitpick: Why does this need to be renamed? Doesn't need to be renamed, but just a better name to describe that the code is meant for. It will be followed up with avx512_crc_prog in the next patch. > > +#ifdef TEST_SSE42_WITH_ATTRIBUTE > +#if d

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-08 Thread Nathan Bossart
-prog = ''' +sse42_crc_prog = ''' nitpick: Why does this need to be renamed? +#ifdef TEST_SSE42_WITH_ATTRIBUTE +#if defined(__has_attribute) && __has_attribute (target) +__attribute__((target("sse4.2"))) +#endif +#endif So, for meson builds, we do test with and without __attribute___((ta

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Devulapalli, Raghuveer
Here is the updated patch with the #if defined(__has_attribute) && __has_attribute (target) guard. > Oh, you are right, sorry. No worries! 😊 > Is the idea that we will put both "choose" functions in one file and the > actual > CRC-32C code in another? I'm okay with that. Yup, there can only

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Nathan Bossart
On Thu, Nov 07, 2024 at 09:30:32PM +, Devulapalli, Raghuveer wrote: >> # Check for Intel SSE 4.2 intrinsics to do CRC calculations. >> # >> -# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used >> -# >> with the default compiler flags. If not, check if adding the -msse4

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Devulapalli, Raghuveer
> +__attribute__((target("sse4.2"))) > > These need to be surrounded with > > #if defined(__has_attribute) && __has_attribute (target) > > so that we still attempt the check on compilers that don't support it (e.g., > MSVC). I assumed configure was only used on linux and ignored this

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Nathan Bossart
+__attribute__((target("sse4.2"))) These need to be surrounded with #if defined(__has_attribute) && __has_attribute (target) so that we still attempt the check on compilers that don't support it (e.g., MSVC). # Check for Intel SSE 4.2 intrinsics to do CRC calculations. # -# First