Skip to content

Commit 175cd52

Browse files
authored
deps: enable AVX-512 OpenSSL asm with clang
Node.js ships two pre-generated sets of OpenSSL assembly: `asm`, which contains the AVX-512 routines, and `asm_avx2`, which does not. The set is picked in deps/openssl/openssl.gyp based on `gas_version` or `nasm_version`, but configure.py only reports `gas_version` when the compiler is not clang, because clang uses its own integrated assembler and has no GNU assembler version to report. Consequently every clang build silently falls back to the AVX-512-less `asm_avx2` set, with no warning. The result is that `ossl_vaes_vpclmulqdq_capable()` is assembled as a stub that always returns 0, so OpenSSL never selects `ossl_aes_gcm_encrypt_avx512()` and uses the older AES-NI path instead. On an Intel Xeon Gold 6548N this costs roughly 1.6x on AES-256-GCM and 1.8x on both ChaCha20-Poly1305 and RSA-2048 signing. This is not limited to custom builds: BUILDING.md documents that the official linux-x64 binaries are produced with clang, and the shipped v25.x and v26.x binaries contain the stub. Accept `llvm_version` in the condition, the way deps/openssl/openssl.gypi already does for the AVX2 set. clang's integrated assembler has handled AVX512IFMA since 3.9 and VAES / VPCLMULQDQ since 6.0; 8.0 is used as a conservative floor, well below the clang 19.1 that Node.js already requires. PR-URL: #65136 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 2fa068a commit 175cd52

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

deps/openssl/openssl.gyp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
# VC-WIN64-ARM inherits from VC-noCE-common that has no asms.
3737
'includes': ['./openssl_no_asm.gypi'],
3838
}, 'gas_version and v(gas_version) >= v("2.26") or '
39-
'nasm_version and v(nasm_version) >= v("2.11.8")', {
39+
'nasm_version and v(nasm_version) >= v("2.11.8") or '
40+
'llvm_version and v(llvm_version) >= v("8.0")', {
4041
# Require AVX512IFMA supported. See
4142
# https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html
4243
# Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA.
@@ -114,7 +115,8 @@
114115
# VC-WIN64-ARM inherits from VC-noCE-common that has no asms.
115116
'includes': ['./openssl-fips_no_asm.gypi'],
116117
}, 'gas_version and v(gas_version) >= v("2.26") or '
117-
'nasm_version and v(nasm_version) >= v("2.11.8")', {
118+
'nasm_version and v(nasm_version) >= v("2.11.8") or '
119+
'llvm_version and v(llvm_version) >= v("8.0")', {
118120
# Require AVX512IFMA supported. See
119121
# https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html
120122
# Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA.

0 commit comments

Comments
 (0)