Implementation notes: amd64, hertz, crypto_sign/dilithium2

Computer: hertz
Microarchitecture: amd64; Zen 4 (a60f12)
Architecture: amd64
CPU ID: AuthenticAMD-00a60f12-178bfbff
SUPERCOP version: 20240716
Operation: crypto_sign
Primitive: dilithium2
TimeObject sizeTest sizeImplementationCompilerBenchmark dateSUPERCOP version
269241128387 64 0160769 916 1832avx2clang_-march=native_-O2_-fwrapv_-Qunused-arguments_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
269378124314 64 0156785 916 1832avx2clang_-march=native_-O3_-fwrapv_-Qunused-arguments_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
28329176457 64 0102963 908 1832avx2clang_-march=native_-Os_-fwrapv_-Qunused-arguments_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
293617104446 64 0133140 892 1896avx2gcc_-march=native_-mtune=native_-O3_-fwrapv_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
29548165218 64 091948 892 1832avx2gcc_-march=native_-mtune=native_-O2_-fwrapv_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
29950958999 64 084172 884 1800avx2gcc_-march=native_-mtune=native_-Os_-fwrapv_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
137985318703 0 045667 836 1832refclang_-march=native_-Os_-fwrapv_-Qunused-arguments_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
139679380047 0 0112377 844 1832refclang_-march=native_-O3_-fwrapv_-Qunused-arguments_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
139953276747 0 0108953 844 1832refclang_-march=native_-O2_-fwrapv_-Qunused-arguments_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
140182161379 0 090060 820 1896refgcc_-march=native_-mtune=native_-O3_-fwrapv_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
144149122228 0 048852 820 1832refgcc_-march=native_-mtune=native_-O2_-fwrapv_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716
159788218747 0 043860 812 1800refgcc_-march=native_-mtune=native_-Os_-fwrapv_-fPIC_-fPIE_-gdwarf-4_-Wall2024071620240716

Compiler output


rejsample.c: rejsample.c:316:62: warning: argument 'buf' of type 'const uint8_t[168]' (aka 'const unsigned char[168]') with mismatched bound [-Warray-parameter]
rejsample.c:   316 | unsigned int rej_eta_avx(int32_t * restrict r, const uint8_t buf[REJ_UNIFORM_ETA_BUFLEN]) {
rejsample.c:       |                                                              ^
rejsample.c: ./rejsample.h:25:52: note: previously declared as 'const uint8_t[840]' (aka 'const unsigned char[840]') here
rejsample.c:    25 | unsigned int rej_eta_avx(int32_t *r, const uint8_t buf[REJ_UNIFORM_BUFLEN]);
rejsample.c:       |                                                    ^
rejsample.c: 1 warning generated.

Number of similar (implementation,compiler) pairs: 3, namely:
ImplementationCompiler
avx2clang -march=native -O2 -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))
avx2clang -march=native -O3 -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))
avx2clang -march=native -Os -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))

Compiler output


poly.c: poly.c: In function 'crypto_sign_dilithium2_avx2_constbranchindex_poly_uniform_eta_4x':
poly.c: <command-line>: warning: 'crypto_sign_dilithium2_avx2_constbranchindex_rej_eta_avx' reading 840 bytes from a region of size 768 [-Wstringop-overread]
poly.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
poly.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
poly.c:       |                                ^~~~~~~~~~~~~~~~
poly.c: rejsample.h:24:21: note: in expansion of macro 'DILITHIUM_NAMESPACE'
poly.c:    24 | #define rej_eta_avx DILITHIUM_NAMESPACE(rej_eta_avx)
poly.c:       |                     ^~~~~~~~~~~~~~~~~~~
poly.c: poly.c:594:10: note: in expansion of macro 'rej_eta_avx'
poly.c:   594 |   ctr0 = rej_eta_avx(a0->coeffs, buf[0].coeffs);
poly.c:       |          ^~~~~~~~~~~
poly.c: <command-line>: note: referencing argument 2 of type 'const uint8_t[840]' {aka 'const unsigned char[840]'}
poly.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
poly.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
poly.c:       |                                ^~~~~~~~~~~~~~~~
poly.c: rejsample.h:24:21: note: in expansion of macro 'DILITHIUM_NAMESPACE'
poly.c:    24 | #define rej_eta_avx DILITHIUM_NAMESPACE(rej_eta_avx)
poly.c:       |                     ^~~~~~~~~~~~~~~~~~~
poly.c: poly.c:594:10: note: in expansion of macro 'rej_eta_avx'
poly.c:   594 |   ctr0 = rej_eta_avx(a0->coeffs, buf[0].coeffs);
poly.c:       |          ^~~~~~~~~~~
poly.c: <command-line>: note: in a call to function 'crypto_sign_dilithium2_avx2_constbranchindex_rej_eta_avx'
poly.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
poly.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
poly.c:       |                                ^~~~~~~~~~~~~~~~
poly.c: ...
polyvec.c: polyvec.c: In function 'crypto_sign_dilithium2_avx2_constbranchindex_polyvecl_uniform_gamma1':
polyvec.c: <command-line>: warning: 'crypto_sign_dilithium2_avx2_constbranchindex_poly_uniform_gamma1' reading 48 bytes from a region of size 32 [-Wstringop-overread]
polyvec.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
polyvec.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
polyvec.c:       |                                ^~~~~~~~~~~~~~~~
polyvec.c: poly.h:55:29: note: in expansion of macro 'DILITHIUM_NAMESPACE'
polyvec.c:    55 | #define poly_uniform_gamma1 DILITHIUM_NAMESPACE(poly_uniform_gamma1)
polyvec.c:       |                             ^~~~~~~~~~~~~~~~~~~
polyvec.c: polyvec.c:279:5: note: in expansion of macro 'poly_uniform_gamma1'
polyvec.c:   279 |     poly_uniform_gamma1(&v->vec[i], seed, L*nonce + i);
polyvec.c:       |     ^~~~~~~~~~~~~~~~~~~
polyvec.c: <command-line>: note: referencing argument 2 of type 'const uint8_t[48]' {aka 'const unsigned char[48]'}
polyvec.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
polyvec.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
polyvec.c:       |                                ^~~~~~~~~~~~~~~~
polyvec.c: poly.h:55:29: note: in expansion of macro 'DILITHIUM_NAMESPACE'
polyvec.c:    55 | #define poly_uniform_gamma1 DILITHIUM_NAMESPACE(poly_uniform_gamma1)
polyvec.c:       |                             ^~~~~~~~~~~~~~~~~~~
polyvec.c: polyvec.c:279:5: note: in expansion of macro 'poly_uniform_gamma1'
polyvec.c:   279 |     poly_uniform_gamma1(&v->vec[i], seed, L*nonce + i);
polyvec.c:       |     ^~~~~~~~~~~~~~~~~~~
polyvec.c: <command-line>: note: in a call to function 'crypto_sign_dilithium2_avx2_constbranchindex_poly_uniform_gamma1'
polyvec.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
polyvec.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
polyvec.c:       |                                ^~~~~~~~~~~~~~~~
polyvec.c: ...
rejsample.c: rejsample.c:316:62: warning: argument 2 of type 'const uint8_t[168]' {aka 'const unsigned char[168]'} with mismatched bound [-Warray-parameter=]
rejsample.c:   316 | unsigned int rej_eta_avx(int32_t * restrict r, const uint8_t buf[REJ_UNIFORM_ETA_BUFLEN]) {
rejsample.c:       |                                                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
rejsample.c: In file included from rejsample.c:4:
rejsample.c: rejsample.h:25:52: note: previously declared as 'const uint8_t[840]' {aka 'const unsigned char[840]'}
rejsample.c:    25 | unsigned int rej_eta_avx(int32_t *r, const uint8_t buf[REJ_UNIFORM_BUFLEN]);
rejsample.c:       |                                      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Number of similar (implementation,compiler) pairs: 3, namely:
ImplementationCompiler
avx2gcc -march=native -mtune=native -O2 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
avx2gcc -march=native -mtune=native -O3 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
avx2gcc -march=native -mtune=native -Os -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)

Compiler output


polyvec.c: polyvec.c: In function 'crypto_sign_dilithium2_ref_constbranchindex_polyvecl_uniform_gamma1':
polyvec.c: <command-line>: warning: 'crypto_sign_dilithium2_ref_constbranchindex_poly_uniform_gamma1' reading 48 bytes from a region of size 32 [-Wstringop-overread]
polyvec.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
polyvec.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
polyvec.c:       |                                ^~~~~~~~~~~~~~~~
polyvec.c: poly.h:51:29: note: in expansion of macro 'DILITHIUM_NAMESPACE'
polyvec.c:    51 | #define poly_uniform_gamma1 DILITHIUM_NAMESPACE(poly_uniform_gamma1)
polyvec.c:       |                             ^~~~~~~~~~~~~~~~~~~
polyvec.c: polyvec.c:47:5: note: in expansion of macro 'poly_uniform_gamma1'
polyvec.c:    47 |     poly_uniform_gamma1(&v->vec[i], seed, L*nonce + i);
polyvec.c:       |     ^~~~~~~~~~~~~~~~~~~
polyvec.c: <command-line>: note: referencing argument 2 of type 'const uint8_t[48]' {aka 'const unsigned char[48]'}
polyvec.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
polyvec.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
polyvec.c:       |                                ^~~~~~~~~~~~~~~~
polyvec.c: poly.h:51:29: note: in expansion of macro 'DILITHIUM_NAMESPACE'
polyvec.c:    51 | #define poly_uniform_gamma1 DILITHIUM_NAMESPACE(poly_uniform_gamma1)
polyvec.c:       |                             ^~~~~~~~~~~~~~~~~~~
polyvec.c: polyvec.c:47:5: note: in expansion of macro 'poly_uniform_gamma1'
polyvec.c:    47 |     poly_uniform_gamma1(&v->vec[i], seed, L*nonce + i);
polyvec.c:       |     ^~~~~~~~~~~~~~~~~~~
polyvec.c: <command-line>: note: in a call to function 'crypto_sign_dilithium2_ref_constbranchindex_poly_uniform_gamma1'
polyvec.c: config.h:3:32: note: in expansion of macro 'CRYPTO_NAMESPACE'
polyvec.c:     3 | #define DILITHIUM_NAMESPACE(s) CRYPTO_NAMESPACE(s)
polyvec.c:       |                                ^~~~~~~~~~~~~~~~
polyvec.c: ...

Number of similar (implementation,compiler) pairs: 3, namely:
ImplementationCompiler
refgcc -march=native -mtune=native -O2 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
refgcc -march=native -mtune=native -O3 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
refgcc -march=native -mtune=native -Os -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)

TIMECOP error (can be valgrind bug)


error 111

Process terminating with default action of signal 4 (SIGILL)
 Illegal opcode at address 0x10B066
   at 0x...: core (try-anything.c:61)
   by 0x...: salsa20 (try-anything.c:101)
   by 0x...: testvector (try-anything.c:124)
   by 0x...: myrandom (try-anything.c:132)
   by 0x...: test (try.c:124)
   by 0x...: main (try-anything.c:345)

Number of similar (implementation,compiler) pairs: 2, namely:
ImplementationCompiler
avx2clang -march=native -O2 -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))
refclang -march=native -O2 -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))

TIMECOP error (can be valgrind bug)


error 111

Process terminating with default action of signal 4 (SIGILL)
 Illegal opcode at address 0x10BB84
   at 0x...: salsa20 (try-anything.c:90)
   by 0x...: canary (try-anything.c:148)
   by 0x...: output_prepare (try-anything.c:178)
   by 0x...: test (try.c:126)
   by 0x...: main (try-anything.c:345)

Number of similar (implementation,compiler) pairs: 2, namely:
ImplementationCompiler
avx2clang -march=native -O3 -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))
refclang -march=native -O3 -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))

TIMECOP error (can be valgrind bug)


error 111

Process terminating with default action of signal 4 (SIGILL)
 Illegal opcode at address 0x10A22E
   at 0x...: core (try-anything.c:64)
   by 0x...: salsa20 (try-anything.c:101)
   by 0x...: testvector (try-anything.c:124)
   by 0x...: myrandom (try-anything.c:132)
   by 0x...: test (try.c:124)
   by 0x...: main (try-anything.c:345)

Number of similar (implementation,compiler) pairs: 2, namely:
ImplementationCompiler
avx2clang -march=native -Os -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))
refclang -march=native -Os -fwrapv -Qunused-arguments -fPIC -fPIE -gdwarf-4 -Wall (Ubuntu_Clang_18.1.3_(1ubuntu1))

TIMECOP error (can be valgrind bug)


error 111

Process terminating with default action of signal 4 (SIGILL)
 Illegal opcode at address 0x10A267
   at 0x...: core (try-anything.c:68)
   by 0x...: salsa20.part.0 (try-anything.c:101)
   by 0x...: salsa20 (try-anything.c:85)
   by 0x...: testvector (try-anything.c:124)
   by 0x...: myrandom (try-anything.c:132)
   by 0x...: test (try.c:124)
   by 0x...: main (try-anything.c:345)

Number of similar (implementation,compiler) pairs: 2, namely:
ImplementationCompiler
avx2gcc -march=native -mtune=native -O2 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
refgcc -march=native -mtune=native -O2 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)

TIMECOP error (can be valgrind bug)


error 111

Process terminating with default action of signal 4 (SIGILL)
 Illegal opcode at address 0x10A2BC
   at 0x...: core (try-anything.c:64)
   by 0x...: salsa20 (try-anything.c:101)
   by 0x...: salsa20 (try-anything.c:81)
   by 0x...: testvector (try-anything.c:124)
   by 0x...: myrandom (try-anything.c:132)
   by 0x...: test (try.c:124)
   by 0x...: main (try-anything.c:345)

Number of similar (implementation,compiler) pairs: 2, namely:
ImplementationCompiler
avx2gcc -march=native -mtune=native -O3 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
refgcc -march=native -mtune=native -O3 -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)

TIMECOP error (can be valgrind bug)


error 111

Process terminating with default action of signal 4 (SIGILL)
 Illegal opcode at address 0x10A064
   at 0x...: core (try-anything.c:64)
   by 0x...: salsa20.part.0 (try-anything.c:101)
   by 0x...: salsa20 (try-anything.c:85)
   by 0x...: testvector (try-anything.c:124)
   by 0x...: myrandom (try-anything.c:132)
   by 0x...: test (try.c:124)
   by 0x...: main (try-anything.c:345)

Number of similar (implementation,compiler) pairs: 2, namely:
ImplementationCompiler
avx2gcc -march=native -mtune=native -Os -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)
refgcc -march=native -mtune=native -Os -fwrapv -fPIC -fPIE -gdwarf-4 -Wall (13.2.0)