Skip to content

Commit 8055697

Browse files
Sentimentronxnnpack-bot
authored andcommitted
[gn] Experimental CI for Windows
PiperOrigin-RevId: 876305109
1 parent 9ca643b commit 8055697

3 files changed

Lines changed: 84 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,80 @@ jobs:
244244
run: ctest -C Release --output-on-failure --parallel $NUMBER_OF_PROCESSORS
245245
working-directory: ${{ github.workspace }}/build/windows/x86
246246

247+
gn-windows-x86_64:
248+
runs-on: 'windows-2022-32core'
249+
timeout-minutes: 15
250+
env:
251+
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
252+
steps:
253+
- name: Install Depot Tools
254+
uses: newkdev/setup-depot-tools@v1.0.1
255+
- name: Write .gclient
256+
shell: powershell
257+
run: |
258+
Set-Content -Path .gclient -Value "
259+
solutions = [
260+
{ 'name': 'XNNPACK',
261+
'url': 'https://github.com/google/XNNPACK',
262+
'deps_file': 'DEPS',
263+
'managed': False,
264+
'custom_deps': {},
265+
},
266+
]
267+
"
268+
working-directory: ${{ github.workspace }}
269+
- name: Setup build environment
270+
shell: bash
271+
run: |
272+
echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
273+
- name: Sync to commit and run hooks
274+
shell: powershell
275+
run: gclient sync -vv --revision $env:GITHUB_SHA
276+
- name: Write LASTCHANGE files
277+
shell: powershell
278+
run: |
279+
$LastChangeContents = @(
280+
"LASTCHANGE=$env:GITHUB_SHA-$env:GITHUB_REF_NAME"
281+
"LASTCHANGE_YEAR=$(git log -1 --pretty=%Y)"
282+
)
283+
284+
Set-Content -Path build/util/LASTCHANGE -Value $LastChangeContents
285+
$UnixTime = git log -1 --pretty=%ct
286+
Set-Content -Path build/util/LASTCHANGE.committime -Value $UnixTime
287+
working-directory: ${{ github.workspace }}\XNNPACK
288+
- name: Generate build files (arm64, component)
289+
run: |
290+
gn gen --check --args='is_debug=true is_component_build=true dcheck_always_on=true target_cpu="arm64"' out/arm64.dchecks
291+
working-directory: ${{ github.workspace }}\XNNPACK
292+
- name: Generate build files (x64, dchecks)
293+
run: |
294+
gn gen --check --args='is_debug=false dcheck_always_on=true target_cpu="x64"' out/x64.dchecks
295+
working-directory: ${{ github.workspace }}\XNNPACK
296+
- name: Generate build files (x86, dchecks)
297+
run: |
298+
gn gen --check --args='is_debug=false dcheck_always_on=true target_cpu="x86"' out/x86.dchecks
299+
working-directory: ${{ github.workspace }}\XNNPACK
300+
- name: Build all targets (arm64, component)
301+
run: |
302+
autoninja -C out/arm64.dchecks
303+
working-directory: ${{ github.workspace }}\XNNPACK
304+
- name: Build all targets (x64 Release + debug checks)
305+
run: |
306+
autoninja -C out/x64.dchecks
307+
working-directory: ${{ github.workspace }}\XNNPACK
308+
- name: Build all targets (x86 Release + debug checks)
309+
run: |
310+
autoninja -C out/x86.dchecks
311+
working-directory: ${{ github.workspace }}\XNNPACK
312+
- name: Run tests (x64)
313+
run: |
314+
python3 scripts/run-gn-tests.py out/x64.dchecks
315+
working-directory: ${{ github.workspace }}\XNNPACK
316+
- name: Run tests (x86)
317+
run: |
318+
python3 scripts/run-gn-tests.py out/x86.dchecks
319+
working-directory: ${{ github.workspace }}\XNNPACK
320+
247321
cmake-macos-arm64:
248322
runs-on: macos-latest
249323
timeout-minutes: 60

BUILD.gn

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ declare_args() {
9393
# Enables AVX2 support for x86 processors
9494
xnnpack_enable_avx2 = target_cpu == "x64" || target_cpu == "x86"
9595

96-
# Enables AVX512 support for x86 processors
97-
xnnpack_enable_avx512 = target_cpu == "x64" || target_cpu == "x86"
96+
# Enables AVX512 support for x86 processors. Temporarily switched
97+
# off on Windows because some AVX512 assembly kernels contain unsupported
98+
# syntax.
99+
xnnpack_enable_avx512 =
100+
(target_cpu == "x64" || target_cpu == "x86") && !is_win
98101

99102
# Enables VNNI extensions, which are separate from AVX512-VNNI
100103
xnnpack_enable_avx_vnni = target_cpu == "x64" || target_cpu == "x86"
@@ -771,7 +774,7 @@ xnnpack_source_set("xnnpack") {
771774
if (xnnpack_enable_avx512) {
772775
deps += [ ":avx512_microkernels" ]
773776
}
774-
if (current_cpu == "x64") {
777+
if (current_cpu == "x64" && !is_win) {
775778
sources += AMD64_ASM_MICROKERNEL_SRCS
776779
}
777780
sources += ALL_SSE_MICROKERNEL_SRCS

scripts/run-gn-tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import datetime
1616
import glob
1717
import os
18+
import platform
1819
import sys
1920

2021
# Add tests that require sharding here.
@@ -134,7 +135,10 @@ async def main() -> None:
134135
semaphore = asyncio.Semaphore(concurrency)
135136

136137
# Pick up the executables - must be named in this way to work
138+
# If we're on Windows, the executable will have a .exe extension.
137139
test_suites = list(sorted(glob.glob(args.out_dir + '/xnnpack_*_test')))
140+
if platform.system() == "Windows":
141+
test_suites = list(sorted(glob.glob(args.out_dir + '/xnnpack_*_test.exe')))
138142

139143
print(f'Discovered {len(test_suites)} test suites...')
140144
# Create the list of tests to run, sharding the long ones.

0 commit comments

Comments
 (0)