Re: Optimize Arm64 crc32 implementation in PostgreSQL

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Xiang Gao <Xiang(dot)Gao(at)arm(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Optimize Arm64 crc32 implementation in PostgreSQL
Date: 2023-08-21 20:04:46
Message-ID: 20230821200446.GA444673@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2023-08-21 20:04:53 Re: C function to return double precision[][]
Previous Message Jeff Davis 2023-08-21 19:44:55 Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }