Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/182123
Note: Links to docs will display an error until the docs builds have been completed. ❌ 8 Unclassified FailuresAs of commit c88fe3d with merge base aea5576 ( UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @zklaus please provide details why its needed and what are affected builds. Is it only Windows X86 or Windows ARM. |
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Successfully rebased |
b88eec0 to
2f78081
Compare
Disable test building and default to Release mode in the Windows CI setup script for both libtorch and pytorch build paths. Co-Generated with [Claude Code](https://claude.com/claude-code)
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 8 checks: linux-binary-manywheel / manywheel-py3_15-xpu-build / build, linux-binary-manywheel / manywheel-py3_13-xpu-build / build, linux-binary-manywheel / manywheel-py3_15t-xpu-build / build, linux-binary-manywheel / manywheel-py3_11-xpu-build / build, linux-binary-manywheel / manywheel-py3_10-xpu-build / build, linux-binary-manywheel / manywheel-py3_12-xpu-build / build, linux-binary-manywheel / manywheel-py3_14t-xpu-build / build, linux-binary-manywheel / manywheel-py3_14-xpu-build / build Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…pytorch#182123) In pytorch#179024 (and later pytorch#182647) it was surfaced that test artifacts like `aoti_custom_ops.dll` should not be installed in Windows wheel building because the way that symbol resolution is done eagerly on that platform means that the resulting wheels would not be functional. But if these shared libraries are not installed, we also don't need to build them, hence this PR proposes to not do that. Disable test building and default to Release mode in the Windows CI setup script for both libtorch and pytorch build paths. Co-Generated with [Claude Code](https://claude.com/claude-code) Replaces pytorch#180246 Pull Request resolved: pytorch#182123 Approved by: https://github.com/atalman
The legacy Windows CD wheel path set BUILD_TEST=0 in internal/setup.bat's :pytorch branch (added by pytorchgh-182123) so the C++ test binaries are not compiled during binary wheel builds. The Python pipeline that replaced that bat chain carried INSTALL_TEST=0 but dropped BUILD_TEST=0, so every Windows CD wheel build was recompiling the test executables for no reason. Restore it in COMMON_BUILD_ENV, matching the Linux sibling .ci/manywheel/build_env_setup.py. BUILD_TEST and INSTALL_TEST are distinct: INSTALL_TEST controls whether test binaries are bundled into the wheel; BUILD_TEST controls whether they are compiled at all. Both belong in the binary-build env. Test Plan: - lintrunner -a (clean). - Surfaced by a port-fidelity diff of the deleted setup.bat against the new COMMON_BUILD_ENV; BUILD_TEST=0 was present on the legacy :pytorch branch (setup.bat:90) and absent from the Python pipeline. Authored with assistance from Claude.
The legacy Windows CD wheel path set BUILD_TEST=0 in internal/setup.bat's :pytorch branch (added by pytorchgh-182123) so the C++ test binaries are not compiled during binary wheel builds. The Python pipeline that replaced that bat chain carried INSTALL_TEST=0 but dropped BUILD_TEST=0, so every Windows CD wheel build was recompiling the test executables for no reason. Restore it in COMMON_BUILD_ENV, matching the Linux sibling .ci/manywheel/build_env_setup.py. BUILD_TEST and INSTALL_TEST are distinct: INSTALL_TEST controls whether test binaries are bundled into the wheel; BUILD_TEST controls whether they are compiled at all. Both belong in the binary-build env. Test Plan: - lintrunner -a (clean). - Surfaced by a port-fidelity diff of the deleted setup.bat against the new COMMON_BUILD_ENV; BUILD_TEST=0 was present on the legacy :pytorch branch (setup.bat:90) and absent from the Python pipeline. Authored with assistance from Claude.
The legacy Windows CD wheel path set BUILD_TEST=0 in internal/setup.bat's :pytorch branch (added by pytorchgh-182123) so the C++ test binaries are not compiled during binary wheel builds. The Python pipeline that replaced that bat chain carried INSTALL_TEST=0 but dropped BUILD_TEST=0, so every Windows CD wheel build was recompiling the test executables for no reason. Restore it in COMMON_BUILD_ENV, matching the Linux sibling .ci/manywheel/build_env_setup.py. BUILD_TEST and INSTALL_TEST are distinct: INSTALL_TEST controls whether test binaries are bundled into the wheel; BUILD_TEST controls whether they are compiled at all. Both belong in the binary-build env. Test Plan: - lintrunner -a (clean). - Surfaced by a port-fidelity diff of the deleted setup.bat against the new COMMON_BUILD_ENV; BUILD_TEST=0 was present on the legacy :pytorch branch (setup.bat:90) and absent from the Python pipeline. Authored with assistance from Claude.
…pytorch#182123) In pytorch#179024 (and later pytorch#182647) it was surfaced that test artifacts like `aoti_custom_ops.dll` should not be installed in Windows wheel building because the way that symbol resolution is done eagerly on that platform means that the resulting wheels would not be functional. But if these shared libraries are not installed, we also don't need to build them, hence this PR proposes to not do that. Disable test building and default to Release mode in the Windows CI setup script for both libtorch and pytorch build paths. Co-Generated with [Claude Code](https://claude.com/claude-code) Replaces pytorch#180246 Pull Request resolved: pytorch#182123 Approved by: https://github.com/atalman
…pytorch#182123) In pytorch#179024 (and later pytorch#182647) it was surfaced that test artifacts like `aoti_custom_ops.dll` should not be installed in Windows wheel building because the way that symbol resolution is done eagerly on that platform means that the resulting wheels would not be functional. But if these shared libraries are not installed, we also don't need to build them, hence this PR proposes to not do that. Disable test building and default to Release mode in the Windows CI setup script for both libtorch and pytorch build paths. Co-Generated with [Claude Code](https://claude.com/claude-code) Replaces pytorch#180246 Pull Request resolved: pytorch#182123 Approved by: https://github.com/atalman
On Windows, `_load_dll_libraries` loads every DLL in torch/lib at import time. The glob was added in pytorch#35362 (2020-03) because `caffe2_nvrtc.dll` was loaded lazily by name from `CUDAHooks.cpp`, and plain `LoadLibraryW` does not search directories registered with `AddDllDirectory`, so the by-name load failed on Python 3.8. Two later changes made that moot: pytorch#45674 (2020-10) switched CUDA builds to the in-tree LazyNVRTC, so `caffe2_nvrtc.dll` is only loaded by name on ROCm, and pytorch#49781 (2021-01) switched `at::DynamicLibrary` to `LoadLibraryExW` with `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, which does search the directories that `os.add_dll_directory` registers. The preload also has a cost: it loads libraries that are only meant to be loaded on demand, such as the INSTALL_TEST libraries (`aoti_custom_ops`, `torchbind_test`, `jitbackend_test`, `backend_with_compiler`), and any failure in one of them aborts `import torch` (pytorch#199894, pytorch#179024, pytorch#182123). This PR removes the glob and the fallback PATH patching that only mattered on systems without `AddDllDirectory`, keeping `os.add_dll_directory` for torch/lib and the other DLL directories. Everything that remains in torch/lib is a link-time dependency of `_C.pyd` or of a library it pulls in, which Windows resolves through the registered directories. Test Plan Trunk CI has no Windows CUDA test shards (removed in pytorch#139336); the Windows CPU build and all its test shards pass with this change, and the Windows CUDA build passes. The CUDA side was verified on a Windows 11 VM with an RTX 2060 (driver 610.88) using the 2026-10-26 cu132 nightly wheel with this change applied to its `torch/__init__.py`: import, `torch.cuda.is_available()`, cuDNN conv2d, cuBLAS matmul, cuFFT, cuRAND, cuSOLVER and a jiterator (NVRTC) kernel all pass, 8 of the 13 DLLs in torch/lib end up resident, and a deliberately broken stray DLL in torch/lib no longer aborts the import (with the glob it fails with WinError 193). Lint: ``` lintrunner -a torch/__init__.py ``` Authored with an AI assistant (Claude Code); the analysis and the change were reviewed by the human author. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Linked issue or supporting maintainer Part of #199894. Supersedes #200856 and #199925: without the preload there is no list of test-only DLLs to maintain. ## BC-breaking? No for the supported configurations. `import torch` no longer preloads every DLL in `torch/lib`; libraries that are loaded on demand are now loaded only on demand, and the `PATH` fallback for systems without `AddDllDirectory` (pre Windows 8 without KB2533623) is gone. ## Summary (human written only) On Windows we are preloading all libraries in torch/lib. This is somewhat costly and leads to occasional problems. Furthermore, it is likely no longer necessary because the loading code has become smarter and is now able to load dependencies on demand. This PR is here to test that hypothesis in CI. ## Agent details (if applicable) Analysis and change prepared with Claude Code, reviewed by me. The commit message carries the full reasoning. Agent notes: The Windows loader has preloaded every DLL in `torch/lib` since #35362, because `caffe2_nvrtc.dll` was loaded by name from `CUDAHooks.cpp` and plain `LoadLibraryW` did not search directories registered with `AddDllDirectory`. Two later changes made that moot: #45674 (2020-10) switched CUDA builds to the in-tree LazyNVRTC, so `caffe2_nvrtc.dll` is only loaded by name on ROCm, and #49781 (2021-01) moved `at::DynamicLibrary` to `LoadLibraryExW` with `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, which searches what `os.add_dll_directory` registers. Meanwhile the preload keeps turning on-demand libraries into import-time failures (#199894, #179024, #182123). The glob only ever preloaded torch's own DLLs with the default search flags; the NVIDIA wheel directories come from the cuda-pathfinder loop (and, on CI, from the toolkit bin dir fallback), which this PR does not touch. Tested on hardware, since trunk has had no Windows CUDA test shards since #139336: Windows 11 VM with an RTX 2060 (driver 610.88), 2026-10-26 cu132 nightly wheel, `torch/__init__.py` replaced by this PR's version (hash-checked against the base commit). Results: - With the stock cuda-pathfinder 1.8.4 the import fails on a clean machine with and without this change, for a reason outside this PR (below). The failure point moves from a `WinError 126` on `shm.dll` in the glob to "DLL load failed while importing _C". - With a per-library `try` in the pathfinder loop (not part of this PR), import, `torch.cuda.is_available()`, cuDNN conv2d, cuBLAS matmul, cuFFT, cuRAND, cuSOLVER and a jiterator kernel (NVRTC) all pass with the glob removed. 8 of 13 `torch/lib` DLLs are resident afterwards; `caffe2_nvrtc`, `torch_global_deps`, `nvToolsExt64_1`, `libiompstubs5md` and `torch.dll` were never needed. - The #199894 mechanism reproduces: a broken stray `zz_broken_test.dll` in `torch/lib` aborts `import torch` with the glob (WinError 193) and is ignored without it. Found on the way, independent of this PR: the stock cu132 Windows nightly does not import on a clean machine. `nvidia-cuda-cupti` 13.2.86 ships `cupti64_2026.1.2.dll`, which cuda-pathfinder 1.8.4 does not know; the pathfinder loop in `torch/__init__.py` is one `try` around all eleven libraries, so the CUPTI miss also skips cuDNN, `nvidia\cudnn\bin` is never registered, and `cudnn64_9.dll` (a static import of `torch_python.dll` and `torch_cuda.dll`) cannot be found. CUPTI itself still resolves, because a later library in the loop registers the shared `nvidia\cu13\bin` directory. CI does not see this: the Windows CUDA wheel smoke test runs on a T4 with the CUDA toolkit and cuDNN installed under Program Files, and `torch/__init__.py` adds that directory to the search path. A per-library `try` fixes the import with a warning; a pathfinder release that knows the name fixes it silently. CI on this PR: the full CPU suite on the 12 `win-vs2022-cpu-py3` shards, the `win-vs2022-cuda13.2-py3` build, and the `binaries_wheel` smoke tests for every Python version (CUDA wheels on a T4: import, CUDA tensor, magma, cuDNN, RNN and CNN smoke; XPU wheels import on CPU runners). Not covered: the full CUDA test suite on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: #202206 Approved by: https://github.com/atalman
## Linked issue or supporting maintainer Part of pytorch#199894. Supersedes pytorch#200856 and pytorch#199925: without the preload there is no list of test-only DLLs to maintain. ## BC-breaking? No for the supported configurations. `import torch` no longer preloads every DLL in `torch/lib`; libraries that are loaded on demand are now loaded only on demand, and the `PATH` fallback for systems without `AddDllDirectory` (pre Windows 8 without KB2533623) is gone. ## Summary (human written only) On Windows we are preloading all libraries in torch/lib. This is somewhat costly and leads to occasional problems. Furthermore, it is likely no longer necessary because the loading code has become smarter and is now able to load dependencies on demand. This PR is here to test that hypothesis in CI. ## Agent details (if applicable) Analysis and change prepared with Claude Code, reviewed by me. The commit message carries the full reasoning. Agent notes: The Windows loader has preloaded every DLL in `torch/lib` since pytorch#35362, because `caffe2_nvrtc.dll` was loaded by name from `CUDAHooks.cpp` and plain `LoadLibraryW` did not search directories registered with `AddDllDirectory`. Two later changes made that moot: pytorch#45674 (2020-10) switched CUDA builds to the in-tree LazyNVRTC, so `caffe2_nvrtc.dll` is only loaded by name on ROCm, and pytorch#49781 (2021-01) moved `at::DynamicLibrary` to `LoadLibraryExW` with `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, which searches what `os.add_dll_directory` registers. Meanwhile the preload keeps turning on-demand libraries into import-time failures (pytorch#199894, pytorch#179024, pytorch#182123). The glob only ever preloaded torch's own DLLs with the default search flags; the NVIDIA wheel directories come from the cuda-pathfinder loop (and, on CI, from the toolkit bin dir fallback), which this PR does not touch. Tested on hardware, since trunk has had no Windows CUDA test shards since pytorch#139336: Windows 11 VM with an RTX 2060 (driver 610.88), 2026-10-26 cu132 nightly wheel, `torch/__init__.py` replaced by this PR's version (hash-checked against the base commit). Results: - With the stock cuda-pathfinder 1.8.4 the import fails on a clean machine with and without this change, for a reason outside this PR (below). The failure point moves from a `WinError 126` on `shm.dll` in the glob to "DLL load failed while importing _C". - With a per-library `try` in the pathfinder loop (not part of this PR), import, `torch.cuda.is_available()`, cuDNN conv2d, cuBLAS matmul, cuFFT, cuRAND, cuSOLVER and a jiterator kernel (NVRTC) all pass with the glob removed. 8 of 13 `torch/lib` DLLs are resident afterwards; `caffe2_nvrtc`, `torch_global_deps`, `nvToolsExt64_1`, `libiompstubs5md` and `torch.dll` were never needed. - The pytorch#199894 mechanism reproduces: a broken stray `zz_broken_test.dll` in `torch/lib` aborts `import torch` with the glob (WinError 193) and is ignored without it. Found on the way, independent of this PR: the stock cu132 Windows nightly does not import on a clean machine. `nvidia-cuda-cupti` 13.2.86 ships `cupti64_2026.1.2.dll`, which cuda-pathfinder 1.8.4 does not know; the pathfinder loop in `torch/__init__.py` is one `try` around all eleven libraries, so the CUPTI miss also skips cuDNN, `nvidia\cudnn\bin` is never registered, and `cudnn64_9.dll` (a static import of `torch_python.dll` and `torch_cuda.dll`) cannot be found. CUPTI itself still resolves, because a later library in the loop registers the shared `nvidia\cu13\bin` directory. CI does not see this: the Windows CUDA wheel smoke test runs on a T4 with the CUDA toolkit and cuDNN installed under Program Files, and `torch/__init__.py` adds that directory to the search path. A per-library `try` fixes the import with a warning; a pathfinder release that knows the name fixes it silently. CI on this PR: the full CPU suite on the 12 `win-vs2022-cpu-py3` shards, the `win-vs2022-cuda13.2-py3` build, and the `binaries_wheel` smoke tests for every Python version (CUDA wheels on a T4: import, CUDA tensor, magma, cuDNN, RNN and CNN smoke; XPU wheels import on CPU runners). Not covered: the full CUDA test suite on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: pytorch#202206 Approved by: https://github.com/atalman
## Linked issue or supporting maintainer Part of pytorch#199894. Supersedes pytorch#200856 and pytorch#199925: without the preload there is no list of test-only DLLs to maintain. ## BC-breaking? No for the supported configurations. `import torch` no longer preloads every DLL in `torch/lib`; libraries that are loaded on demand are now loaded only on demand, and the `PATH` fallback for systems without `AddDllDirectory` (pre Windows 8 without KB2533623) is gone. ## Summary (human written only) On Windows we are preloading all libraries in torch/lib. This is somewhat costly and leads to occasional problems. Furthermore, it is likely no longer necessary because the loading code has become smarter and is now able to load dependencies on demand. This PR is here to test that hypothesis in CI. ## Agent details (if applicable) Analysis and change prepared with Claude Code, reviewed by me. The commit message carries the full reasoning. Agent notes: The Windows loader has preloaded every DLL in `torch/lib` since pytorch#35362, because `caffe2_nvrtc.dll` was loaded by name from `CUDAHooks.cpp` and plain `LoadLibraryW` did not search directories registered with `AddDllDirectory`. Two later changes made that moot: pytorch#45674 (2020-10) switched CUDA builds to the in-tree LazyNVRTC, so `caffe2_nvrtc.dll` is only loaded by name on ROCm, and pytorch#49781 (2021-01) moved `at::DynamicLibrary` to `LoadLibraryExW` with `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, which searches what `os.add_dll_directory` registers. Meanwhile the preload keeps turning on-demand libraries into import-time failures (pytorch#199894, pytorch#179024, pytorch#182123). The glob only ever preloaded torch's own DLLs with the default search flags; the NVIDIA wheel directories come from the cuda-pathfinder loop (and, on CI, from the toolkit bin dir fallback), which this PR does not touch. Tested on hardware, since trunk has had no Windows CUDA test shards since pytorch#139336: Windows 11 VM with an RTX 2060 (driver 610.88), 2026-10-26 cu132 nightly wheel, `torch/__init__.py` replaced by this PR's version (hash-checked against the base commit). Results: - With the stock cuda-pathfinder 1.8.4 the import fails on a clean machine with and without this change, for a reason outside this PR (below). The failure point moves from a `WinError 126` on `shm.dll` in the glob to "DLL load failed while importing _C". - With a per-library `try` in the pathfinder loop (not part of this PR), import, `torch.cuda.is_available()`, cuDNN conv2d, cuBLAS matmul, cuFFT, cuRAND, cuSOLVER and a jiterator kernel (NVRTC) all pass with the glob removed. 8 of 13 `torch/lib` DLLs are resident afterwards; `caffe2_nvrtc`, `torch_global_deps`, `nvToolsExt64_1`, `libiompstubs5md` and `torch.dll` were never needed. - The pytorch#199894 mechanism reproduces: a broken stray `zz_broken_test.dll` in `torch/lib` aborts `import torch` with the glob (WinError 193) and is ignored without it. Found on the way, independent of this PR: the stock cu132 Windows nightly does not import on a clean machine. `nvidia-cuda-cupti` 13.2.86 ships `cupti64_2026.1.2.dll`, which cuda-pathfinder 1.8.4 does not know; the pathfinder loop in `torch/__init__.py` is one `try` around all eleven libraries, so the CUPTI miss also skips cuDNN, `nvidia\cudnn\bin` is never registered, and `cudnn64_9.dll` (a static import of `torch_python.dll` and `torch_cuda.dll`) cannot be found. CUPTI itself still resolves, because a later library in the loop registers the shared `nvidia\cu13\bin` directory. CI does not see this: the Windows CUDA wheel smoke test runs on a T4 with the CUDA toolkit and cuDNN installed under Program Files, and `torch/__init__.py` adds that directory to the search path. A per-library `try` fixes the import with a warning; a pathfinder release that knows the name fixes it silently. CI on this PR: the full CPU suite on the 12 `win-vs2022-cpu-py3` shards, the `win-vs2022-cuda13.2-py3` build, and the `binaries_wheel` smoke tests for every Python version (CUDA wheels on a T4: import, CUDA tensor, magma, cuDNN, RNN and CNN smoke; XPU wheels import on CPU runners). Not covered: the full CUDA test suite on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: pytorch#202206 Approved by: https://github.com/atalman
In #179024 (and later #182647) it was surfaced that test artifacts like
aoti_custom_ops.dllshould not be installed in Windows wheel building because the way that symbol resolution is done eagerly on that platform means that the resulting wheels would not be functional.But if these shared libraries are not installed, we also don't need to build them, hence this PR proposes to not do that.
Disable test building and default to Release mode in the Windows CI setup script for both libtorch and pytorch build paths.
Co-Generated with Claude Code
Replaces #180246