crypto icon indicating copy to clipboard operation
crypto copied to clipboard

sha3: add SIMD implementation with ARMv8.2 features

Open howjmay opened this issue 4 years ago • 51 comments

sha3: add SIMD implementation with ARMv8.2 features

On ARMv8 four SIMD instructions, EOR3, RAX1, XAR, BCAX are added to accelerate sha3 operations. Here the SIMD version of sha3 on ARMv8 is added.

Compare to the pure golang implementation (the implementation in keccakf.go) on Apple M1 chip, the time difference is listed in the following

benchmark old ns/op new ns/op delta BenchmarkPermutationFunction-8 227.0 ns/op 153.6 ns/op -32.33% BenchmarkSha3_512_MTU-8 4954 ns/op 3296 ns/op -33.47% BenchmarkSha3_384_MTU-8 3586 ns/op 2441 ns/op -31.93% BenchmarkSha3_256_MTU-8 2909 ns/op 1982 ns/op -31.87% BenchmarkSha3_224_MTU-8 2779 ns/op 1905 ns/op -31.45% BenchmarkShake128_MTU-8 2326 ns/op 1588 ns/op -31.73% BenchmarkShake256_MTU-8 2485 ns/op 1670 ns/op -32.80% BenchmarkShake256_16x-8 37052 ns/op 26715 ns/op -27.90% BenchmarkShake256_1MiB-8 1911863 ns/op 1293014 ns/op -32.37% BenchmarkSha3_512_1MiB-8 3496335 ns/op 2317853 ns/op -33.71%

benchmark old MB/s new MB/s speedup BenchmarkPermutationFunction-8 881.22 MB/s 1302.48 MB/s 1.48x BenchmarkSha3_512_MTU-8 272.50 MB/s 409.64 MB/s 1.50x BenchmarkSha3_384_MTU-8 376.47 MB/s 553.06 MB/s 1.47x BenchmarkSha3_256_MTU-8 464.11 MB/s 681.27 MB/s 1.47x BenchmarkSha3_224_MTU-8 485.75 MB/s 708.83 MB/s 1.46x BenchmarkShake128_MTU-8 580.32 MB/s 849.97 MB/s 1.46x BenchmarkShake256_MTU-8 543.34 MB/s 808.53 MB/s 1.49x BenchmarkShake256_16x-8 442.19 MB/s 613.29 MB/s 1.39x BenchmarkShake256_1MiB-8 548.46 MB/s 810.95 MB/s 1.48x BenchmarkSha3_512_1MiB-8 299.91 MB/s 452.39 MB/s 1.51x

Result from 'benchstat' name old time/op new time/op delta PermutationFunction-8 306ns ± 2% 153ns ± 0% -49.98% (p=0.000 n=10+10)

name old speed new speed delta PermutationFunction-8 654MB/s ± 2% 1308MB/s ± 0% +99.91% (p=0.000 n=10+10)

name old alloc/op new alloc/op delta PermutationFunction-8 0.00B 0.00B ~ (all equal)

name old allocs/op new allocs/op delta PermutationFunction-8 0.00 0.00 ~ (all equal)

Change-Id: I7e24f5c44ef96e1301190db6a21add407ce13af0 GitHub-Last-Rev: acc175a571ba458b4a57a5ffd8abaa54401d22fd GitHub-Pull-Request: golang/crypto#182

howjmay avatar May 11 '21 16:05 howjmay

This PR (HEAD: e1651ccc3bbdecc8b08f071e8c7cb24fd222d797) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 11 '21 16:05 gopherbot

Message from Go Bot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps: A maintainer will review your change and provide feedback. See https://golang.org/doc/contribute.html#review for more info and tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be surprising to people new to the project. The careful, iterative review process is our way of helping mentor contributors and ensuring that their contributions have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which little code gets reviewed or merged. If a reviewer responds with a comment like R=go1.11 or adds a tag like "wait-release", it means that this CL will be reviewed as part of the next development cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar May 11 '21 16:05 gopherbot

This PR (HEAD: 417caef05b85c313d10fd635028a4409340bf581) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 11 '21 16:05 gopherbot

This PR (HEAD: f4b87effdbdd6a795baf09a8890364ffa2ecc985) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 11 '21 16:05 gopherbot

This PR (HEAD: e8fb822497146fe7628a4358d05270af09c96830) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 03:05 gopherbot

This PR (HEAD: 4383406a09e2ea76a78779dee5ef3d71ab1c64b5) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 03:05 gopherbot

This PR (HEAD: 3b1cf3eeacf38a34d69b324b7a9ce1d841d749ef) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 08:05 gopherbot

This PR (HEAD: f9939272d7215d7aec73827ded3166d66b64836e) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 09:05 gopherbot

Message from Ian Lance Taylor:

Patch Set 7:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar May 12 '21 14:05 gopherbot

This PR (HEAD: a2230417939042164f8a63f6a142a27d4d0e9a40) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 15:05 gopherbot

This PR (HEAD: 7a572dc17bbbe485256f3ff0419f6472fc766551) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 15:05 gopherbot

This PR (HEAD: 7a6265e5cbeeffb13d78b836c62c991cec20f9ee) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 15:05 gopherbot

This PR (HEAD: 080b16703c5255febf50060d8bd481b366d02ee3) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 16:05 gopherbot

Message from Hau Yang:

Patch Set 11:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar May 12 '21 16:05 gopherbot

This PR (HEAD: 48dd072cfc146f92c93b39f85dfa54ca8cd02752) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 16:05 gopherbot

This PR (HEAD: 02cef39fdc38146e40eb2b29dd0423f5af52b005) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 12 '21 16:05 gopherbot

This PR (HEAD: 98411748156c6515fb382bb5fb04378a39b799a4) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar May 13 '21 02:05 gopherbot

Message from Hau Yang:

Patch Set 14:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar May 13 '21 14:05 gopherbot

This PR (HEAD: c7fb578b84e4d1a306c8a206ec5f32df560a16da) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar Jun 06 '21 11:06 gopherbot

This PR (HEAD: 0c6642e4356ac6a1e9c7060dd8e19d117d52f319) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar Jul 04 '21 03:07 gopherbot

This PR (HEAD: d9aa0f18796167803acec3da750850cb72e57708) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/crypto/+/318869 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar Jul 04 '21 04:07 gopherbot

Message from Hau Yang:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Aug 21 '21 09:08 gopherbot

Message from Hau Yang:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Sep 20 '21 07:09 gopherbot

Message from Meng Zhuo:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Sep 20 '21 12:09 gopherbot

Message from Hau Yang:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Sep 20 '21 15:09 gopherbot

Message from Hau Yang:

Patch Set 11:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Nov 08 '21 11:11 gopherbot

Message from Hau Yang:

Patch Set 14:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Nov 08 '21 11:11 gopherbot

Message from Hau Yang:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Nov 08 '21 11:11 gopherbot

Message from Hau Yang:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Nov 08 '21 11:11 gopherbot

Message from Meng Zhuo:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/318869. After addressing review feedback, remember to publish your drafts!

gopherbot avatar Nov 08 '21 11:11 gopherbot