Skip to content

Commit d2b3fac

Browse files
committed
Fix Windows wheel build: force CPU-only to avoid CUDA _portable_lib DLL load failure
Same root cause as the unittest fix in this PR, second site. The Windows wheel build (build-wheels-windows.yml -> .ci/scripts/wheel/) does not go through setup-windows.ps1. The Windows CI image has the CUDA 13.2 toolkit on PATH, so after #20440 added (13, 2) to SUPPORTED_CUDA_VERSIONS, install_executorch's auto-detection enables EXECUTORCH_BUILD_CUDA and bakes a CUDA _portable_lib + aoti_cuda_shims.lib into the CPU wheel. The smoke test then fails with: ImportError: DLL load failed while importing _portable_lib Windows wheels are CPU-only (with-cuda: disabled), so force -DEXECUTORCH_BUILD_CUDA=OFF via CMAKE_ARGS in pre_build_script.sh on Windows.
1 parent 952e121 commit d2b3fac

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.ci/scripts/wheel/pre_build_script.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ if [[ $UNAME_S == *"MINGW"* || $UNAME_S == *"MSYS"* ]]; then
5050
echo "Enabling symlinks on Windows"
5151
git config core.symlinks true
5252
git checkout -f HEAD
53+
54+
# Windows wheels are CPU-only (build-wheels-windows.yml sets
55+
# with-cuda: disabled), but the Windows CI image ships a CUDA toolkit on
56+
# PATH, which makes setup.py auto-enable EXECUTORCH_BUILD_CUDA. That bakes a
57+
# CUDA _portable_lib into the CPU wheel, which then fails its DLL load in the
58+
# smoke test ("DLL load failed while importing _portable_lib"). Force a
59+
# CPU-only build.
60+
export CMAKE_ARGS="${CMAKE_ARGS:-} -DEXECUTORCH_BUILD_CUDA=OFF"
61+
echo "CMAKE_ARGS=${CMAKE_ARGS}" >> "${GITHUB_ENV}"
5362
fi
5463

5564
# Manually install build requirements because `python setup.py bdist_wheel` does

0 commit comments

Comments
 (0)