Repository navigation
New 3-way batched Keccak-f1600 (x3) improves ML-DSA performance by 2.5 to 13.0% on Neoverse V3 - #1489
soumya2094 wants to merge 8 commits into
Conversation
CBMC Results (ML-DSA-65, REDUCE-RAM)
Full Results (245 configurations)
|
CBMC Results (ML-DSA-87, REDUCE-RAM)
Full Results (245 configurations)
|
CBMC Results (ML-DSA-44, REDUCE-RAM)
Full Results (245 configurations)
|
CBMC Results (ML-DSA-44)
Full Results (245 configurations)
|
CBMC Results (ML-DSA-65)
Full Results (245 configurations)
|
CBMC Results (ML-DSA-87)
Full Results (245 configurations)
|
5197c8b to
d3db6bf
Compare
oqs-bot
left a comment
There was a problem hiding this comment.
Intel Xeon 4th gen (c7i)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
43680 cycles |
43892 cycles |
1.00 |
ML-DSA-44 sign |
130377 cycles |
130352 cycles |
1.00 |
ML-DSA-44 verify |
45029 cycles |
45321 cycles |
0.99 |
ML-DSA-65 keypair |
75946 cycles |
74796 cycles |
1.02 |
ML-DSA-65 sign |
212592 cycles |
212052 cycles |
1.00 |
ML-DSA-65 verify |
74260 cycles |
74687 cycles |
0.99 |
ML-DSA-87 keypair |
123762 cycles |
124114 cycles |
1.00 |
ML-DSA-87 sign |
271004 cycles |
271590 cycles |
1.00 |
ML-DSA-87 verify |
120269 cycles |
120181 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Intel Xeon 4th gen (c7i) (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
91928 cycles |
91784 cycles |
1.00 |
ML-DSA-44 sign |
349226 cycles |
347134 cycles |
1.01 |
ML-DSA-44 verify |
99353 cycles |
99097 cycles |
1.00 |
ML-DSA-65 keypair |
155553 cycles |
155539 cycles |
1.00 |
ML-DSA-65 sign |
568211 cycles |
568531 cycles |
1.00 |
ML-DSA-65 verify |
159741 cycles |
159884 cycles |
1.00 |
ML-DSA-87 keypair |
257558 cycles |
258198 cycles |
1.00 |
ML-DSA-87 sign |
720923 cycles |
721227 cycles |
1.00 |
ML-DSA-87 verify |
263802 cycles |
263911 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
AMD EPYC 4th gen (c7a)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
48013 cycles |
47813 cycles |
1.00 |
ML-DSA-44 sign |
139567 cycles |
139235 cycles |
1.00 |
ML-DSA-44 verify |
49580 cycles |
49422 cycles |
1.00 |
ML-DSA-65 keypair |
83610 cycles |
82246 cycles |
1.02 |
ML-DSA-65 sign |
227283 cycles |
226854 cycles |
1.00 |
ML-DSA-65 verify |
82430 cycles |
82296 cycles |
1.00 |
ML-DSA-87 keypair |
133550 cycles |
143586 cycles |
0.93 |
ML-DSA-87 sign |
281368 cycles |
297737 cycles |
0.95 |
ML-DSA-87 verify |
129022 cycles |
135636 cycles |
0.95 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
AMD EPYC 4th gen (c7a) (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
115181 cycles |
115553 cycles |
1.00 |
ML-DSA-44 sign |
420451 cycles |
420266 cycles |
1.00 |
ML-DSA-44 verify |
123976 cycles |
123836 cycles |
1.00 |
ML-DSA-65 keypair |
201173 cycles |
195371 cycles |
1.03 |
ML-DSA-65 sign |
702261 cycles |
681845 cycles |
1.03 |
ML-DSA-65 verify |
206914 cycles |
199906 cycles |
1.04 |
ML-DSA-87 keypair |
327447 cycles |
323445 cycles |
1.01 |
ML-DSA-87 sign |
876520 cycles |
865156 cycles |
1.01 |
ML-DSA-87 verify |
332860 cycles |
329502 cycles |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
AMD EPYC 3rd gen (c6a)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
52571 cycles |
52581 cycles |
1.00 |
ML-DSA-44 sign |
156199 cycles |
156021 cycles |
1.00 |
ML-DSA-44 verify |
54209 cycles |
54219 cycles |
1.00 |
ML-DSA-65 keypair |
91040 cycles |
90741 cycles |
1.00 |
ML-DSA-65 sign |
256089 cycles |
253497 cycles |
1.01 |
ML-DSA-65 verify |
90875 cycles |
89864 cycles |
1.01 |
ML-DSA-87 keypair |
145090 cycles |
144894 cycles |
1.00 |
ML-DSA-87 sign |
310415 cycles |
310365 cycles |
1.00 |
ML-DSA-87 verify |
138916 cycles |
138533 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'AMD EPYC 4th gen (c7a) (no-opt)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.03.
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-65 verify |
206914 cycles |
199906 cycles |
1.04 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton5
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
47615 cycles |
52381 cycles |
0.91 |
ML-DSA-44 sign |
161328 cycles |
162344 cycles |
0.99 |
ML-DSA-44 verify |
51792 cycles |
54748 cycles |
0.95 |
ML-DSA-65 keypair |
78694 cycles |
91462 cycles |
0.86 |
ML-DSA-65 sign |
251056 cycles |
266209 cycles |
0.94 |
ML-DSA-65 verify |
78812 cycles |
89927 cycles |
0.88 |
ML-DSA-87 keypair |
133145 cycles |
147757 cycles |
0.90 |
ML-DSA-87 sign |
315602 cycles |
335735 cycles |
0.94 |
ML-DSA-87 verify |
131890 cycles |
145717 cycles |
0.91 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Intel Xeon 3rd gen (c6i)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
63794 cycles |
63972 cycles |
1.00 |
ML-DSA-44 sign |
193152 cycles |
192594 cycles |
1.00 |
ML-DSA-44 verify |
68112 cycles |
68102 cycles |
1.00 |
ML-DSA-65 keypair |
110758 cycles |
110499 cycles |
1.00 |
ML-DSA-65 sign |
319862 cycles |
317866 cycles |
1.01 |
ML-DSA-65 verify |
111940 cycles |
111858 cycles |
1.00 |
ML-DSA-87 keypair |
174282 cycles |
174451 cycles |
1.00 |
ML-DSA-87 sign |
383099 cycles |
382753 cycles |
1.00 |
ML-DSA-87 verify |
173065 cycles |
172460 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
AMD EPYC 3rd gen (c6a) (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
133501 cycles |
133932 cycles |
1.00 |
ML-DSA-44 sign |
520671 cycles |
521267 cycles |
1.00 |
ML-DSA-44 verify |
146039 cycles |
146376 cycles |
1.00 |
ML-DSA-65 keypair |
224039 cycles |
223907 cycles |
1.00 |
ML-DSA-65 sign |
847408 cycles |
847623 cycles |
1.00 |
ML-DSA-65 verify |
234055 cycles |
233902 cycles |
1.00 |
ML-DSA-87 keypair |
370647 cycles |
369652 cycles |
1.00 |
ML-DSA-87 sign |
1060600 cycles |
1060611 cycles |
1.00 |
ML-DSA-87 verify |
381641 cycles |
381015 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton5 (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
104029 cycles |
101790 cycles |
1.02 |
ML-DSA-44 sign |
373735 cycles |
372835 cycles |
1.00 |
ML-DSA-44 verify |
111277 cycles |
111489 cycles |
1.00 |
ML-DSA-65 keypair |
178286 cycles |
177590 cycles |
1.00 |
ML-DSA-65 sign |
624867 cycles |
605385 cycles |
1.03 |
ML-DSA-65 verify |
178378 cycles |
180402 cycles |
0.99 |
ML-DSA-87 keypair |
284291 cycles |
286904 cycles |
0.99 |
ML-DSA-87 sign |
758407 cycles |
771012 cycles |
0.98 |
ML-DSA-87 verify |
296244 cycles |
296923 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Graviton5 (no-opt)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.03.
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-65 sign |
624867 cycles |
605385 cycles |
1.03 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Intel Xeon 3rd gen (c6i) (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
167628 cycles |
164444 cycles |
1.02 |
ML-DSA-44 sign |
637332 cycles |
613041 cycles |
1.04 |
ML-DSA-44 verify |
182921 cycles |
178255 cycles |
1.03 |
ML-DSA-65 keypair |
281401 cycles |
276679 cycles |
1.02 |
ML-DSA-65 sign |
1025048 cycles |
986251 cycles |
1.04 |
ML-DSA-65 verify |
290195 cycles |
285766 cycles |
1.02 |
ML-DSA-87 keypair |
462971 cycles |
465364 cycles |
0.99 |
ML-DSA-87 sign |
1273807 cycles |
1272841 cycles |
1.00 |
ML-DSA-87 verify |
473739 cycles |
477079 cycles |
0.99 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton4
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
68336 cycles |
68548 cycles |
1.00 |
ML-DSA-44 sign |
198908 cycles |
198745 cycles |
1.00 |
ML-DSA-44 verify |
70491 cycles |
70395 cycles |
1.00 |
ML-DSA-65 keypair |
120427 cycles |
120272 cycles |
1.00 |
ML-DSA-65 sign |
326099 cycles |
326165 cycles |
1.00 |
ML-DSA-65 verify |
117011 cycles |
117105 cycles |
1.00 |
ML-DSA-87 keypair |
198499 cycles |
198169 cycles |
1.00 |
ML-DSA-87 sign |
422021 cycles |
421826 cycles |
1.00 |
ML-DSA-87 verify |
193723 cycles |
193692 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Intel Xeon 3rd gen (c6i) (no-opt)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.03.
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 sign |
637332 cycles |
613041 cycles |
1.04 |
ML-DSA-65 sign |
1025048 cycles |
986251 cycles |
1.04 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton4 (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
129797 cycles |
129893 cycles |
1.00 |
ML-DSA-44 sign |
444007 cycles |
444053 cycles |
1.00 |
ML-DSA-44 verify |
137962 cycles |
137741 cycles |
1.00 |
ML-DSA-65 keypair |
227324 cycles |
226863 cycles |
1.00 |
ML-DSA-65 sign |
718269 cycles |
717850 cycles |
1.00 |
ML-DSA-65 verify |
223034 cycles |
222758 cycles |
1.00 |
ML-DSA-87 keypair |
369617 cycles |
368612 cycles |
1.00 |
ML-DSA-87 sign |
923542 cycles |
918892 cycles |
1.01 |
ML-DSA-87 verify |
374434 cycles |
373208 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Arm Cortex-A76 (Raspberry Pi 5) benchmarks (opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
113409 cycles |
113367 cycles |
1.00 |
ML-DSA-44 sign |
354615 cycles |
354349 cycles |
1.00 |
ML-DSA-44 verify |
117337 cycles |
117187 cycles |
1.00 |
ML-DSA-65 keypair |
195445 cycles |
195613 cycles |
1.00 |
ML-DSA-65 sign |
583606 cycles |
583472 cycles |
1.00 |
ML-DSA-65 verify |
193220 cycles |
192998 cycles |
1.00 |
ML-DSA-87 keypair |
322156 cycles |
322109 cycles |
1.00 |
ML-DSA-87 sign |
746769 cycles |
747503 cycles |
1.00 |
ML-DSA-87 verify |
317803 cycles |
317934 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton3
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
72327 cycles |
72458 cycles |
1.00 |
ML-DSA-44 sign |
209805 cycles |
210057 cycles |
1.00 |
ML-DSA-44 verify |
74806 cycles |
74904 cycles |
1.00 |
ML-DSA-65 keypair |
126707 cycles |
126792 cycles |
1.00 |
ML-DSA-65 sign |
345011 cycles |
345502 cycles |
1.00 |
ML-DSA-65 verify |
124083 cycles |
124401 cycles |
1.00 |
ML-DSA-87 keypair |
208206 cycles |
207975 cycles |
1.00 |
ML-DSA-87 sign |
439777 cycles |
444575 cycles |
0.99 |
ML-DSA-87 verify |
204510 cycles |
204246 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Arm Cortex-A76 (Raspberry Pi 5) benchmarks (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
210377 cycles |
210851 cycles |
1.00 |
ML-DSA-44 sign |
756533 cycles |
757357 cycles |
1.00 |
ML-DSA-44 verify |
227405 cycles |
227295 cycles |
1.00 |
ML-DSA-65 keypair |
372911 cycles |
373515 cycles |
1.00 |
ML-DSA-65 sign |
1240327 cycles |
1240923 cycles |
1.00 |
ML-DSA-65 verify |
368410 cycles |
368246 cycles |
1.00 |
ML-DSA-87 keypair |
597217 cycles |
596578 cycles |
1.00 |
ML-DSA-87 sign |
1576029 cycles |
1577517 cycles |
1.00 |
ML-DSA-87 verify |
610623 cycles |
611193 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton3 (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
140635 cycles |
140841 cycles |
1.00 |
ML-DSA-44 sign |
490204 cycles |
490852 cycles |
1.00 |
ML-DSA-44 verify |
151190 cycles |
151175 cycles |
1.00 |
ML-DSA-65 keypair |
247166 cycles |
246563 cycles |
1.00 |
ML-DSA-65 sign |
797577 cycles |
796889 cycles |
1.00 |
ML-DSA-65 verify |
244622 cycles |
244245 cycles |
1.00 |
ML-DSA-87 keypair |
400731 cycles |
400472 cycles |
1.00 |
ML-DSA-87 sign |
1023606 cycles |
1019557 cycles |
1.00 |
ML-DSA-87 verify |
408186 cycles |
407941 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton2
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
113649 cycles |
113660 cycles |
1.00 |
ML-DSA-44 sign |
354617 cycles |
355176 cycles |
1.00 |
ML-DSA-44 verify |
117273 cycles |
117527 cycles |
1.00 |
ML-DSA-65 keypair |
195628 cycles |
195686 cycles |
1.00 |
ML-DSA-65 sign |
583751 cycles |
584392 cycles |
1.00 |
ML-DSA-65 verify |
193138 cycles |
193432 cycles |
1.00 |
ML-DSA-87 keypair |
322592 cycles |
323313 cycles |
1.00 |
ML-DSA-87 sign |
748993 cycles |
747941 cycles |
1.00 |
ML-DSA-87 verify |
318836 cycles |
318438 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton2 (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
210432 cycles |
210813 cycles |
1.00 |
ML-DSA-44 sign |
757046 cycles |
757480 cycles |
1.00 |
ML-DSA-44 verify |
227990 cycles |
227902 cycles |
1.00 |
ML-DSA-65 keypair |
373700 cycles |
373594 cycles |
1.00 |
ML-DSA-65 sign |
1242366 cycles |
1242050 cycles |
1.00 |
ML-DSA-65 verify |
369338 cycles |
369085 cycles |
1.00 |
ML-DSA-87 keypair |
598551 cycles |
597718 cycles |
1.00 |
ML-DSA-87 sign |
1597278 cycles |
1577558 cycles |
1.01 |
ML-DSA-87 verify |
610865 cycles |
611383 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Arm Cortex-M55 (NUCLEO-N657X0-Q) benchmarks (opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
2134310 cycles |
2134310 cycles |
1 |
ML-DSA-44 sign |
17791748 cycles |
17791748 cycles |
1 |
ML-DSA-44 verify |
2398890 cycles |
2398890 cycles |
1 |
ML-DSA-65 keypair |
3732866 cycles |
3732866 cycles |
1 |
ML-DSA-65 sign |
15034558 cycles |
15034558 cycles |
1 |
ML-DSA-65 verify |
4012806 cycles |
4012806 cycles |
1 |
ML-DSA-87 keypair |
6516715 cycles |
6516715 cycles |
1 |
ML-DSA-87 sign |
25055900 cycles |
25055900 cycles |
1 |
ML-DSA-87 verify |
6865674 cycles |
6865674 cycles |
1 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Arm Cortex-M55 (NUCLEO-N657X0-Q) benchmarks (no-opt)
Details
| Benchmark suite | Current: d3db6bf | Previous: d7b1b6d | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
2332104 cycles |
2332104 cycles |
1 |
ML-DSA-44 sign |
17791726 cycles |
17791726 cycles |
1 |
ML-DSA-44 verify |
2398861 cycles |
2398861 cycles |
1 |
ML-DSA-65 keypair |
4028005 cycles |
4028005 cycles |
1 |
ML-DSA-65 sign |
15034565 cycles |
15034565 cycles |
1 |
ML-DSA-65 verify |
4012799 cycles |
4012799 cycles |
1 |
ML-DSA-87 keypair |
6896513 cycles |
6896513 cycles |
1 |
ML-DSA-87 sign |
25049115 cycles |
25049115 cycles |
1 |
ML-DSA-87 verify |
6864412 cycles |
6864412 cycles |
1 |
This comment was automatically generated by workflow using github-action-benchmark.
d3db6bf to
a59eb86
Compare
Port the symbolic Keccak-f1600 sources and SLOTHY recipes from mlkem-native, so that `autogen --slothy` regenerates the existing x1 and x4 kernels and the SLOTHY CI job tests them. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Add an opt-in 3-way Keccak-f1600 (MLD_CONFIG_USE_X3) with a C fallback and an AArch64 kernel that runs two states on Neon with SHA3 and one on scalar registers. It targets cores that issue SHA3 on all SIMD pipes, such as Neoverse V3. Default builds are unchanged. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Prove functional correctness, ABI compliance, memory safety and constant-time behaviour of the x3 kernel, following the x4 v84a proof. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Sample three polynomials per XOF call when MLD_CONFIG_USE_X3 is set (Batch ExpandA, ExpandS and ExpandMask). Nonces are unchanged, so outputs match the default path. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Mirror the existing proofs for the x3 primitives, samplers and callers, built with MLD_CONFIG_USE_X3. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Run the x3 config variation and the x3_v84a_scalar backend tests, and test the regenerated x3 kernel in the SLOTHY job. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
Use MLD_CONFIG_USE_X3 instead of MLD_SYS_AARCH64_FAST_SHA3, which would select x2_v84a ahead of x3. Signed-off-by: Soumya Bhattacharya <somoamz@amazon.com>
a59eb86 to
b622325
Compare
This PR adds a new 3-way Keccak-f1600 batching (x3) for Neoverse V3 cores by exploiting the optimized SHA3 hashing. It is aimed at cores that execute the Armv8.4-A SHA3 instructions on all SIMD pipes (e.g. Neoverse V3). It is off by default (
MLD_CONFIG_USE_X3). The assembly and its HOL Light proof are included.The PR also makes mldsa-native's FIPS202 AArch64 development tree structurally consistent with mlkem-native: it adds the symbolic (clean) Keccak-f1600 sources in
dev/fips202/aarch64_symbolic/and the SLOTHY recipes indev/fips202/aarch64/src/Makefile, and enablesautogen --slothyfor the Keccak kernels. With this, the existing x4 kernels and the new x3 kernel can be regenerated from their symbolic sources, reproducing the committed machine code exactly.What it adds
keccak_f1600_x3_v8a_v84a_scalar_hybrid_aarch64_asm: two Keccak states on Neon (SHA3 instructions), one state on scalar registers with lazy rotations, one scalar and one vector round per iteration in a single pass. Scheduled with SLOTHY (interleaving only) from the symbolic sourcedev/fips202/aarch64_symbolic/keccak_f1600_x3_v8a_v84a_scalar_hybrid_clean.S; the recipe is indev/fips202/aarch64/src/Makefile(autogen --slothy keccak_f1600_x3_v8a_v84a_scalar_hybrid_aarch64_asm) and regenerates the committed kernel.proofs/hol_light/aarch64/proofs/keccak_f1600_x3_v8a_v84a_scalar_hybrid_aarch64_asm.ml):_CORRECT,_SUBROUTINE_CORRECT): the kernel computes the full 24-round Keccak-f[1600] permutation on each of the three 200-byte states. Called as a C function, it also preserves all registers the calling convention requires and writes no memory other than the 600-byte state buffer and its own 224-byte stack frame._SUBROUTINE_SAFE: memory safety and secret-independent timing (mk_safety_spec), with an x3 entrysha3_keccak3_f1600_altinsubroutine_signatures.ml, named similar to the existing x4 entrysha3_keccak4_f1600_alt.x3_v8a_v84a_scalar.h, selection inauto.hunderMLD_CONFIG_USE_X3.MLD_CONFIG_USE_X3. Every polynomial keeps its FIPS 204 nonce, so outputs are byte-identical to the default path.MLD_CONFIG_REDUCE_RAM.test/configs/x3_keccak_config.h; component benchmark rows for the x3 permute and samplers, plus x4 baselines (keccakf1600x4_permute,poly_uniform_4x,poly_uniform_gamma1_4x).x3-keccakconfig variation (native x3 on AArch64, C fallback elsewhere) andx3_v8a_v84a_scalarin the AArch64 backend matrix.Commits (each builds and passes format / autogen / func / KAT / examples):
Notes on Commit 0: FIPS202 symbolic sources and SLOTHY recipes (parity with mlkem-native)
The mldsa-native did not carry the symbolic/clean sources from which its AArch64 Keccak-f1600 kernels are generated, nor the SLOTHY recipes. The
autogen --slothyhad a keccak code path that could not be reached. This commit brings the FIPS202 AArch64 tree in line with mlkem-native (commita7914d4):dev/fips202/aarch64_symbolic/:keccak_f1600_x1_scalar_symbolic.S,keccak_f1600_x4_v8a_scalar_hybrid_clean.S,keccak_f1600_x4_v8a_v84a_scalar_hybrid_clean.S.dev/fips202/aarch64/src/Makefile: mlkem-native'sslothy-clirecipes ported over to mldsa-native.scripts/autogen: the three kernels added to--slothy, similar to mlkem-native.The shipped kernels are unchanged. Running
autogen --slothywith these recipes regenerates kernels similar to the committed ones.Testing
MLD_CONFIG_USE_X3on Neoverse V1, V2 and V3 (native AArch64). On x86_64, where there is no x3 assembly and the 3-way permutation falls back to three calls of the C permutation, func and KAT pass with and withoutMLD_CONFIG_USE_X3.MLD_CONFIG_USE_X3builds compile only the x3 path and link only the x3 kernel.scripts/lint,scripts/format,autogen --dry-runclean.Performance (pinned to one core)
Per component (
bench_components), x3 vs x4 per polynomial / per state (an x3 call handles 3, an x4 call 4; cycles per call for ML-DSA-87 in brackets, x3 vs x4). Neoverse V3: median of 5 runs; V2/V1: one run:poly_uniform_3xvs_4x)poly_uniform_eta_3xvs_4x)poly_uniform_gamma1_3xvs_4x)End to end, x3 vs x4 (KeyGen/Verify:
bench_mldsaaverage; Sign: change in median cycles over 20,000 signs with identical key/message/randomness in both builds, paired Wilcoxon signed-rank p < 0.001):x3 only pays off where SHA3 runs on all SIMD pipes (Neoverse V3); elsewhere it is slower, hence opt-in only.
Reproduce:
make bench_components_87 OPT=1 AUTO=1 CYCLES=PERFandmake bench_87 …, once with the default config and once with-DMLD_CONFIG_USE_X3.Feedback welcome
x3 is enabled with the config option
MLD_CONFIG_USE_X3(off by default). Note that the option also switches ExpandA/ExpandS/ExpandMask to 3-way batching on other platforms; on Neoverse V1 and V2 the default x4 is faster, and without a native x3 kernel the 3-way Keccak runs as three single-state permutations. Feedback on the C integration approach is welcome. The current implementation is functional, but the 3-way FIPS202 layer and samplers largely duplicate their 4-way counterparts; a single code path parameterised by the batch width (3 or 4) would be preferable, and suggestions on this proposal are welcome.