Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
strategy:
fail-fast: false
matrix:
preset: [windows] # TODO (gjcomer) Re-enable pybind once functional
preset: [pybind, windows]
with:
job-name: build
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
Expand All @@ -127,7 +127,7 @@ jobs:
conda activate et

python install_requirements.py
cmake --preset ${{ matrix.preset }}
cmake --preset ${{ matrix.preset }} -T ClangCL
if (\$LASTEXITCODE -ne 0) {
Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE."
exit \$LASTEXITCODE
Expand Down
5 changes: 5 additions & 0 deletions extension/data_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ if(NOT ET_HAVE_SYS_MMAN_H AND NOT WIN32)
"extension/data_loader/mmap_data_loader.cpp"
)
endif()
if(WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? I thought scott already selectively included this source file in build whatever.bzl

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not. I might be thinking of selectively removing the header from the public include if not on windows or something

Copy link
Member Author

@GregoryComer GregoryComer Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I chatted with Scott briefly on this. His recommendation was to manage it locally. The main build variables list has to be mechanically parsable from both CMake and Buck, so it can't include more complex conditional logic.

list(APPEND _extension_data_loader__srcs
"extension/data_loader/mman_windows.cpp"
)
endif()
list(TRANSFORM _extension_data_loader__srcs PREPEND "${EXECUTORCH_ROOT}/")
add_library(extension_data_loader ${_extension_data_loader__srcs})
target_link_libraries(extension_data_loader executorch_core)
Expand Down
16 changes: 14 additions & 2 deletions tools/cmake/preset/pybind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,28 @@ set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_overridable_option(EXECUTORCH_BUILD_COREML ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set_overridable_option(EXECUTORCH_BUILD_COREML ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL
"WIN32"
)
# Windows or other OS-specific code here
if(NOT CMAKE_GENERATOR_TOOLSET MATCHES "ClangCL")
message(
FATAL_ERROR
"ExecuTorch requires the ClangCL toolset on Windows. Please configure with -T ClangCL."
)
endif()

# These XNNPACK options don't currently build on Windows with Clang.
Copy link
Contributor

@JacobSzwejbka JacobSzwejbka Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do these magic incantations come from

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are 4 optional XNNPACK features (exposed by XNNPACK's CMakeLists) that clang-cl has issues with due to the /vlen compiler argument.

These disable a small subset of the available kernels, though they are relatively niche and should have minimal perf impact. It should be fixed or gated upstream in XNNPACK itself. I intend to file an issue there and maybe just fix it myself. They have some gating logic already (https://github.com/google/XNNPACK/blob/923253023555f75c38d96511aa7fa59b9ef9c25c/CMakeLists.txt#L176)

I could also move these into the XNNPACK backend CMakeLists, rather than the presets, as they are functionally an internal detail, and it would also ensure that they are always disabled on Windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking through it more, I think I will move these into the XNNPACK backend CMakeLists, rather than the preset.

set_overridable_option(XNNPACK_ENABLE_AVX256SKX OFF)
set_overridable_option(XNNPACK_ENABLE_AVX256VNNI OFF)
set_overridable_option(XNNPACK_ENABLE_AVX256VNNIGFNI OFF)
set_overridable_option(XNNPACK_ENABLE_AVX512BF16 OFF)
else()
message(
FATAL_ERROR "Unsupported CMAKE_SYSTEM_NAME for pybind: ${CMAKE_SYSTEM_NAME}"
Expand Down
Loading