From b685543bd3a4ecc1634433f5f653e69c4f6ade79 Mon Sep 17 00:00:00 2001 From: SzilBalazs <70139847+SzilBalazs@users.noreply.github.com> Date: Thu, 17 Aug 2023 19:38:02 +0200 Subject: [PATCH] CI Tweaks - #60 CI Tweaks Bench: 2134743 --- .github/workflows/build.yml | 25 +++++++++++++++++-------- Makefile | 11 ++++++++--- src/chess/board.h | 10 +++++----- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d3a620..935f0ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,22 +1,25 @@ -name: Check Bench & Run Tests +name: Validate Bench & Run Tests on: [push] jobs: WhiteCore: runs-on: ${{matrix.os}} - name: WhiteCore ${{matrix.arch}} ${{matrix.os}} + name: WhiteCore ${{matrix.compiler}} ${{matrix.arch}} ${{matrix.os}} strategy: + fail-fast: false matrix: os: [ubuntu-latest, windows-latest] arch: [popcnt, avx2, bmi2] + compiler: [g++, clang++] include: - os: ubuntu-latest suffix: "-linux" + debug-build: "build=debug" packages: | sudo apt-get update - sudo apt-get install clang-15 + sudo apt-get install -y valgrind clang-15 g++-multilib - os: windows-latest suffix: "-win" exe-suffix: ".exe" @@ -30,13 +33,14 @@ jobs: - name: Build WhiteCore run: | - clang++ --version - make EXE=WhiteCore-${{matrix.arch}}${{matrix.suffix}} ARCH=${{matrix.arch}} + ${{matrix.compiler}} --version + make EXE=WhiteCore-${{matrix.arch}}${{matrix.suffix}} ARCH=${{matrix.arch}} CXX=${{matrix.compiler}} ${{matrix.debug-build}} - name: Run tests run: ./WhiteCore-${{matrix.arch}}${{matrix.suffix}} test - - name: Run bench + - name: Run bench on Windows + if: matrix.os == 'windows-latest' run: ./WhiteCore-${{matrix.arch}}${{matrix.suffix}} bench - name: Run bench on Linux @@ -55,8 +59,13 @@ jobs: echo "::error::The commit bench ${{steps.obtain_bench.outputs.COMMIT_BENCH}} is not equal to the actual bench ${{steps.obtain_bench.outputs.BENCH}}!" exit 1 - - name: Upload artifacts + - name: Run Valgrind + if: runner.os == 'Linux' + run: | + valgrind --error-exitcode=1 --errors-for-leak-kinds=all --leak-check=full ./WhiteCore-${{matrix.arch}}${{matrix.suffix}} bench + + - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: WhiteCore-Executables + name: WhiteCore-${{matrix.arch}}-${{matrix.compiler}}${{matrix.suffix}}${{matrix.exe-suffix}} path: ./WhiteCore-${{matrix.arch}}${{matrix.suffix}}${{matrix.exe-suffix}} \ No newline at end of file diff --git a/Makefile b/Makefile index 8bb6001..76bf0d3 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,13 @@ else endif ifeq ($(uname_S), Windows) - SUFFIX = .exe + +ifeq ($(CXX), clang++) + USE_INCBIN_TOOL = true CPP_FILES += src/corenet.cpp +endif + + SUFFIX = .exe CP = powershell cp else CP = cp @@ -97,13 +102,13 @@ $(TMP_EVALFILE): @$(CP) $(EVALFILE) $(TMP_EVALFILE) $(INCBIN_TOOL): $(TMP_EVALFILE) -ifeq ($(uname_S), Windows) +ifeq ($(USE_INCBIN_TOOL), true) @echo -e "$(C_CYAN)Compiling $(C_RED)$(INCBIN_TOOL)$(C_CYAN)...$(C_DEFAULT)" @clang -o $@ src/external/incbin/incbin.c endif $(OUTPUT_BINARY): $(HEADERS) $(SOURCES) $(INCBIN_TOOL) -ifeq ($(uname_S), Windows) +ifeq ($(USE_INCBIN_TOOL), true) @./$(INCBIN_TOOL) src/network/nnue.h -o src/corenet.cpp endif @echo -e "$(C_CYAN)Compiling $(C_WHITE)$(NAME)$(C_CYAN)...$(C_DEFAULT)" diff --git a/src/chess/board.h b/src/chess/board.h index e9c7d8c..70c22c4 100644 --- a/src/chess/board.h +++ b/src/chess/board.h @@ -36,23 +36,23 @@ namespace chess { class Board { public: - [[nodiscard]] constexpr Color get_stm() const { + [[nodiscard]] inline Color get_stm() const { return state.stm; } - [[nodiscard]] constexpr Square get_ep() const { + [[nodiscard]] inline Square get_ep() const { return state.ep; } - [[nodiscard]] constexpr Zobrist get_hash() const { + [[nodiscard]] inline Zobrist get_hash() const { return state.hash; } - [[nodiscard]] constexpr unsigned int get_move50() const { + [[nodiscard]] inline unsigned int get_move50() const { return state.move50; } - [[nodiscard]] constexpr CastlingRights get_rights() const { + [[nodiscard]] inline CastlingRights get_rights() const { return state.rights; }