Disable building STABLEHLO and specify USE_MATH_DEFINES for windows builds. (#3805)

I'm trying to build python wheel for windows similar to as done for
linux in https://github.com/llvm/torch-mlir-release/ however turns out
the build process on windows is broken without the following fixes:

1. Building stablehlo for windows fails due to
https://github.com/openxla/stablehlo/issues/1772 -- so disabling
stablehlo in `build_windows_ci.sh` that will be used for building the
python wheels.

2. Add `USE_MATH_DEFINES` to resolve
`torch-mlir\lib\Conversion\TorchOnnxToTorch\DefaultDomainGtoP.cpp(709):
error C2065: 'M_LOG10E': undeclared identifier`
pull/3806/head
Sayan Saha 2024-10-18 15:04:37 -04:00 committed by GitHub
parent 02327af998
commit 09cdbe4c47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,10 @@ macro(torch_mlir_enable_werror)
endif() endif()
endmacro() endmacro()
if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
endif()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Configure out-of-tree vs in-tree build # Configure out-of-tree vs in-tree build
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -14,6 +14,7 @@ cmake -GNinja -Bbuild \
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \
-DPython3_EXECUTABLE="$(which python)" \ -DPython3_EXECUTABLE="$(which python)" \
-DTORCH_MLIR_ENABLE_STABLEHLO=OFF \
$GITHUB_WORKSPACE/externals/llvm-project/llvm $GITHUB_WORKSPACE/externals/llvm-project/llvm
cmake --build build --config Release cmake --build build --config Release