Skip to content

Commit 13a9e81

Browse files
nodejs-github-botrichardlau
authored andcommitted
deps: update base64 to 0.5.1
PR-URL: #50629 Fixes: #50561 Fixes: #45091 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent b4502d3 commit 13a9e81

31 files changed

+1684
-135
lines changed

deps/base64/base64.gyp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@
4646
'HAVE_SSE42=1',
4747
'HAVE_AVX=1',
4848
'HAVE_AVX2=1',
49+
'HAVE_AVX512=1',
4950
],
5051
'dependencies': [
5152
'base64_ssse3',
5253
'base64_sse41',
5354
'base64_sse42',
5455
'base64_avx',
5556
'base64_avx2',
57+
'base64_avx512',
5658
],
5759
}, {
5860
'sources': [
@@ -61,6 +63,7 @@
6163
'base64/lib/arch/sse42/codec.c',
6264
'base64/lib/arch/avx/codec.c',
6365
'base64/lib/arch/avx2/codec.c',
66+
'base64/lib/arch/avx512/codec.c',
6467
],
6568
}],
6669
],
@@ -162,6 +165,30 @@
162165
],
163166
},
164167

168+
{
169+
'target_name': 'base64_avx512',
170+
'type': 'static_library',
171+
'include_dirs': [ 'base64/include', 'base64/lib' ],
172+
'sources': [ 'base64/lib/arch/avx512/codec.c' ],
173+
'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX512=1' ],
174+
'conditions': [
175+
[ 'OS!="win"', {
176+
'cflags': [ '-mavx512vl', '-mavx512vbmi' ],
177+
'xcode_settings': {
178+
'OTHER_CFLAGS': [ '-mavx512vl', '-mavx512vbmi' ]
179+
},
180+
}, {
181+
'msvs_settings': {
182+
'VCCLCompilerTool': {
183+
'AdditionalOptions': [
184+
'/arch:AVX512'
185+
],
186+
},
187+
},
188+
}],
189+
],
190+
},
191+
165192
{
166193
'target_name': 'base64_neon32',
167194
'type': 'static_library',

deps/base64/base64/.gitignore

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
*.o
2-
bin/base64
3-
lib/config.h
4-
test/benchmark
5-
test/test_base64
6-
7-
# visual studio symbol db, etc.
8-
.vs/
9-
# build directory used by CMakePresets
10-
out/
11-
# private cmake presets
12-
CMakeUserPresets.json
1+
# Intentionally empty

deps/base64/base64/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (POLICY CMP0127)
1717
cmake_policy(SET CMP0127 NEW)
1818
endif()
1919

20-
project(base64 LANGUAGES C VERSION 0.5.0)
20+
project(base64 LANGUAGES C VERSION 0.5.1)
2121

2222
include(GNUInstallDirs)
2323
include(CMakeDependentOption)
@@ -62,6 +62,8 @@ cmake_dependent_option(BASE64_WITH_AVX "add AVX codepath" ON ${_IS_X86} OFF)
6262
add_feature_info(AVX BASE64_WITH_AVX "add AVX codepath")
6363
cmake_dependent_option(BASE64_WITH_AVX2 "add AVX 2 codepath" ON ${_IS_X86} OFF)
6464
add_feature_info(AVX2 BASE64_WITH_AVX2 "add AVX2 codepath")
65+
cmake_dependent_option(BASE64_WITH_AVX512 "add AVX 512 codepath" ON ${_IS_X86} OFF)
66+
add_feature_info(AVX512 BASE64_WITH_AVX512 "add AVX512 codepath")
6567

6668
cmake_dependent_option(BASE64_WITH_NEON32 "add NEON32 codepath" OFF _TARGET_ARCH_arm OFF)
6769
add_feature_info(NEON32 BASE64_WITH_NEON32 "add NEON32 codepath")
@@ -118,6 +120,7 @@ add_library(base64
118120
lib/arch/sse42/codec.c
119121
lib/arch/avx/codec.c
120122
lib/arch/avx2/codec.c
123+
lib/arch/avx512/codec.c
121124

122125
lib/arch/neon32/codec.c
123126
lib/arch/neon64/codec.c
@@ -206,6 +209,7 @@ if (_TARGET_ARCH STREQUAL "x86" OR _TARGET_ARCH STREQUAL "x64")
206209
configure_codec(SSE42 __SSSE4_2__)
207210
configure_codec(AVX)
208211
configure_codec(AVX2)
212+
configure_codec(AVX512)
209213

210214
elseif (_TARGET_ARCH STREQUAL "arm")
211215
set(BASE64_NEON32_CFLAGS "${COMPILE_FLAGS_NEON32}" CACHE STRING "the NEON32 compile flags (for 'lib/arch/neon32/codec.c')")

deps/base64/base64/LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Copyright (c) 2005-2007, Nick Galbreath
2-
Copyright (c) 2013-2019, Alfred Klomp
3-
Copyright (c) 2015-2017, Wojciech Mula
2+
Copyright (c) 2015-2018, Wojciech Muła
43
Copyright (c) 2016-2017, Matthieu Darbois
4+
Copyright (c) 2013-2022, Alfred Klomp
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without

deps/base64/base64/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic
44
OBJCOPY ?= objcopy
55

66
OBJS = \
7+
lib/arch/avx512/codec.o \
78
lib/arch/avx2/codec.o \
89
lib/arch/generic/codec.o \
910
lib/arch/neon32/codec.o \
@@ -16,6 +17,7 @@ OBJS = \
1617
lib/codec_choose.o \
1718
lib/tables/tables.o
1819

20+
HAVE_AVX512 = 0
1921
HAVE_AVX2 = 0
2022
HAVE_NEON32 = 0
2123
HAVE_NEON64 = 0
@@ -26,6 +28,9 @@ HAVE_AVX = 0
2628

2729
# The user should supply compiler flags for the codecs they want to build.
2830
# Check which codecs we're going to include:
31+
ifdef AVX512_CFLAGS
32+
HAVE_AVX512 = 1
33+
endif
2934
ifdef AVX2_CFLAGS
3035
HAVE_AVX2 = 1
3136
endif
@@ -64,7 +69,8 @@ lib/libbase64.o: $(OBJS)
6469
$(OBJCOPY) --keep-global-symbols=lib/exports.txt $@
6570

6671
lib/config.h:
67-
@echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@
72+
@echo "#define HAVE_AVX512 $(HAVE_AVX512)" > $@
73+
@echo "#define HAVE_AVX2 $(HAVE_AVX2)" >> $@
6874
@echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@
6975
@echo "#define HAVE_NEON64 $(HAVE_NEON64)" >> $@
7076
@echo "#define HAVE_SSSE3 $(HAVE_SSSE3)" >> $@
@@ -75,6 +81,7 @@ lib/config.h:
7581
$(OBJS): lib/config.h
7682
$(OBJS): CFLAGS += -Ilib
7783

84+
lib/arch/avx512/codec.o: CFLAGS += $(AVX512_CFLAGS)
7885
lib/arch/avx2/codec.o: CFLAGS += $(AVX2_CFLAGS)
7986
lib/arch/neon32/codec.o: CFLAGS += $(NEON32_CFLAGS)
8087
lib/arch/neon64/codec.o: CFLAGS += $(NEON64_CFLAGS)

deps/base64/base64/README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Build Status](https://github.com/aklomp/base64/actions/workflows/test.yml/badge.svg)](https://github.com/aklomp/base64/actions/workflows/test.yml)
44

55
This is an implementation of a base64 stream encoding/decoding library in C99
6-
with SIMD (AVX2, NEON, AArch64/NEON, SSSE3, SSE4.1, SSE4.2, AVX) and
6+
with SIMD (AVX2, AVX512, NEON, AArch64/NEON, SSSE3, SSE4.1, SSE4.2, AVX) and
77
[OpenMP](http://www.openmp.org) acceleration. It also contains wrapper functions
88
to encode/decode simple length-delimited strings. This library aims to be:
99

@@ -19,6 +19,10 @@ will pick an optimized codec that lets it encode/decode 12 or 24 bytes at a
1919
time, which gives a speedup of four or more times compared to the "plain"
2020
bytewise codec.
2121

22+
AVX512 support is only for encoding at present, utilizing the AVX512 VL and VBMI
23+
instructions. Decoding part reused AVX2 implementations. For CPUs later than
24+
Cannonlake (manufactured in 2018) supports these instructions.
25+
2226
NEON support is hardcoded to on or off at compile time, because portable
2327
runtime feature detection is unavailable on ARM.
2428

@@ -59,6 +63,9 @@ optimizations described by Wojciech Muła in a
5963
[articles](http://0x80.pl/notesen/2016-01-17-sse-base64-decoding.html).
6064
His own code is [here](https://github.com/WojciechMula/toys/tree/master/base64).
6165

66+
The AVX512 encoder is based on code from Wojciech Muła's
67+
[base64simd](https://github.com/WojciechMula/base64simd) library.
68+
6269
The OpenMP implementation was added by Ferry Toth (@htot) from [Exalon Delft](http://www.exalondelft.nl).
6370

6471
## Building
@@ -76,8 +83,8 @@ To compile just the "plain" library without SIMD codecs, type:
7683
make lib/libbase64.o
7784
```
7885

79-
Optional SIMD codecs can be included by specifying the `AVX2_CFLAGS`, `NEON32_CFLAGS`, `NEON64_CFLAGS`,
80-
`SSSE3_CFLAGS`, `SSE41_CFLAGS`, `SSE42_CFLAGS` and/or `AVX_CFLAGS` environment variables.
86+
Optional SIMD codecs can be included by specifying the `AVX2_CFLAGS`, `AVX512_CFLAGS`,
87+
`NEON32_CFLAGS`, `NEON64_CFLAGS`, `SSSE3_CFLAGS`, `SSE41_CFLAGS`, `SSE42_CFLAGS` and/or `AVX_CFLAGS` environment variables.
8188
A typical build invocation on x86 looks like this:
8289

8390
```sh
@@ -93,6 +100,15 @@ Example:
93100
AVX2_CFLAGS=-mavx2 make
94101
```
95102

103+
### AVX512
104+
105+
To build and include the AVX512 codec, set the `AVX512_CFLAGS` environment variable to a value that will turn on AVX512 support in your compiler, typically `-mavx512vl -mavx512vbmi`.
106+
Example:
107+
108+
```sh
109+
AVX512_CFLAGS="-mavx512vl -mavx512vbmi" make
110+
```
111+
96112
The codec will only be used if runtime feature detection shows that the target machine supports AVX2.
97113

98114
### SSSE3
@@ -208,6 +224,7 @@ Mainly there for testing purposes, this is also useful on ARM where the only way
208224
The following constants can be used:
209225

210226
- `BASE64_FORCE_AVX2`
227+
- `BASE64_FORCE_AVX512`
211228
- `BASE64_FORCE_NEON32`
212229
- `BASE64_FORCE_NEON64`
213230
- `BASE64_FORCE_PLAIN`
@@ -434,7 +451,7 @@ x86 processors
434451
| i7-4770 @ 3.4 GHz DDR1600 OPENMP 4 thread | 4884\* | 7099\* | 4917\* | 7057\* | 4799\* | 7143\* | 4902\* | 7219\* |
435452
| i7-4770 @ 3.4 GHz DDR1600 OPENMP 8 thread | 5212\* | 8849\* | 5284\* | 9099\* | 5289\* | 9220\* | 4849\* | 9200\* |
436453
| i7-4870HQ @ 2.5 GHz | 1471\* | 3066\* | 6721\* | 6962\* | 7015\* | 8267\* | 8328\* | 11576\* |
437-
| i5-4590S @ 3.0 GHz | 3356 | 3197 | 4363 | 6104 | 4243 | 6233 | 4160 | 6344 |
454+
| i5-4590S @ 3.0 GHz | 3356 | 3197 | 4363 | 6104 | 4243\* | 6233 | 4160\* | 6344 |
438455
| Xeon X5570 @ 2.93 GHz | 2161 | 1508 | 3160 | 3915 | - | - | - | - |
439456
| Pentium4 @ 3.4 GHz | 896 | 740 | - | - | - | - | - | - |
440457
| Atom N270 | 243 | 266 | 508 | 387 | - | - | - | - |

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy