Re: CRC32C Parallel Computation Optimization on ARM - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: CRC32C Parallel Computation Optimization on ARM
Date
Msg-id 20231106191613.GA524892@nathanxps13
Whole thread Raw
In response to RE: CRC32C Parallel Computation Optimization on ARM  (Xiang Gao <Xiang.Gao@arm.com>)
Responses RE: CRC32C Parallel Computation Optimization on ARM
List pgsql-hackers
On Fri, Nov 03, 2023 at 10:46:57AM +0000, Xiang Gao wrote:
> On Date: Thu, 2 Nov 2023 09:35:50AM -0500, Nathan Bossart wrote:
>> The idea is that we don't want to start forcing runtime checks on builds
>> where we aren't already doing runtime checks.  IOW if the compiler can use
>> the ARMv8 CRC instructions with the default compiler flags, we should only
>> use vmull_p64() if it can also be used with the default compiler flags.
>
> This is the newest patch, I think the code for which crc algorithm to
> choose is a bit complicated. Maybe we can just use USE_ARMV8_VMULL only,
> and do runtime checks on the vmull_p64 instruction at all times. This
> will not affect the existing builds, because this is a new instruction
> and new logic. In addition, it  can also reduce the complexity of the
> code.

I don't think we can.  AFAICT a runtime check necessitates a function
pointer or a branch, both of which incurred an impact on performance in my
tests.  It looks like this latest patch still does the runtime check even
for the USE_ARMV8_CRC32C case.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: Add bump memory context type and use it for tuplesorts
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: Adding facility for injection points (or probe points?) for more advanced tests