Re: Optimize Arm64 crc32 implementation in PostgreSQL - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Optimize Arm64 crc32 implementation in PostgreSQL
Date
Msg-id 20230821200446.GA444673@nathanxps13
Whole thread Raw
In response to Optimize Arm64 crc32 implementation in PostgreSQL  (Xiang Gao <Xiang.Gao@arm.com>)
List pgsql-hackers
On Mon, Aug 21, 2023 at 09:32:42AM +0000, Xiang Gao wrote:
> Currently PostgreSQL has three different variants of a 32-bit CRC calculation: CRC-32C, CRC-32(Ethernet polynomial),
> and a legacy CRC-32 version that uses the lookup table. Some ARMv8 (AArch64) CPUs implement the CRC32 extension
which
> is equivalent with CRC-32(Ethernet polynomial), so they can also benefit from hardware acceleration.
> 
> Can I propose a patch to optimize crc32 calculation with Arm64 specific instructions?

We have support for ARMv8 CRC instructions for CRC-32C (see
src/port/pg_crc32c_armv8.c), but AFAICT Postgres has no such optimization
for CRC-32.  The CRC-32 macros have a comment indicating that they are
currently only used in ltree and hstore, so there might not be terribly
much demand for hardware acceleration, though.

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



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }
Next
From: Joe Conway
Date:
Subject: Re: C function to return double precision[][]