From e03898b57cbed0a6e5c830d4693887f067e64629 Mon Sep 17 00:00:00 2001 From: ppigazzini Date: Mon, 19 May 2025 16:44:59 +0200 Subject: [PATCH] ci: add tests and artifacts for windows-11-arm integrate armv8 and armv8-dotprod builds on windows-11-arm in ci, creating the corresponding artifacts. Correct Makefile to drop warnings when providing a CXX, add MINGW ARM64 to get_native_properties.sh fixes https://github.com/official-stockfish/Stockfish/issues/5640 closes https://github.com/official-stockfish/Stockfish/pull/6078 No functional change --- .github/ci/matrix.json | 138 +++++++++++++++++++++++++++++- .github/workflows/compilation.yml | 14 +-- .github/workflows/tests.yml | 20 ++++- scripts/get_native_properties.sh | 8 +- src/Makefile | 12 +-- 5 files changed, 172 insertions(+), 20 deletions(-) diff --git a/.github/ci/matrix.json b/.github/ci/matrix.json index fa720a1c..c414c51f 100644 --- a/.github/ci/matrix.json +++ b/.github/ci/matrix.json @@ -40,6 +40,18 @@ "ext": ".exe", "sde": "/d/a/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.27.0-2023-09-13-win/sde.exe -future --", "archive_ext": "zip" + }, + { + "name": "Windows 11 Mingw-w64 Clang arm64", + "os": "windows-11-arm", + "simple_name": "windows", + "compiler": "clang++", + "comp": "clang", + "msys_sys": "clangarm64", + "msys_env": "clang-aarch64-clang", + "shell": "msys2 {0}", + "ext": ".exe", + "archive_ext": "zip" } ], "binaries": [ @@ -51,7 +63,9 @@ "x86-64-avx512", "x86-64-vnni256", "x86-64-vnni512", - "apple-silicon" + "apple-silicon", + "armv8", + "armv8-dotprod" ], "exclude": [ { @@ -126,12 +140,78 @@ "os": "macos-13" } }, + { + "binaries": "x86-64", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-sse41-popcnt", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-avx2", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-bmi2", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-avxvnni", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-avx512", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-vnni256", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "x86-64-vnni512", + "config": { + "os": "windows-11-arm" + } + }, { "binaries": "apple-silicon", "config": { "os": "windows-2022" } }, + { + "binaries": "apple-silicon", + "config": { + "os": "windows-11-arm" + } + }, + { + "binaries": "apple-silicon", + "config": { + "os": "ubuntu-20.04" + } + }, + { + "binaries": "apple-silicon", + "config": { + "os": "ubuntu-22.04" + } + }, { "binaries": "apple-silicon", "config": { @@ -139,10 +219,64 @@ } }, { - "binaries": "apple-silicon", + "binaries": "armv8", + "config": { + "os": "windows-2022" + } + }, + { + "binaries": "armv8", + "config": { + "os": "ubuntu-20.04" + } + }, + { + "binaries": "armv8", "config": { "os": "ubuntu-22.04" } + }, + { + "binaries": "armv8", + "config": { + "os": "macos-13" + } + }, + { + "binaries": "armv8", + "config": { + "os": "macos-14" + } + }, + { + "binaries": "armv8-dotprod", + "config": { + "os": "windows-2022" + } + }, + { + "binaries": "armv8-dotprod", + "config": { + "os": "ubuntu-20.04" + } + }, + { + "binaries": "armv8-dotprod", + "config": { + "os": "ubuntu-22.04" + } + }, + { + "binaries": "armv8-dotprod", + "config": { + "os": "macos-13" + } + }, + { + "binaries": "armv8-dotprod", + "config": { + "os": "macos-14" + } } ] } diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 5878adec..67b2e1c5 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -63,13 +63,13 @@ jobs: - name: Check compiler run: $COMPCXX -v - - name: Show g++ cpu info - if: runner.os != 'macOS' - run: g++ -Q -march=native --help=target - - - name: Show clang++ cpu info - if: runner.os == 'macOS' - run: clang++ -E - -march=native -### + - name: Show compiler cpu info + run: | + if [[ "$COMPCXX" == clang* ]]; then + $COMPCXX -E - -march=native -### + else + $COMPCXX -Q -march=native --help=target + fi # x86-64 with newer extensions tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 57d0d53f..6d35a183 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -98,6 +98,14 @@ jobs: msys_sys: clang64 msys_env: clang-x86_64-clang shell: msys2 {0} + - name: Windows 11 Mingw-w64 Clang arm64 + os: windows-11-arm + compiler: clang++ + comp: clang + run_armv8_tests: true + msys_sys: clangarm64 + msys_env: clang-aarch64-clang + shell: msys2 {0} defaults: run: working-directory: src @@ -302,8 +310,10 @@ jobs: - name: Test armv8 build if: matrix.config.run_armv8_tests run: | - export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH - export LDFLAGS="-static -Wno-unused-command-line-argument" + if [ $COMP == ndk ]; then + export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH + export LDFLAGS="-static -Wno-unused-command-line-argument" + fi make clean make -j4 ARCH=armv8 build ../tests/signature.sh $benchref @@ -311,8 +321,10 @@ jobs: - name: Test armv8-dotprod build if: matrix.config.run_armv8_tests run: | - export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH - export LDFLAGS="-static -Wno-unused-command-line-argument" + if [ $COMP == ndk ]; then + export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH + export LDFLAGS="-static -Wno-unused-command-line-argument" + fi make clean make -j4 ARCH=armv8-dotprod build ../tests/signature.sh $benchref diff --git a/scripts/get_native_properties.sh b/scripts/get_native_properties.sh index 132bd6f4..773d6c27 100755 --- a/scripts/get_native_properties.sh +++ b/scripts/get_native_properties.sh @@ -130,7 +130,13 @@ case $uname_s in esac file_ext='tar' ;; - 'CYGWIN'*|'MINGW'*|'MSYS'*) # Windows system with POSIX compatibility layer + 'MINGW'*'ARM64'*) # Windows ARM64 system with POSIX compatibility layer + # TODO: older chips might be armv8, but we have no good way to detect, /proc/cpuinfo shows x86 info + file_os='windows' + true_arch='armv8-dotprod' + file_ext='zip' + ;; + 'CYGWIN'*|'MINGW'*|'MSYS'*) # Windows x86_64system with POSIX compatibility layer get_flags check_znver_1_2 set_arch_x86_64 diff --git a/src/Makefile b/src/Makefile index 17badefd..fc27044f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -567,11 +567,16 @@ ifeq ($(COMP),ndk) LDFLAGS += -static-libstdc++ -pie -lm -latomic endif +### Allow overwriting CXX from command line +ifdef COMPCXX + CXX=$(COMPCXX) +endif + # llvm-profdata must be version compatible with the specified CXX (be it clang, or the gcc alias) # make -j profile-build CXX=clang++-20 COMP=clang # Locate the version in the same directory as the compiler used, # with fallback to a generic one if it can't be located - LLVM_PROFDATA := $(dir $(realpath $(shell which $(CXX))))llvm-profdata + LLVM_PROFDATA := $(dir $(realpath $(shell which $(CXX) 2> /dev/null)))llvm-profdata ifeq ($(wildcard $(LLVM_PROFDATA)),) LLVM_PROFDATA := llvm-profdata endif @@ -590,11 +595,6 @@ else endif endif -### Allow overwriting CXX from command line -ifdef COMPCXX - CXX=$(COMPCXX) -endif - ### Sometimes gcc is really clang ifeq ($(COMP),gcc) gccversion := $(shell $(CXX) --version 2>/dev/null)