Skip to content

Commit

Permalink
Merge branch 'official-stockfish:master' into Main
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim26 authored Sep 30, 2024
2 parents 5a9a753 + d604397 commit 4495d7a
Show file tree
Hide file tree
Showing 31 changed files with 1,871 additions and 475 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ jobs:
export CXXFLAGS="-O1 -fno-inline"
make clean
make -j4 ARCH=x86-64-sse41-popcnt ${{ matrix.sanitizers.make_option }} debug=yes optimize=no build > /dev/null
../tests/instrumented.sh --${{ matrix.sanitizers.instrumented_option }}
python3 ../tests/instrumented.py --${{ matrix.sanitizers.instrumented_option }} ./stockfish
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ src/-lstdc++.res
# Neural network for the NNUE evaluation
**/*.nnue

# Files generated by the instrumented tests
tsan.supp
__pycache__/
tests/syzygy
tests/bench_tmp.epd
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Unai Corzo (unaiic)
Uri Blass (uriblass)
Vince Negri (cuddlestmonkey)
Viren
Wencey Wang
windfishballad
xefoci7612
Xiang Wang (KatyushaScarlet)
Expand Down
15 changes: 15 additions & 0 deletions scripts/get_native_properties.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ check_znver_1_2() {
[ "$vendor_id" = "AuthenticAMD" ] && [ "$cpu_family" = "23" ] && znver_1_2=true
}

# Set the file CPU loongarch64 architecture
set_arch_loongarch64() {
if check_flags 'lasx'; then
true_arch='loongarch64-lasx'
elif check_flags 'lsx'; then
true_arch='lonngarch64-lsx'
else
true_arch='loongarch64'
fi
}

# Set the file CPU x86_64 architecture
set_arch_x86_64() {
if check_flags 'avx512vnni' 'avx512dq' 'avx512f' 'avx512bw' 'avx512vl'; then
Expand Down Expand Up @@ -90,6 +101,10 @@ case $uname_s in
true_arch="$true_arch-neon"
fi
;;
'loongarch64'*)
file_os='linux'
set_arch_loongarch64
;;
*) # Unsupported machine type, exit with error
printf 'Unsupported machine type: %s\n' "$uname_m"
exit 1
Expand Down
42 changes: 38 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ VPATH = syzygy:nnue:nnue/features
# vnni512 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 512
# neon = yes/no --- -DUSE_NEON --- Use ARM SIMD architecture
# dotprod = yes/no --- -DUSE_NEON_DOTPROD --- Use ARM advanced SIMD Int8 dot product instructions
# lsx = yes/no --- -mlsx --- Use Loongson SIMD eXtension
# lasx = yes/no --- -mlasx --- use Loongson Advanced SIMD eXtension
#
# Note that Makefile is space sensitive, so when adding new architectures
# or modifying existing flags, you have to make sure there are no extra spaces
Expand All @@ -130,7 +132,8 @@ ifeq ($(ARCH), $(filter $(ARCH), \
x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-avxvnni x86-64-bmi2 \
x86-64-avx2 x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 e2k \
armv7 armv7-neon armv8 armv8-dotprod apple-silicon general-64 general-32 riscv64 loongarch64))
armv7 armv7-neon armv8 armv8-dotprod apple-silicon general-64 general-32 riscv64 \
loongarch64 loongarch64-lsx loongarch64-lasx))
SUPPORTED_ARCH=true
else
SUPPORTED_ARCH=false
Expand All @@ -156,6 +159,8 @@ vnni512 = no
neon = no
dotprod = no
arm_version = 0
lsx = no
lasx = no
STRIP = strip

ifneq ($(shell which clang-format-18 2> /dev/null),)
Expand Down Expand Up @@ -375,8 +380,19 @@ ifeq ($(ARCH),riscv64)
arch = riscv64
endif

ifeq ($(ARCH),loongarch64)
ifeq ($(findstring loongarch64,$(ARCH)),loongarch64)
arch = loongarch64
prefetch = yes

ifeq ($(findstring -lasx,$(ARCH)),-lasx)
lsx = yes
lasx = yes
endif

ifeq ($(findstring -lsx,$(ARCH)),-lsx)
lsx = yes
endif

endif
endif

Expand Down Expand Up @@ -413,7 +429,7 @@ ifeq ($(COMP),gcc)
ifeq ($(ARCH),riscv64)
CXXFLAGS += -latomic
endif
else ifeq ($(ARCH),loongarch64)
else ifeq ($(arch),loongarch64)
CXXFLAGS += -latomic
else
CXXFLAGS += -m$(bits)
Expand Down Expand Up @@ -485,7 +501,7 @@ ifeq ($(COMP),clang)
ifeq ($(ARCH),riscv64)
CXXFLAGS += -latomic
endif
else ifeq ($(ARCH),loongarch64)
else ifeq ($(arch),loongarch64)
CXXFLAGS += -latomic
else
CXXFLAGS += -m$(bits)
Expand Down Expand Up @@ -724,6 +740,18 @@ ifeq ($(dotprod),yes)
CXXFLAGS += -march=armv8.2-a+dotprod -DUSE_NEON_DOTPROD
endif

ifeq ($(lasx),yes)
ifeq ($(comp),$(filter $(comp),gcc clang mingw icx))
CXXFLAGS += -mlasx
endif
endif

ifeq ($(lsx),yes)
ifeq ($(comp),$(filter $(comp),gcc clang mingw icx))
CXXFLAGS += -mlsx
endif
endif

### 3.7 pext
ifeq ($(pext),yes)
CXXFLAGS += -DUSE_PEXT
Expand Down Expand Up @@ -840,6 +868,8 @@ help:
@echo "general-32 > unspecified 32-bit"
@echo "riscv64 > RISC-V 64-bit"
@echo "loongarch64 > LoongArch 64-bit"
@echo "loongarch64-lsx > LoongArch 64-bit with SIMD eXtension"
@echo "loongarch64-lasx > LoongArch 64-bit with Advanced SIMD eXtension"
@echo ""
@echo "Supported compilers:"
@echo ""
Expand Down Expand Up @@ -965,6 +995,8 @@ config-sanity: net
@echo "neon: '$(neon)'"
@echo "dotprod: '$(dotprod)'"
@echo "arm_version: '$(arm_version)'"
@echo "lsx: '$(lsx)'"
@echo "lasx: '$(lasx)'"
@echo "target_windows: '$(target_windows)'"
@echo ""
@echo "Flags:"
Expand Down Expand Up @@ -994,6 +1026,8 @@ config-sanity: net
@test "$(vnni256)" = "yes" || test "$(vnni256)" = "no"
@test "$(vnni512)" = "yes" || test "$(vnni512)" = "no"
@test "$(neon)" = "yes" || test "$(neon)" = "no"
@test "$(lsx)" = "yes" || test "$(lsx)" = "no"
@test "$(lasx)" = "yes" || test "$(lasx)" = "no"
@test "$(comp)" = "gcc" || test "$(comp)" = "icx" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" \
|| test "$(comp)" = "armv7a-linux-androideabi16-clang" || test "$(comp)" = "aarch64-linux-android21-clang"

Expand Down
Loading

0 comments on commit 4495d7a

Please sign in to comment.