Skip to content

Commit d2e49e0

Browse files
[release/1.6] Fix the Windows CUDA CI jobs (cherry-pick #24238) (#24266)
Cherry-pick of #24238 onto `release/1.6`, preserving the original author and recording the merged source commit `0db7a88ff808ecd39fc61e794952cbe033bb4619`. This brings all five Windows CUDA fixes to the release: the distutils logging call, CUDA 13.2 selection for the installed runner toolkits, copying the required ExecuTorch DLLs beside the example runners, driver installation and reliable model-test failure checks, and the test-infra pin that supports final Python 3.15 wheel builds. Linux model exports retain CUDA 13.0. Validation: the cherry-pick applied without conflicts and its stable patch ID matches the merged source commit exactly. Both changed workflows parse, `setup.py` parses, and `git diff --check` passes. A merge-tree check with the open release dependency PR #24199 is clean. Windows GPU tests and wheel builds require CI. Cherry-pick prepared with Codex assistance; original implementation by Anthony Shoumikhin. Co-authored-by: Anthony Shoumikhin <anthony@shoumikh.in>
1 parent 5699c08 commit d2e49e0

11 files changed

Lines changed: 55 additions & 30 deletions

File tree

‎.ci/scripts/test_model_e2e_windows.ps1‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ function Download-IfNeeded {
133133
Push-Location $executorchRoot
134134
try {
135135
Write-Host "::group::Check CUDA toolchain"
136+
# The GPU runners come without a driver, and every CUDA call fails without one.
137+
& (Join-Path -Path $scriptDir -ChildPath "install_nvidia_driver_windows.ps1")
136138
$nvccOutput = nvcc --version | Out-String
137139
Write-Host $nvccOutput
138140
$nvidiaSmiCmd = Get-Command nvidia-smi -ErrorAction SilentlyContinue
@@ -299,7 +301,8 @@ try {
299301
-RedirectStandardOutput $stdoutFile `
300302
-RedirectStandardError $stderrFile
301303

302-
$stdout = if (Test-Path -Path $stdoutFile -PathType Leaf) { Get-Content -Path $stdoutFile -Raw } else { "" }
304+
# [string] because Get-Content returns nothing for an empty file, and matching against nothing never fails.
305+
$stdout = if (Test-Path -Path $stdoutFile -PathType Leaf) { [string](Get-Content -Path $stdoutFile -Raw) } else { "" }
303306
$stderr = if (Test-Path -Path $stderrFile -PathType Leaf) { Get-Content -Path $stderrFile -Raw } else { "" }
304307
$exitCode = $proc.ExitCode
305308
}
@@ -313,7 +316,7 @@ try {
313316
Write-Host $stderr
314317

315318
if ($exitCode -ne 0) {
316-
Write-Warning "Runner exited with code $exitCode (may be benign)"
319+
throw "Runner exited with code $exitCode"
317320
}
318321

319322
if ($expectedOutput -ne "") {

‎.github/workflows/build-wheels-cuda-windows.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ jobs:
9494
repository: ${{ matrix.repository }}
9595
ref: ""
9696
test-infra-repository: pytorch/test-infra
97-
# Avoid the unsatisfiable conda upgrade in the Windows runner's base env.
97+
# Avoid the unsatisfiable conda upgrade in the Windows runner's base env, and the
98+
# Python 3.15 release candidate download that fails on the current runner image.
9899
# https://github.com/pytorch/test-infra/pull/9179
99-
test-infra-ref: e3d344d886a7281f6a919115d332df2a080da8ad
100+
# https://github.com/pytorch/test-infra/pull/9265
101+
test-infra-ref: b46669025788e540ed4ecc7c56cc52db343e284f
100102
build-matrix: ${{ needs.filter-matrix.outputs.matrix }}
101103
pre-script: ${{ matrix.pre-script }}
102104
env-script: ${{ matrix.env-script }}

‎.github/workflows/cuda-windows.yml‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ on:
1717
- backends/cuda/**
1818
- backends/aoti/**
1919
- extension/cuda/**
20-
# Read only by unittest-cuda-runtime-windows; the other jobs filter on
21-
# their own paths and stay skipped.
20+
# Only unittest-cuda-runtime-windows runs for these alone; the other jobs
21+
# filter on their own paths and stay skipped.
2222
- .ci/scripts/test_cuda_runtime_windows.ps1
2323
- .ci/scripts/install_nvidia_driver_windows.ps1
2424
- tools/cmake/Test.cmake
@@ -202,7 +202,10 @@ jobs:
202202
timeout: 240
203203
runner: windows.g5.4xlarge.nvidia.gpu
204204
gpu-arch-type: cuda
205-
gpu-arch-version: "13.0"
205+
# The Windows runner image carries only the toolkits the CUDA wheels are built for,
206+
# 13.2 and 13.4, so this cannot match the export's 13.0. The exported program loads
207+
# cudart64_13.dll, which every CUDA 13 toolkit provides.
208+
gpu-arch-version: "13.2"
206209
download-artifact: ${{ matrix.model_repo }}-${{ matrix.model_name }}-cuda-windows-${{ matrix.quant }}
207210
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
208211
script: |
@@ -214,7 +217,7 @@ jobs:
214217
\$ErrorActionPreference = 'Stop'
215218
\$PSNativeCommandUseErrorActionPreference = \$true
216219
217-
\$env:CUDA_HOME = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0'
220+
\$env:CUDA_HOME = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2'
218221
\$env:CUDA_PATH = \$env:CUDA_HOME
219222
\$env:PATH = \"\$env:CUDA_HOME\bin;\$env:PATH\"
220223
nvcc --version
@@ -225,7 +228,7 @@ jobs:
225228
throw 'RUNNER_ARTIFACT_DIR is empty. Ensure download-artifact is configured for windows_job.yml.'
226229
}
227230
228-
.ci/scripts/test_model_e2e_windows.ps1 -Device cuda-windows -HfModel '${{ matrix.model_repo }}/${{ matrix.model_name }}' -QuantName '${{ matrix.quant }}' -ModelDir \$artifactDir -ExpectedCudaVersion '13.0'
231+
.ci/scripts/test_model_e2e_windows.ps1 -Device cuda-windows -HfModel '${{ matrix.model_repo }}/${{ matrix.model_name }}' -QuantName '${{ matrix.quant }}' -ModelDir \$artifactDir -ExpectedCudaVersion '13.2'
229232
}"
230233
231234
# The counterpart of cuda.yml's unittest-cuda-runtime on Windows. The Windows GPU runners
@@ -248,7 +251,8 @@ jobs:
248251
timeout: 120
249252
runner: windows.g5.4xlarge.nvidia.gpu
250253
gpu-arch-type: cuda
251-
gpu-arch-version: "13.0"
254+
# The same toolkit as test-model-cuda-windows-e2e, for the same reason.
255+
gpu-arch-version: "13.2"
252256
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
253257
script: |
254258
git config --global http.sslBackend openssl
@@ -257,7 +261,7 @@ jobs:
257261
powershell -Command "& {
258262
Set-PSDebug -Trace 1
259263
\$ErrorActionPreference = 'Stop'
260-
\$env:CUDA_HOME = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0'
264+
\$env:CUDA_HOME = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2'
261265
\$env:CUDA_PATH = \$env:CUDA_HOME
262266
.ci/scripts/setup-windows.ps1
263267
.ci/scripts/test_cuda_runtime_windows.ps1

‎examples/models/dinov2/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ if(MSVC)
9090
add_custom_command(
9191
TARGET dinov2_runner
9292
POST_BUILD
93-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
94-
$<TARGET_FILE_DIR:dinov2_runner>
95-
COMMENT "Copying aoti_cuda_shims.dll to dinov2_runner directory"
93+
COMMAND
94+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:dinov2_runner>
95+
$<TARGET_FILE_DIR:dinov2_runner>
96+
COMMENT "Copying runtime DLLs to dinov2_runner directory"
97+
COMMAND_EXPAND_LISTS
9698
)
9799
endif()

‎examples/models/nemotron3_diarization/CMakeLists.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ if(MSVC AND EXECUTORCH_BUILD_CUDA)
8080
TARGET nemotron3_diarization_runner
8181
POST_BUILD
8282
COMMAND
83-
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
83+
${CMAKE_COMMAND} -E copy_if_different
84+
$<TARGET_RUNTIME_DLLS:nemotron3_diarization_runner>
8485
$<TARGET_FILE_DIR:nemotron3_diarization_runner>
86+
COMMAND_EXPAND_LISTS
8587
)
8688
endif()
8789
if(EXECUTORCH_BUILD_VULKAN)

‎examples/models/parakeet/CMakeLists.txt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ if(MSVC AND EXECUTORCH_BUILD_CUDA)
151151
TARGET ${parakeet_target}
152152
POST_BUILD
153153
COMMAND
154-
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
154+
${CMAKE_COMMAND} -E copy_if_different
155+
$<TARGET_RUNTIME_DLLS:${parakeet_target}>
155156
$<TARGET_FILE_DIR:${parakeet_target}>
156-
COMMENT "Copying aoti_cuda_shims.dll to ${parakeet_target} directory"
157+
COMMENT "Copying runtime DLLs to ${parakeet_target} directory"
158+
COMMAND_EXPAND_LISTS
157159
)
158160
endforeach()
159161
endif()

‎examples/models/sortformer/CMakeLists.txt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@ if(MSVC AND EXECUTORCH_BUILD_CUDA)
111111
add_custom_command(
112112
TARGET sortformer_runner
113113
POST_BUILD
114-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
115-
$<TARGET_FILE_DIR:sortformer_runner>
116-
COMMENT "Copying aoti_cuda_shims.dll to sortformer_runner directory"
114+
COMMAND
115+
${CMAKE_COMMAND} -E copy_if_different
116+
$<TARGET_RUNTIME_DLLS:sortformer_runner>
117+
$<TARGET_FILE_DIR:sortformer_runner>
118+
COMMENT "Copying runtime DLLs to sortformer_runner directory"
119+
COMMAND_EXPAND_LISTS
117120
)
118121
endif()

‎examples/models/voxtral/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ if(MSVC AND EXECUTORCH_BUILD_CUDA)
141141
add_custom_command(
142142
TARGET voxtral_runner
143143
POST_BUILD
144-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
145-
$<TARGET_FILE_DIR:voxtral_runner>
146-
COMMENT "Copying aoti_cuda_shims.dll to voxtral_runner directory"
144+
COMMAND
145+
${CMAKE_COMMAND} -E copy_if_different
146+
$<TARGET_RUNTIME_DLLS:voxtral_runner> $<TARGET_FILE_DIR:voxtral_runner>
147+
COMMENT "Copying runtime DLLs to voxtral_runner directory"
148+
COMMAND_EXPAND_LISTS
147149
)
148150
endif()

‎examples/models/voxtral_realtime/CMakeLists.txt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,11 @@ if(MSVC AND EXECUTORCH_BUILD_CUDA)
129129
add_custom_command(
130130
TARGET voxtral_realtime_runner
131131
POST_BUILD
132-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
133-
$<TARGET_FILE_DIR:voxtral_realtime_runner>
134-
COMMENT "Copying aoti_cuda_shims.dll to voxtral_realtime_runner directory"
132+
COMMAND
133+
${CMAKE_COMMAND} -E copy_if_different
134+
$<TARGET_RUNTIME_DLLS:voxtral_realtime_runner>
135+
$<TARGET_FILE_DIR:voxtral_realtime_runner>
136+
COMMENT "Copying runtime DLLs to voxtral_realtime_runner directory"
137+
COMMAND_EXPAND_LISTS
135138
)
136139
endif()

‎examples/models/whisper/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ if(MSVC AND EXECUTORCH_BUILD_CUDA)
114114
add_custom_command(
115115
TARGET whisper_runner
116116
POST_BUILD
117-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:aoti_cuda_shims>
118-
$<TARGET_FILE_DIR:whisper_runner>
119-
COMMENT "Copying aoti_cuda_shims.dll to whisper_runner directory"
117+
COMMAND
118+
${CMAKE_COMMAND} -E copy_if_different
119+
$<TARGET_RUNTIME_DLLS:whisper_runner> $<TARGET_FILE_DIR:whisper_runner>
120+
COMMENT "Copying runtime DLLs to whisper_runner directory"
121+
COMMAND_EXPAND_LISTS
120122
)
121123
endif()

0 commit comments

Comments
 (0)