Skip to content

Commit 5c3cb65

Browse files
Add Windows ARM64 build CI (#21817)
## Summary Adds compile-only Windows ARM64 coverage to the existing MSVC workflow using the official `windows-11-arm` hosted runner. The build targets ARM64 with Visual Studio 2022 and covers the executor runner, extensions, optimized kernels, XNNPACK, and LLM support. It follows the existing Windows workflow run-decision and path-filtering policy. ## Test plan The workflow passes YAML parsing, `git diff --check`, and actionlint validation. Actionlint’s stale hosted-runner label list does not yet include the official `windows-11-arm` label, so that specific warning was excluded. The native Windows ARM64 compile will run on this PR. This PR was authored with AI assistance from Codex.
1 parent 856aacb commit 5c3cb65

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Set-PSDebug -Trace 1
2+
$ErrorActionPreference = 'Stop'
3+
$PSNativeCommandUseErrorActionPreference = $true
4+
5+
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
6+
$vsInstallPath = & $vsWhere -latest -products * `
7+
-requires Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
8+
-property installationPath
9+
if (-not $vsInstallPath) {
10+
throw "Visual Studio with the ARM64 C++ toolchain was not found."
11+
}
12+
$vsDevShell = Join-Path $vsInstallPath "Common7\Tools\Launch-VsDevShell.ps1"
13+
& $vsDevShell -Arch arm64 -HostArch amd64
14+
15+
$buildDir = "cmake-out-windows-arm64"
16+
if (Test-Path -Path $buildDir) {
17+
Remove-Item -Path $buildDir -Recurse -Force
18+
}
19+
20+
# XNNPACK's optional ARM ISA and assembly microkernels do not build with MSVC.
21+
# Baseline ARM64 NEON kernels remain enabled.
22+
cmake -S . -B $buildDir `
23+
-G "Visual Studio 17 2022" `
24+
-A ARM64 `
25+
-DCMAKE_BUILD_TYPE=Release `
26+
-DCMAKE_CXX_STANDARD=20 `
27+
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON `
28+
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON `
29+
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON `
30+
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON `
31+
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON `
32+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON `
33+
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON `
34+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF `
35+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM_AOT=OFF `
36+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=OFF `
37+
-DEXECUTORCH_BUILD_XNNPACK=ON `
38+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON `
39+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON `
40+
-DXNNPACK_ENABLE_ASSEMBLY=OFF `
41+
-DXNNPACK_ENABLE_ARM_BF16=OFF `
42+
-DXNNPACK_ENABLE_ARM_DOTPROD=OFF `
43+
-DXNNPACK_ENABLE_ARM_FP16_SCALAR=OFF `
44+
-DXNNPACK_ENABLE_ARM_FP16_VECTOR=OFF
45+
46+
cmake --build $buildDir --config Release -j $env:NUMBER_OF_PROCESSORS
47+
48+
Write-Host "Windows ARM64 build completed successfully!"

.github/workflows/windows-msvc.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
paths:
1212
- .ci/docker/ci_commit_pins/pytorch.txt
1313
- .ci/scripts/**
14+
- .github/workflows/windows-msvc.yml
1415
workflow_dispatch:
1516

1617
concurrency:
@@ -57,3 +58,41 @@ jobs:
5758
\$PSNativeCommandUseErrorActionPreference = \$true
5859
.ci/scripts/setup-windows-msvc.ps1
5960
}"
61+
62+
build-windows-arm64:
63+
name: build-windows-arm64
64+
needs: [changed-files, run-decision]
65+
if: |
66+
contains(needs.changed-files.outputs.changed-files, '.ci/docker/ci_commit_pins/pytorch.txt') ||
67+
contains(needs.changed-files.outputs.changed-files, '.ci/scripts/') ||
68+
contains(needs.changed-files.outputs.changed-files, '.github/workflows/windows-msvc.yml') ||
69+
needs.run-decision.outputs.is-full-run == 'true'
70+
# test-infra's Windows setup assumes the AWS runner image; use the GitHub
71+
# hosted Windows ARM64 image directly.
72+
runs-on: windows-11-arm
73+
timeout-minutes: 60
74+
steps:
75+
- name: Enable long paths
76+
shell: cmd
77+
run: |
78+
git config --system --get core.longpaths || echo "core.longpaths is not set, setting it now"
79+
git config --system core.longpaths true
80+
81+
- name: Checkout ExecuTorch
82+
uses: actions/checkout@v4
83+
with:
84+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
85+
86+
- name: Initialize submodules
87+
shell: pwsh
88+
run: |
89+
git config --global http.sslBackend openssl
90+
git submodule update --init --recursive
91+
92+
- name: Install build dependencies
93+
shell: pwsh
94+
run: python -m pip install pyyaml torch==2.13.0 --extra-index-url https://download.pytorch.org/whl/test/cpu
95+
96+
- name: Build ExecuTorch
97+
shell: pwsh
98+
run: .ci/scripts/setup-windows-arm64.ps1

0 commit comments

Comments
 (0)