Re: [PATCH] Add loongarch native checksum implementation.
John Naylor <john.naylor@enterprisedb.com>
From: John Naylor <john.naylor@enterprisedb.com>
To: YANG Xudong <yangxudong@ymatrix.cn>
Cc: pgsql-hackers@lists.postgresql.org, wengyanqing@ymatrix.cn, wanghao@ymatrix.cn
Date: 2023-08-08T06:38:25Z
Lists: pgsql-hackers
Attachments
- v4-0002-Some-minor-adjustemts-to-be-squashed.patch (text/x-patch) patch v4-0002
- v4-0001-Use-native-CRC-instructions-on-LoongArch.patch (text/x-patch) patch v4-0001
On Tue, Aug 8, 2023 at 10:07 AM YANG Xudong <yangxudong@ymatrix.cn> wrote: > On 2023/8/7 19:01, John Naylor wrote: > > The compilation test is found in c-compiler.m4, which still has all > > logic for CFLAGS_CRC, including saving and restoring the old CFLAGS. Can > > this also be simplified? > > Fixed the function in c-compiler.m4 by removing the function argument > and the logic of handling CFLAGS and CFLAGS_CRC. Looks good to me. It seems that platforms capable of running Postgres only support 64 bit. If that ever changes, the compiler intrinsic test (with 8 byte CRC input) should still gate that well enough in autoconf, I believe, so in v4 I added a comment to clarify this. The Meson build checks hostcpu first for all platforms, and the patch is consistent with surrounding code. In the attached 0002 addendum, I change a comment in configure.ac to clarify "override" is referring to the runtime check for x86 and Arm, and that LoongArch doesn't need one. > > Can you confirm the alignment requirement -- it's not clear what the > > intention is since "doesn't require" wasn't carried over. Is there any > > documentation (or even a report in some other context) about aligned vs > > unaligned memory access performance? > > It is in the official document that the alignment is not required. > > https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#74-unaligned-memory-access-support > > > However, I found this patch in LKML that shows great performance gain > when using aligned memory access similar to this patch. > > https://lore.kernel.org/lkml/20230410115734.93365-1-wangrui@loongson.cn/ > > So I guess using aligned memory access is necessary and I have updated > the comment in the code. Okay, so it's not "necessary" in the sense that it's illegal, so I'm thinking we can just re-use the Arm comment language, as in 0002. v4 0001 is the same as v3, but with a draft commit message. I will squash and commit this week, unless there is additional feedback. -- John Naylor EDB: http://www.enterprisedb.com
Commits
-
Update Solution.pm for new LoongArch CRC symbol
- f25b18500a84 17.0 landed
-
Use native CRC instructions on 64-bit LoongArch
- 4d14ccd6af6e 17.0 landed
-
Recalculate search_path after ALTER ROLE.
- fa2e874946c5 17.0 cited