[Windows] misc fixes to enable Windows build (#9198)
Summary: ## Context Implement some small miscellaneous fixes to enable installing ExecuTorch on Windows. Currently, the optimized kernels cannot be built successfully but the installation works in custom ops are not built. ## Installation ```powershell cd executorch # Need to disable building custom kernels; there are a bunch of build errors $env:EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT=0 # For some reason need to explicitly enable tensor extension otherwise I see a linker error $env:CMAKE_ARGS="-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON" python install_executorch.py # Unset if you want Remove-Item Env:\EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT Remove-Item Env:\CMAKE_ARGS ``` ## Testing I am able to follow the [Getting Started tutorial](https://pytorch.org/executorch/stable/getting-started-setup.html#run-your-program) successfully. ## Outstanding Build Issues Currently, with CMake I can successfully build with the following settings: ``` del -Recurse -Force cmake-out; ` cmake . ` -DCMAKE_INSTALL_PREFIX=cmake-out ` -DPYTHON_EXECUTABLE=C:\\Users\\ssjia\\AppData\\Local\\miniconda3\\python.exe ` -DCMAKE_PREFIX_PATH=C:\\Users\\ssjia\\AppData\\Local\\miniconda3\\Lib\\site-packages ` -DCMAKE_BUILD_TYPE=Release ` -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON ` -DEXECUTORCH_BUILD_PYBIND=ON ` -DEXECUTORCH_BUILD_XNNPACK=ON ` -DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON ` -DEXECUTORCH_BUILD_KERNELS_CUSTOM_AOT=ON ` -DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF ` -T ClangCL ` -Bcmake-out; ` cmake --build cmake-out -j64 --target install ``` If I switch `EXECUTORCH_BUILD_KERNELS_CUSTOM` to `ON`, then the build fails. The primary offenders appear to be the `gelu`. The implementation includes a header from ATen which is causing the majority of the errors.
S
Sicheng Stephen Jia committed
3137889bdf42bf5a83a6853f3429dad5d9bbf5fc
Parent: d44d6cd
Committed by GitHub <noreply@github.com>
on 3/14/2025, 11:36:01 PM