Commit 16ecb3f
authored
Fix Windows unittest CI: force CPU-only build (CUDA 13.2 toolkit on runner breaks _portable_lib load) (#20527)
## Summary
Fixes the Windows unittest CI breakage introduced by #20440 (`Add CUDA
13.2 support and drop unsupported 12.8/12.9`).
`unittest / windows`, `unittest-editable / windows`, and
`unittest-release / windows` have been red on `main` since c0643f5
(parent was green).
## Root cause
The Windows CI image ships CUDA toolkits on `PATH` (it has both `v13.2`
and `v13.0`; `nvcc` resolves to **13.2.78**).
`install_executorch` auto-enables the CUDA backend when
`install_utils.is_cuda_available()` returns True (`setup.py` ~L882-889),
and that check is driven purely by the `nvcc` version being in
`SUPPORTED_CUDA_VERSIONS`.
- **Before #20440:** `13.2 ∉ SUPPORTED_CUDA_VERSIONS` →
`is_cuda_available()` = False → CPU-only build → green.
- **After #20440:** adding `(13, 2)` makes `is_cuda_available()` =
**True** on the Windows runner → `setup.py` flips
`-DEXECUTORCH_BUILD_CUDA=ON`. But the unittest jobs install **CPU**
torch, so the CUDA build of `_portable_lib` can't find its CUDA DLLs:
```
ImportError: DLL load failed while importing _portable_lib: The specified module could not be found.
```
That aborts pytest collection (`24 errors during collection`) and fails
the job.
## Fix
Add a `-cpuOnly` switch to the shared `.ci/scripts/setup-windows.ps1`
that forces `-DEXECUTORCH_BUILD_CUDA=OFF` via `CMAKE_ARGS`, and pass it
from the CPU unittest workflow (`_unittest.yml`). This restores the
pre-#20440 CPU-only behavior for these jobs.
The CUDA Windows jobs (`cuda-windows.yml`) call the same script
**without** `-cpuOnly`, so they are unaffected and keep building CUDA.
## Note / follow-up
The deeper issue is that the auto-detection keys off `nvcc` presence
rather than whether the installed torch is actually a CUDA build. A more
general fix would be to only enable `EXECUTORCH_BUILD_CUDA` when
`torch.version.cuda` is set. Left out here to keep the unblock low-risk;
happy to follow up.1 parent a8cfb75 commit 16ecb3f
3 files changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
16 | 27 | | |
17 | 28 | | |
18 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
0 commit comments