Page MenuHomeFreeBSD

Use arm64 sha256 intrinsics in libmd
ClosedPublic

Authored by andrew on Jul 23 2021, 10:12 AM.
Tags
None
Referenced Files
F101996934: D31284.diff
Wed, Nov 6, 8:45 AM
F101985358: D31284.id92673.diff
Wed, Nov 6, 4:50 AM
Unknown Object (File)
Oct 5 2024, 12:55 PM
Unknown Object (File)
Oct 3 2024, 1:02 AM
Unknown Object (File)
Oct 2 2024, 9:33 PM
Unknown Object (File)
Oct 1 2024, 5:46 AM
Unknown Object (File)
Sep 30 2024, 10:29 PM
Unknown Object (File)
Sep 28 2024, 5:14 AM

Details

Summary

When running on a CPU that supports the arm64 sha256 intrinsics use them
to improve perfromance of sha256 calculations.

With this changethe following improvement has been seen on an Apple M1
with FreeBS running under Parallels, with similar results on a
Neoverse-N1 r3p1.

x sha256.orig
+ sha256.arm64
+--------------------------------------------------------------------+

++ x x
+++ xxx
AA

+--------------------------------------------------------------------+

N           Min           Max        Median           Avg        Stddev

x 5 3.41 3.5 3.46 3.458 0.042661458
+ 5 0.47 0.54 0.5 0.504 0.027018512
Difference at 95.0% confidence

-2.954 +/- 0.0520768
-85.4251% +/- 0.826831%
(Student's t, pooled s = 0.0357071)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Phabricator doesn't like the ministat plot so I've copied it here:

x sha256.orig
+ sha256.arm64
+--------------------------------------------------------------------+
|++                                                               x x|
|+++                                                              xxx|
||A                                                               |A||
+--------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   5          3.41           3.5          3.46         3.458   0.042661458
+   5          0.47          0.54           0.5         0.504   0.027018512
Difference at 95.0% confidence
        -2.954 +/- 0.0520768
        -85.4251% +/- 0.826831%
        (Student's t, pooled s = 0.0357071)
sys/crypto/sha2/sha256c.c
199

I might throw this in a header file.

202

Static?

andrew added inline comments.
sys/crypto/sha2/sha256c.c
199

The only reason I didn't is because I didn't want to add it to sha256.h as it shouldn't be used outside of this code and I didn't want to create a new header just for 2 lines.

Create a new header for the SHA256_Transform_arm64_impl signature

This revision is now accepted and ready to land.Aug 6 2021, 4:34 PM
This revision was automatically updated to reflect the committed changes.