From 3584827c77a34965f6d23dd4d7238133faf0fb45 Mon Sep 17 00:00:00 2001 From: Richard Townsend Date: Fri, 27 Feb 2026 10:02:00 -0800 Subject: [PATCH] [gn] Experimental CI for Windows PiperOrigin-RevId: 876305109 --- .github/workflows/build.yml | 77 +++++++++++++++++++++++++++++++++++++ BUILD.gn | 9 +++-- scripts/run-gn-tests.py | 4 ++ 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0d826c51fe..e86abee8242 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -244,6 +244,83 @@ jobs: run: ctest -C Release --output-on-failure --parallel $NUMBER_OF_PROCESSORS working-directory: ${{ github.workspace }}/build/windows/x86 + gn-windows-x86_64: + runs-on: 'windows-2022-32core' + timeout-minutes: 30 + env: + DEPOT_TOOLS_WIN_TOOLCHAIN: 0 + steps: + - name: Install Depot Tools + uses: newkdev/setup-depot-tools@v1.0.1 + - name: Write .gclient + shell: powershell + run: | + Set-Content -Path .gclient -Value " + solutions = [ + { 'name': 'XNNPACK', + 'url': 'https://github.com/google/XNNPACK', + 'deps_file': 'DEPS', + 'managed': False, + 'custom_deps': {}, + }, + ] + " + working-directory: ${{ github.workspace }} + - name: Setup build environment + shell: bash + run: | + echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV + - name: Sync to commit and run hooks + shell: powershell + run: gclient sync -vv --revision $env:GITHUB_SHA + - name: Write LASTCHANGE files + shell: powershell + run: | + $LastChangeContents = @( + "LASTCHANGE=$env:GITHUB_SHA-$env:GITHUB_REF_NAME" + "LASTCHANGE_YEAR=$(git log -1 --pretty=%Y)" + ) + + Set-Content -Path build/util/LASTCHANGE -Value $LastChangeContents + $UnixTime = git log -1 --pretty=%ct + Set-Content -Path build/util/LASTCHANGE.committime -Value $UnixTime + working-directory: ${{ github.workspace }}\XNNPACK + - name: Generate build files (arm64, component) + run: | + gn gen --check --args="is_debug=true symbol_level=1 is_component_build=true target_cpu=\`"arm64\`"" out/arm64.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + shell: powershell + - name: Generate build files (x64, dchecks) + run: | + gn gen --check --args="is_debug=false symbol_level=0 dcheck_always_on=true target_cpu=\`"x64\`"" out/x64.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + shell: powershell + - name: Generate build files (x86, dchecks) + run: | + gn gen --check --args="is_debug=false symbol_level=0 dcheck_always_on=true target_cpu=\`"x86\`"" out/x86.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + shell: powershell + - name: Build all targets (arm64, component) + run: | + autoninja -C out/arm64.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + - name: Build all targets (x64 Release + debug checks) + run: | + autoninja -C out/x64.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + - name: Build all targets (x86 Release + debug checks) + run: | + autoninja -C out/x86.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + - name: Run tests (x64) + run: | + python3 scripts/run-gn-tests.py out/x64.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + - name: Run tests (x86) + run: | + python3 scripts/run-gn-tests.py out/x86.dchecks + working-directory: ${{ github.workspace }}\XNNPACK + cmake-macos-arm64: runs-on: macos-latest timeout-minutes: 60 diff --git a/BUILD.gn b/BUILD.gn index 183ea27cb09..5af0cb0ccbe 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -93,8 +93,11 @@ declare_args() { # Enables AVX2 support for x86 processors xnnpack_enable_avx2 = target_cpu == "x64" || target_cpu == "x86" - # Enables AVX512 support for x86 processors - xnnpack_enable_avx512 = target_cpu == "x64" || target_cpu == "x86" + # Enables AVX512 support for x86 processors. Temporarily switched + # off on Windows because some AVX512 assembly kernels contain unsupported + # syntax. + xnnpack_enable_avx512 = + (target_cpu == "x64" || target_cpu == "x86") && !is_win # Enables VNNI extensions, which are separate from AVX512-VNNI xnnpack_enable_avx_vnni = target_cpu == "x64" || target_cpu == "x86" @@ -771,7 +774,7 @@ xnnpack_source_set("xnnpack") { if (xnnpack_enable_avx512) { deps += [ ":avx512_microkernels" ] } - if (current_cpu == "x64") { + if (current_cpu == "x64" && !is_win) { sources += AMD64_ASM_MICROKERNEL_SRCS } sources += ALL_SSE_MICROKERNEL_SRCS diff --git a/scripts/run-gn-tests.py b/scripts/run-gn-tests.py index 04cf9250d7a..a73cfa79f11 100644 --- a/scripts/run-gn-tests.py +++ b/scripts/run-gn-tests.py @@ -15,6 +15,7 @@ import datetime import glob import os +import platform import sys # Add tests that require sharding here. @@ -134,7 +135,10 @@ async def main() -> None: semaphore = asyncio.Semaphore(concurrency) # Pick up the executables - must be named in this way to work + # If we're on Windows, the executable will have a .exe extension. test_suites = list(sorted(glob.glob(args.out_dir + '/xnnpack_*_test'))) + if platform.system() == "Windows": + test_suites = list(sorted(glob.glob(args.out_dir + '/xnnpack_*_test.exe'))) print(f'Discovered {len(test_suites)} test suites...') # Create the list of tests to run, sharding the long ones.