Repository navigation
Conversation
The Windows libtorch CD packages for x86_64 and arm64 were generated with the same filename and uploaded to the same S3 location, so the arm64 build clobbered the x86_64 one. Users downloading the Windows x64 libtorch release actually received Aarch64 binaries (issue pytorch#187812). Root cause: compute_zip_prefix() in .ci/libtorch/extract_libtorch_from_wheel.py returned "libtorch-win-shared-with-deps" for every Windows build regardless of architecture (the docstring named "libtorch-win-arm64-shared-with-deps" but the code never produced it). Both x86_64 and arm64 are CPU builds, so the upload subfolder (DESIRED_CUDA=cpu) and the zip filename were identical, and the S3 object key is the zip filename. The arch-blind naming was introduced in pytorch#174753; the collision became live once the windows-arm64 wheel workflow started running the same extraction (pytorch#181586). The fix threads architecture through the extraction so arm64 produces "libtorch-win-arm64-shared-with-deps-{version}.zip" while x86_64 keeps its existing "libtorch-win-shared-with-deps-{version}.zip" name (preserving the public download URL). generate_libtorch_extraction_configs also gives the arm64 job a distinct build_name so the GitHub artifact and job names no longer alias. Test Plan: Verified the prefix logic for each platform/arch: ``` python -c " import importlib.util spec = importlib.util.spec_from_file_location('m', '.ci/libtorch/extract_libtorch_from_wheel.py') m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m) for arch in ['x86_64','arm64']: print(arch, '->', m.compute_zip_prefix('windows','cpu','shared-with-deps',arch)) " # x86_64 -> libtorch-win-shared-with-deps # arm64 -> libtorch-win-arm64-shared-with-deps ``` Regenerated the binary build workflows and confirmed the windows-arm64 wheel workflow now passes --arch arm64 and uploads a distinct libtorch-arm64-cpu-shared-with-deps-release artifact, while the x86_64 workflow is unchanged apart from an explicit --arch x86_64: ``` python .github/scripts/generate_ci_workflows.py ``` This PR was authored with the assistance of an AI coding assistant (Claude Code).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/187837
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 3 Unclassified FailuresAs of commit e65861a with merge base dbd6811 ( 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. |
a6917ba to
e65861a
Compare
|
@pytorchmergebot merge -f "build and lint looks good" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
## Problem
The libtorch branch of `validate_binaries.sh` only downloaded and
unzipped the package, then `exit 0` with no verification:
```bash
if [[ ${MATRIX_PACKAGE_TYPE} == "libtorch" ]]; then
curl "${MATRIX_INSTALLATION}" -o libtorch.zip
unzip libtorch.zip
exit 0
fi
```
So the arch mismatch in pytorch/pytorch#187812 -- where the Windows
x86_64 libtorch package was overwritten by the arm64 build and shipped
Aarch64 binaries under the x64 download URL -- slipped through
validation entirely.
## Fix
After unzip, read the machine field directly from the extracted `c10`
library header (PE on Windows, ELF on Linux, Mach-O on macOS) and fail
validation if it doesn't match the runner architecture. This is shared
by the linux/windows/macos validate workflows, so all are covered.
- Dependency-free: uses the runner's `python` and parses the binary
header directly (no `file(1)`, which isn't reliably present on Windows
runners).
- Skips gracefully if the c10 library or python can't be found.
The upstream packaging fix is pytorch/pytorch#187837; this is the
validation-side guard so a future regression is caught before release
rather than by users.
## Test Plan
Verified header parsing against a real ELF binary and synthetic PE/ELF
headers with arm64 machine fields:
```
real /bin/ls on x86_64 host -> x86_64 (matches, passes)
synthetic AArch64 ELF (e_machine=0xB7) -> arm64 (mismatch on x64 runner, fails)
synthetic ARM64 PE (machine=0xAA64) -> arm64 (mismatch on x64 runner, fails)
```
Confirmed the script still parses: `bash -n
.github/scripts/validate_binaries.sh`.
This change was authored with the assistance of an AI coding assistant
(Claude Code).
---------
Co-authored-by: Andrey Talman <[email protected]>
|
@pytorchbot cherry-pick --onto release/2.13 -c critical |
Cherry picking #187837The cherry pick PR is at #187973 and it is recommended to link a critical cherry pick PR with an issue. The following tracker issues are updated: Details for Dev Infra teamRaised by workflow job |
…#187973) Fix Windows libtorch x86_64 and arm64 packages overwriting each other (#187837) Fixes #187812 ## Problem The Windows libtorch CD packages for x86_64 and arm64 are generated with the **same filename** and uploaded to the **same S3 location**, so the arm64 build clobbers the x86_64 one. Users downloading the Windows x64 libtorch release actually receive Aarch64 binaries (`c10.dll: PE32+ executable (DLL) (GUI) Aarch64`). ## Root cause `compute_zip_prefix()` in `.ci/libtorch/extract_libtorch_from_wheel.py` returned `libtorch-win-shared-with-deps` for every Windows build regardless of architecture (the docstring even named `libtorch-win-arm64-shared-with-deps`, but the code never produced it). Both x86_64 and arm64 are CPU builds, so the upload subfolder (`DESIRED_CUDA=cpu`) and the zip filename were identical, and the S3 object key is the zip filename. The arch-blind naming was introduced in #174753 (which added the wheel-extraction approach); the collision became live once the windows-arm64 wheel workflow started running the same extraction in #181586. ## Fix Thread architecture through the extraction so arm64 produces `libtorch-win-arm64-shared-with-deps-{version}.zip` while x86_64 keeps its existing `libtorch-win-shared-with-deps-{version}.zip` name (preserving the public download URL). `generate_libtorch_extraction_configs` also gives the arm64 job a distinct `build_name` so the GitHub artifact and job names no longer alias. ## Test Plan Verified prefix logic: ``` x86_64 -> libtorch-win-shared-with-deps arm64 -> libtorch-win-arm64-shared-with-deps ``` Regenerated the binary build workflows (`python .github/scripts/generate_ci_workflows.py`); the windows-arm64 wheel workflow now passes `--arch arm64` and uploads a distinct `libtorch-arm64-cpu-shared-with-deps-release` artifact, while the x86_64 workflow is unchanged apart from an explicit `--arch x86_64`. This PR was authored with the assistance of an AI coding assistant (Claude Code). Pull Request resolved: #187837 Approved by: https://github.com/Skylion007, https://github.com/huydhn, https://github.com/malfet (cherry picked from commit 599fb5c) Co-authored-by: atalman <[email protected]>
…pytorch#187837) Fixes pytorch#187812 ## Problem The Windows libtorch CD packages for x86_64 and arm64 are generated with the **same filename** and uploaded to the **same S3 location**, so the arm64 build clobbers the x86_64 one. Users downloading the Windows x64 libtorch release actually receive Aarch64 binaries (`c10.dll: PE32+ executable (DLL) (GUI) Aarch64`). ## Root cause `compute_zip_prefix()` in `.ci/libtorch/extract_libtorch_from_wheel.py` returned `libtorch-win-shared-with-deps` for every Windows build regardless of architecture (the docstring even named `libtorch-win-arm64-shared-with-deps`, but the code never produced it). Both x86_64 and arm64 are CPU builds, so the upload subfolder (`DESIRED_CUDA=cpu`) and the zip filename were identical, and the S3 object key is the zip filename. The arch-blind naming was introduced in pytorch#174753 (which added the wheel-extraction approach); the collision became live once the windows-arm64 wheel workflow started running the same extraction in pytorch#181586. ## Fix Thread architecture through the extraction so arm64 produces `libtorch-win-arm64-shared-with-deps-{version}.zip` while x86_64 keeps its existing `libtorch-win-shared-with-deps-{version}.zip` name (preserving the public download URL). `generate_libtorch_extraction_configs` also gives the arm64 job a distinct `build_name` so the GitHub artifact and job names no longer alias. ## Test Plan Verified prefix logic: ``` x86_64 -> libtorch-win-shared-with-deps arm64 -> libtorch-win-arm64-shared-with-deps ``` Regenerated the binary build workflows (`python .github/scripts/generate_ci_workflows.py`); the windows-arm64 wheel workflow now passes `--arch arm64` and uploads a distinct `libtorch-arm64-cpu-shared-with-deps-release` artifact, while the x86_64 workflow is unchanged apart from an explicit `--arch x86_64`. This PR was authored with the assistance of an AI coding assistant (Claude Code). Pull Request resolved: pytorch#187837 Approved by: https://github.com/Skylion007, https://github.com/huydhn, https://github.com/malfet
…pytorch#187837) Fixes pytorch#187812 ## Problem The Windows libtorch CD packages for x86_64 and arm64 are generated with the **same filename** and uploaded to the **same S3 location**, so the arm64 build clobbers the x86_64 one. Users downloading the Windows x64 libtorch release actually receive Aarch64 binaries (`c10.dll: PE32+ executable (DLL) (GUI) Aarch64`). ## Root cause `compute_zip_prefix()` in `.ci/libtorch/extract_libtorch_from_wheel.py` returned `libtorch-win-shared-with-deps` for every Windows build regardless of architecture (the docstring even named `libtorch-win-arm64-shared-with-deps`, but the code never produced it). Both x86_64 and arm64 are CPU builds, so the upload subfolder (`DESIRED_CUDA=cpu`) and the zip filename were identical, and the S3 object key is the zip filename. The arch-blind naming was introduced in pytorch#174753 (which added the wheel-extraction approach); the collision became live once the windows-arm64 wheel workflow started running the same extraction in pytorch#181586. ## Fix Thread architecture through the extraction so arm64 produces `libtorch-win-arm64-shared-with-deps-{version}.zip` while x86_64 keeps its existing `libtorch-win-shared-with-deps-{version}.zip` name (preserving the public download URL). `generate_libtorch_extraction_configs` also gives the arm64 job a distinct `build_name` so the GitHub artifact and job names no longer alias. ## Test Plan Verified prefix logic: ``` x86_64 -> libtorch-win-shared-with-deps arm64 -> libtorch-win-arm64-shared-with-deps ``` Regenerated the binary build workflows (`python .github/scripts/generate_ci_workflows.py`); the windows-arm64 wheel workflow now passes `--arch arm64` and uploads a distinct `libtorch-arm64-cpu-shared-with-deps-release` artifact, while the x86_64 workflow is unchanged apart from an explicit `--arch x86_64`. This PR was authored with the assistance of an AI coding assistant (Claude Code). Pull Request resolved: pytorch#187837 Approved by: https://github.com/Skylion007, https://github.com/huydhn, https://github.com/malfet
Fixes #187812
Problem
The Windows libtorch CD packages for x86_64 and arm64 are generated with the same filename and uploaded to the same S3 location, so the arm64 build clobbers the x86_64 one. Users downloading the Windows x64 libtorch release actually receive Aarch64 binaries (
c10.dll: PE32+ executable (DLL) (GUI) Aarch64).Root cause
compute_zip_prefix()in.ci/libtorch/extract_libtorch_from_wheel.pyreturnedlibtorch-win-shared-with-depsfor every Windows build regardless of architecture (the docstring even namedlibtorch-win-arm64-shared-with-deps, but the code never produced it). Both x86_64 and arm64 are CPU builds, so the upload subfolder (DESIRED_CUDA=cpu) and the zip filename were identical, and the S3 object key is the zip filename.The arch-blind naming was introduced in #174753 (which added the wheel-extraction approach); the collision became live once the windows-arm64 wheel workflow started running the same extraction in #181586.
Fix
Thread architecture through the extraction so arm64 produces
libtorch-win-arm64-shared-with-deps-{version}.zipwhile x86_64 keeps its existinglibtorch-win-shared-with-deps-{version}.zipname (preserving the public download URL).generate_libtorch_extraction_configsalso gives the arm64 job a distinctbuild_nameso the GitHub artifact and job names no longer alias.Test Plan
Verified prefix logic:
Regenerated the binary build workflows (
python .github/scripts/generate_ci_workflows.py); the windows-arm64 wheel workflow now passes--arch arm64and uploads a distinctlibtorch-arm64-cpu-shared-with-deps-releaseartifact, while the x86_64 workflow is unchanged apart from an explicit--arch x86_64.This PR was authored with the assistance of an AI coding assistant (Claude Code).