Skip to content

Commit 16f9c58

Browse files
authored
coverage: repair the Windows coverage wheels (#2508)
Windows coverage has not collected a test since 2026-03-17. The job builds its wheels with a plain `pip wheel`, which never reads [tool.cibuildwheel], so the delvewheel repair every other Windows build performs never ran here. Those wheels import a bare "MSVCP140.dll" and resolve it against whatever the test machine has in System32, which on the coverage runner is 14.00.24215.1, built in 2015. _resource_handles.pyd is compiled by MSVC 14.44 and imports exactly _Mtx_lock and _Mtx_unlock from that DLL -- never _Mtx_init_in_situ, because std::mutex has had a constexpr constructor since VS 2022 17.10. The 2015 runtime still expects that initialisation and dereferences a null handle on the first lock, which _stream.pyx takes while cuda.core is still importing. It is the only extension module in either package that locks a mutex, which is why cuda.bindings and cuda.pathfinder have always passed on the same machine. Repairing the wheels vendors msvcp140 14.44 into cuda_core.libs and rewrites the import tables to match, so the process no longer depends on what the test machine carries. Verified on the coverage runner: 18 failed, 2929 passed, 918 skipped in 346s, against three to seven seconds of dying beforehand, and the first Windows coverage data since March. The same commit pins cuda-bindings to the wheel built one step earlier. PIP_PRE is set so pip will consider that wheel at all -- it carries a .devN version -- but it also admits PyPI's pre-releases, and cuda-bindings 13.4.0b1, published 2026-07-29, outranks the local build. Its cydriver.pxd comes from CTK 13.4 headers where CUmemLocation has a `localized` field, while cuda.core compiles against the 13.3.0 mini-CTK where it does not, so the build has been failing on `error C2039` ever since. Signed-off-by: Rui Luo <ruluo@nvidia.com>
1 parent 559db81 commit 16f9c58

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,34 @@ jobs:
235235
cd cuda_bindings
236236
../.venv/Scripts/pip wheel -v --no-deps . -w ../wheels/
237237
238+
# Pin cuda-bindings to the wheel built above; PIP_PRE, which is what makes
239+
# that .devN wheel visible, would otherwise let a PyPI pre-release win.
238240
- name: Build cuda.core wheel
239241
run: |
240242
export PIP_FIND_LINKS="$(pwd)/wheels"
241243
export PIP_PRE=1
244+
bindings_whl="$(ls ./wheels/cuda_bindings-*.whl | head -1)"
245+
bindings_ver="$(basename "$bindings_whl" | cut -d- -f2)"
246+
echo "cuda-bindings==${bindings_ver%%+*}" > "$GITHUB_WORKSPACE/constraints.txt"
247+
cat "$GITHUB_WORKSPACE/constraints.txt"
248+
export PIP_CONSTRAINT="$GITHUB_WORKSPACE/constraints.txt"
242249
cd cuda_core
243250
../.venv/Scripts/pip wheel -v --no-deps . -w ../wheels/
244251
252+
# Vendor the DLLs these wheels were built against, the way cibuildwheel
253+
# does for every other Windows build. --namespace-pkg is needed because
254+
# `cuda` is a namespace package.
255+
- name: Repair the Windows wheels
256+
run: |
257+
.venv/Scripts/pip install delvewheel
258+
mkdir -p wheels-repaired
259+
for whl in ./wheels/cuda_bindings-*.whl ./wheels/cuda_core-*.whl; do
260+
.venv/Scripts/delvewheel repair --namespace-pkg cuda \
261+
--exclude "torch_cpu.dll;torch_python.dll" \
262+
-w ./wheels-repaired "$whl"
263+
done
264+
mv -f ./wheels-repaired/*.whl ./wheels/
265+
245266
- name: List wheel artifacts
246267
run: |
247268
echo "=== Windows wheel artifacts ==="

0 commit comments

Comments
 (0)