1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Build and test more binaries in CI

use a fixed compiler on Linux and Windows (right now gcc 11).
build avxvnni on Windows (Linux needs updated core utils)
build x86-32 on Linux (Windows needs other mingw)
fix a Makefile issue where a failed PGOBENCH would not stop the build
reuse the WINE_PATH for SDE as we do for QEMU
use WINE_PATH variable also for the signature
verify the bench for each of the binaries
do not build x86-64-avx2 on macos

closes https://github.com/official-stockfish/Stockfish/pull/4682

No functional change
This commit is contained in:
Joost VandeVondele 2023-07-14 17:43:56 +02:00
parent acdbf45171
commit a3a91f3f9f
4 changed files with 50 additions and 16 deletions

View file

@ -70,6 +70,13 @@ jobs:
echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
fi fi
- name: Extract the bench number from the commit history
run: |
for hash in $(git rev-list -100 HEAD); do
benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true
done
[[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
- name: Download the used network from the fishtest framework - name: Download the used network from the fishtest framework
run: make net run: make net
@ -97,6 +104,7 @@ jobs:
make clean make clean
make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU
make strip ARCH=$BINARY COMP=$COMP make strip ARCH=$BINARY COMP=$COMP
WINE_PATH=$EMU ../tests/signature.sh $benchref
mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT
- name: Remove non src files - name: Remove non src files

View file

@ -22,7 +22,7 @@ jobs:
comp: gcc comp: gcc
shell: bash shell: bash
archive_ext: tar archive_ext: tar
sde: /home/runner/work/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.14.0-2022-10-25-lin/sde -future sde: /home/runner/work/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.14.0-2022-10-25-lin/sde -future --
- name: MacOS 12 Apple Clang - name: MacOS 12 Apple Clang
os: macos-12 os: macos-12
simple_name: macos simple_name: macos
@ -39,22 +39,29 @@ jobs:
msys_env: x86_64-gcc msys_env: x86_64-gcc
shell: msys2 {0} shell: msys2 {0}
ext: .exe ext: .exe
sde: /d/a/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.14.0-2022-10-25-win/sde.exe -future sde: /d/a/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.14.0-2022-10-25-win/sde.exe -future --
archive_ext: zip archive_ext: zip
binaries: binaries:
- x86-32
- x86-64 - x86-64
- x86-64-modern - x86-64-modern
- x86-64-avx2 - x86-64-avx2
- x86-64-bmi2 - x86-64-bmi2
# - x86-64-avxvnni needs more recent gcc - x86-64-avxvnni
- x86-64-avx512 - x86-64-avx512
- x86-64-vnni256 - x86-64-vnni256
- x86-64-vnni512 - x86-64-vnni512
exclude: exclude:
- binaries: x86-32
config: { os: macos-12 }
- binaries: x86-64-avx2
config: { os: macos-12 }
- binaries: x86-64-bmi2 - binaries: x86-64-bmi2
config: { os: macos-12 } config: { os: macos-12 }
#- binaries: x86-64-avxvnni - binaries: x86-64-avxvnni
# config: { os: macos-12 } config: { os: macos-12 }
- binaries: x86-64-avxvnni
config: { ubuntu-20.04 }
- binaries: x86-64-avx512 - binaries: x86-64-avx512
config: { os: macos-12 } config: { os: macos-12 }
- binaries: x86-64-vnni256 - binaries: x86-64-vnni256
@ -70,9 +77,17 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Download required linux packages - name: Download required Linux packages
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: sudo apt update run: |
sudo apt update
sudo apt install g++-multilib g++-11-multilib
- name: Install fixed GCC on Linux
if: runner.os == 'Linux'
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- name: Setup msys and install required packages - name: Setup msys and install required packages
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -81,6 +96,12 @@ jobs:
msystem: ${{ matrix.config.msys_sys }} msystem: ${{ matrix.config.msys_sys }}
install: mingw-w64-${{ matrix.config.msys_env }} make git zip install: mingw-w64-${{ matrix.config.msys_env }} make git zip
- name: Install fixed GCC on Windows
if: runner.os == 'Windows'
run: |
wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-11.3.0-2-any.pkg.tar.zst
pacman -U mingw-w64-x86_64-gcc-11.3.0-2-any.pkg.tar.zst --noconfirm
- name: Download SDE package - name: Download SDE package
if: runner.os == 'Linux' || runner.os == 'Windows' if: runner.os == 'Linux' || runner.os == 'Windows'
uses: petarpetrovt/setup-sde@v2.1 uses: petarpetrovt/setup-sde@v2.1
@ -91,6 +112,13 @@ jobs:
- name: Download the used network from the fishtest framework - name: Download the used network from the fishtest framework
run: make net run: make net
- name: Extract the bench number from the commit history
run: |
for hash in $(git rev-list -100 HEAD); do
benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true
done
[[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
- name: Check compiler - name: Check compiler
run: $COMPILER -v run: $COMPILER -v
@ -104,8 +132,9 @@ jobs:
- name: Compile ${{ matrix.binaries }} build - name: Compile ${{ matrix.binaries }} build
run: | run: |
make -j2 profile-build ARCH=$BINARY COMP=$COMP SDE_PATH="$SDE" make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH="$SDE"
make strip ARCH=$BINARY COMP=$COMP make strip ARCH=$BINARY COMP=$COMP
WINE_PATH="$SDE" ../tests/signature.sh $benchref
mv ./stockfish$EXT ../stockfish-$NAME-$BINARY$EXT mv ./stockfish$EXT ../stockfish-$NAME-$BINARY$EXT
- name: Remove non src files - name: Remove non src files

View file

@ -49,11 +49,7 @@ PREFIX = /usr/local
BINDIR = $(PREFIX)/bin BINDIR = $(PREFIX)/bin
### Built-in benchmark for pgo-builds ### Built-in benchmark for pgo-builds
ifeq ($(SDE_PATH),) PGOBENCH = $(WINE_PATH) ./$(EXE) bench
PGOBENCH = $(WINE_PATH) ./$(EXE) bench
else
PGOBENCH = $(SDE_PATH) -- $(WINE_PATH) ./$(EXE) bench
endif
### Source and object files ### Source and object files
SRCS = benchmark.cpp bitboard.cpp evaluate.cpp main.cpp \ SRCS = benchmark.cpp bitboard.cpp evaluate.cpp main.cpp \
@ -849,7 +845,8 @@ profile-build: net config-sanity objclean profileclean
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make) $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make)
@echo "" @echo ""
@echo "Step 2/4. Running benchmark for pgo-build ..." @echo "Step 2/4. Running benchmark for pgo-build ..."
$(PGOBENCH) 2>&1 | tail -n 4 $(PGOBENCH) > PGOBENCH.out 2>&1
tail -n 4 PGOBENCH.out
@echo "" @echo ""
@echo "Step 3/4. Building optimized executable ..." @echo "Step 3/4. Building optimized executable ..."
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean
@ -913,7 +910,7 @@ objclean:
# clean auxiliary profiling files # clean auxiliary profiling files
profileclean: profileclean:
@rm -rf profdir @rm -rf profdir
@rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s @rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s PGOBENCH.out
@rm -f stockfish.profdata *.profraw @rm -f stockfish.profdata *.profraw
@rm -f stockfish.*args* @rm -f stockfish.*args*
@rm -f stockfish.*lt* @rm -f stockfish.*lt*

View file

@ -11,7 +11,7 @@ trap 'error ${LINENO}' ERR
# obtain # obtain
signature=`./stockfish bench 2>&1 | grep "Nodes searched : " | awk '{print $4}'` signature=`eval "$WINE_PATH ./stockfish bench 2>&1" | grep "Nodes searched : " | awk '{print $4}'`
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
# compare to given reference # compare to given reference