Skip to content

Commit 94f4078

Browse files
committed
Fix data loader build on Windows, re-enable pybind preset
ghstack-source-id: 6442f75 ghstack-comment-id: 3208323478 Pull-Request: #13564
1 parent cb42df1 commit 94f4078

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.github/workflows/build-presets.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
strategy:
110110
fail-fast: false
111111
matrix:
112-
preset: [windows] # TODO (gjcomer) Re-enable pybind once functional
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 }}
@@ -127,7 +127,7 @@ jobs:
127127
conda activate et
128128
129129
python install_requirements.py
130-
cmake --preset ${{ matrix.preset }}
130+
cmake --preset ${{ matrix.preset }} -T ClangCL
131131
if (\$LASTEXITCODE -ne 0) {
132132
Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE."
133133
exit \$LASTEXITCODE

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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,28 @@ 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
)
33-
# Windows or other OS-specific code here
34+
if(NOT CMAKE_GENERATOR_TOOLSET MATCHES "ClangCL")
35+
message(
36+
FATAL_ERROR
37+
"ExecuTorch requires the ClangCL toolset on Windows. Please configure with -T ClangCL."
38+
)
39+
endif()
40+
41+
# These XNNPACK options don't currently build on Windows with Clang.
42+
set_overridable_option(XNNPACK_ENABLE_AVX256SKX OFF)
43+
set_overridable_option(XNNPACK_ENABLE_AVX256VNNI OFF)
44+
set_overridable_option(XNNPACK_ENABLE_AVX256VNNIGFNI OFF)
45+
set_overridable_option(XNNPACK_ENABLE_AVX512BF16 OFF)
3446
else()
3547
message(
3648
FATAL_ERROR "Unsupported CMAKE_SYSTEM_NAME for pybind: ${CMAKE_SYSTEM_NAME}"

0 commit comments

Comments
 (0)