#1 2022-08-12 23:24:17

scamp
Member
Registered: 2022-06-05
Posts: 3

Faster hashing for ARM targets

Hi,

Mormot uses crc32c hardware instruction on Intel for hashing, and is damn fast.

The comments in mormot.core.base suggest that there is supposed to also be ASM code for ARM to use the corresponding ARMv7/ARMv8/AArch64 instructions. But unless I am blind, this is not implemented.

We use a lot of targets with 32bit ARMv7, and recently new hardware with AArch64.

Would you please consider to add the missing ARM code so we get faster hashing?

Right now this xxhash32 function is the fastest we could find for ARMv7, and we have been using it for a while now:

https://share.nerdherrschaft.net/d/4b34 … 442a4817c/

For AArch64, here is some amazingly fast code:

https://dougallj.wordpress.com/2022/05/ … -apple-m1/

Maybe you'd want to port that assembler code to mORMot? That would be great.

Also, for x86, I don't know if you have seen this:

https://www.corsix.org/content/fast-crc32c-4k

- might be faster than your existing code for large blocks.



And one question to close this up: According to your blog post, AesNiHash32 is even faster than your crc32c implementation. So why isn't it used as default hasher then...?

Cheers,

Simon / scamp

Offline

#2 2022-08-13 06:13:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Faster hashing for ARM targets

See https://blog.synopse.info/?post/2021/08 … AARM64-CPU
and https://github.com/synopse/mORMot2/tree … atic/armv8
They are linked in mormot.core.os.posix.inc

crc32cblock is already computing 4 crcs in parallel.
Note that it is not the same as crc32_4k

And AesNiHash32 is the default hasher.
As set by mormot.crypt.core.pas

Offline

#3 2022-08-18 09:52:11

scamp
Member
Registered: 2022-06-05
Posts: 3

Re: Faster hashing for ARM targets

Thank you, no clue why I missed the ARMV8 Static source in my search.

Any chance you are going to implement something for ARMv7 with NEON, too?

Offline

#4 2022-08-18 13:19:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Faster hashing for ARM targets

There is no such plan yet, on ARM7.

Offline

Board footer

Powered by FluxBB