Skip to content

Commit 4c4cbdf

Browse files
authored
Fix remaining build issues on Windows, re-enable Windows pybind preset build CI job (#13702)
**Note: This is a cherry-pick of #13564 and #13259. I inadvertently broke the ghstack when attempting to re-order the stack, leading to the old PR being merged by ghstack into the ghstack-created branch (not main).** Add mman_windows.cpp to the CMake sources. Fix a few build-blocking issues with XNNPACK on Windows. Enable XNNPACK on the Windows preset. This also gives CI coverage. I've disabled 4 microkernel families that don't build currently. These likely need to be gated or fixed upstream, but I'm disabling them locally for now to unblock usage. They are relatively niche and should have little to no perf impact on the average user. With this change, the pybind preset works and we can re-enable it in CI.
1 parent 8dff86a commit 4c4cbdf

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

.github/workflows/build-presets.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
strategy:
110110
fail-fast: false
111111
matrix:
112-
preset: [windows]
112+
preset: [pybind, windows]
113113
with:
114114
job-name: build
115115
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -122,14 +122,17 @@ jobs:
122122
Set-PSDebug -Trace 1
123123
\$ErrorActionPreference = 'Stop'
124124
\$PSNativeCommandUseErrorActionPreference = \$true
125+
125126
conda create --yes --quiet -n et python=3.12
126127
conda activate et
127128
python install_requirements.py
129+
128130
cmake --preset ${{ matrix.preset }} -T ClangCL
129131
if (\$LASTEXITCODE -ne 0) {
130132
Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE."
131133
exit \$LASTEXITCODE
132134
}
135+
133136
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
134137
cmake --build cmake-out -j \$numCores
135138
if (\$LASTEXITCODE -ne 0) {

backends/xnnpack/cmake/Dependencies.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ else()
5555
)
5656
endif()
5757

58+
if(WIN32)
59+
# These XNNPACK options don't currently build on Windows.
60+
set_overridable_option(XNNPACK_ENABLE_AVX256SKX OFF)
61+
set_overridable_option(XNNPACK_ENABLE_AVX256VNNI OFF)
62+
set_overridable_option(XNNPACK_ENABLE_AVX256VNNIGFNI OFF)
63+
set_overridable_option(XNNPACK_ENABLE_AVX512BF16 OFF)
64+
endif()
65+
5866
set(XNNPACK_BUILD_ALL_MICROKERNELS
5967
OFF
6068
CACHE BOOL ""

extension/data_loader/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if(NOT ET_HAVE_SYS_MMAN_H AND NOT WIN32)
2424
"extension/data_loader/mmap_data_loader.cpp"
2525
)
2626
endif()
27+
if(WIN32)
28+
list(APPEND _extension_data_loader__srcs
29+
"extension/data_loader/mman_windows.cpp"
30+
)
31+
endif()
2732
list(TRANSFORM _extension_data_loader__srcs PREPEND "${EXECUTORCH_ROOT}/")
2833
add_library(extension_data_loader ${_extension_data_loader__srcs})
2934
target_link_libraries(extension_data_loader executorch_core)

tools/cmake/preset/pybind.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
2121
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
2222
set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
2323
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
24-
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)
2524

2625
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2726
set_overridable_option(EXECUTORCH_BUILD_COREML ON)
27+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)
2828
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
2929
set_overridable_option(EXECUTORCH_BUILD_COREML ON)
30+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)
3031
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL
3132
"WIN32"
3233
)

tools/cmake/preset/windows.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
1414
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
1515
set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
1616
set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
17-
18-
# Below options are not yet buildable on Windows, but should be.
19-
# set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)
17+
set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)

0 commit comments

Comments
 (0)