Skip to content

Consolidate CD wheel build pipelines under .ci/wheel/ and unify the numpy pin - #189275

Closed
zklaus wants to merge 12 commits into
pytorch:mainfrom
zklaus:cd-pipeline-unification
Closed

zklaus wants to merge 12 commits into
pytorch:mainfrom
zklaus:cd-pipeline-unification

Conversation

@zklaus

@zklaus zklaus commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The three CD wheel-build pipelines (Linux, Windows, macOS) grew as three
independent Python ports and drifted apart: copy-pasted helpers, three
different numpy build-pin tables, and different directory homes. This PR
consolidates them under a common .ci/wheel/ root with a single shared
_common.py, and reconciles the numpy pin -- fixing a latent bug where
Linux's greedy cp31 prefix silently overrode its own numpy default.

A new .ci/wheel/README.md documents the resulting layout, the shared stage
sequence (including the Linux-CUDA-only native-AOT stage 2 that #194243
added to the Linux orchestrator), and the dependencies that live outside the
tree.

Review order

The commits are a deliberate progression -- three mechanical moves first,
then the semantic change, then cleanup:

  1. Move macOS .ci/macwheel/ -> .ci/wheel/mac/ (pure rename + regen).
  2. Move Linux .ci/manywheel/ -> .ci/wheel/linux/ (pure rename + regen).
  3. Move Windows pipeline -> .ci/wheel/windows/. Unlike Linux/macOS,
    .ci/pytorch/windows/ is a mixed dir: only the 5 CD pipeline files
    move; the shared internal/*.bat installers and arm64/ scripts stay
    (non-CD Windows CI uses them). WIN_CI_DIR is re-anchored to
    .ci/pytorch/windows/ so the runtime workspace is byte-for-byte
    unchanged -- only the source files move.
  4. Share _common.py + unify numpy -- the heart of the PR.
  5. Dedup the build_env_setup.py env helpers into _common.py.
  6. Add the README.
  7. Fix the dynamic Linux paths the string sweep in commit 2 could not
    see (.ci/${PACKAGE_TYPE}/build.sh, the libtorch shim) plus, after the
    rebase onto [native_aot][7/7] build_stage2: relink, patch the wheel, and the build wiring #194243, the native-AOT tests and comments that open
    .ci/manywheel/build.sh by literal path.
  8. Fix depth-sensitive paths inside the moved Linux scripts.
  9. Stop using PACKAGE_TYPE as a directory; drop the dead libtorch shim.
  10. Fall back to an image-provisioned numpy for a Python with no pin.

numpy pin reconciliation

The three tables disagreed for almost every Python. Replaced with one
explicit dict + fail-loud (the design macOS already used):

Python pin
3.10 / 3.11 / 3.12 2.0.2
3.13 2.1.2
3.14 2.3.4
3.15 2.5.2

Each entry is the oldest numpy minor that ships a wheel for that
interpreter, at the newest patch of that minor already shipped in
production by one of the platforms, so no numpy bugfix is dropped. Every
Python currently in the CD matrix has an entry; free-threaded builds share
their base version's pin, and numpy publishes cp31Xt wheels for every
entry above.

Build-time pin changes, per platform (all verified to have a real wheel
on PyPI for every interpreter/platform in the matrix):

Python Linux macOS Windows
3.10 / 3.11 / 3.12 2.1.0 -> 2.0.2 -- --
3.13 2.1.0 -> 2.1.2 2.1.0 -> 2.1.2 --
3.14 / 3.14t -- -- 2.3.2 -> 2.3.4
3.15 / 3.15t -- -- --

Two of these deserve a reviewer's attention:

s390x keeps its own table, now synced. cpu-s390x is the one Linux arch
that does not run the Python pipeline -- build.sh routes it to
build_cpu.sh -> build_common.sh, which pins numpy in shell. That table
had drifted (cp31* -> 2.1.0, so 3.10-3.13 all got 2.1.0) and upstream's
"keep in sync" reminder was attached to the table this PR deletes. It is now
updated to match NUMPY_PINS entry-for-entry, with a cross-reference in both
files. Absorbing s390x into the Python pipeline proper is a sensible
follow-up -- the image already ships /opt/python/cpXXX and
build_common.sh already builds via python -m build -- but it is a
behavioural port of an arch that only a nightly can validate, so it is
deliberately not bundled here.

Linux's incidental --pre is dropped: install_numpy() always emits an
exact numpy==X pin, and pip's prerelease filtering never narrows an exact
specifier -- including one naming a prerelease, since packaging enables
prereleases automatically when the specifier itself references one.

install_numpy() takes passthrough pip args so Windows (#194618) and macOS
(#194734) keep --no-build-isolation on the numpy install. cp315 has no
pyyaml wheel, so PIP_PACKAGES genuinely builds an sdist there and needs
the preinstalled cython<3.3.0 to reach it (PIP_CONSTRAINT cannot -- pip
does not apply it to isolated build environments, which is why #194618
disables isolation instead). numpy resolves to a wheel at the current pin,
which makes those flags inert for that install rather than unnecessary; they
are passed anyway so a future pin without a cp315 wheel stays guarded.

The unpinned-Python fallback checks a snapshot taken when _common.py is
imported, not a probe at call time. It has to: on Linux and macOS the stage
installs requirements-build.txt -- which lists a bare numpy -- before
calling install_numpy(), so a call-time probe would always find one and the
fail-loud branch could never fire.

Note on verification

ciflow/binaries_wheel exercises the build half of these pipelines, and is
running on this PR. What it does not cover is the nightly-only tail:
upload, the libtorch-extract job, and the s390x path. Those parts are
verified by import/path-math simulation, the numpy table checked against PyPI
wheel availability, and lint.

install_numpy()'s fallback is covered by a unit-style check of all three
branches (pinned / unpinned-with-image-numpy / unpinned-without), including
the case that proves the fail-loud branch is reachable -- see the test plan
in the final commit's message.

The two spots most worth a careful eye in review are the Windows
WIN_CI_DIR re-anchoring (commit 3) and Linux/macOS adopting the shared
(Windows-superset) write_env_exports (commit 5); both are argued to be
behavior-preserving in their commit messages.

Deferred (not a blocker, entangled with the scikit-build-core migration):
switching Linux's setup.py clean to spin clean, which also needs a
dependency reorder.

Test plan

# helpers resolve from one source; numpy table is the evidence-based one
python - <<'PY'
import importlib.util as u
m=u.module_from_spec(s:=u.spec_from_file_location("_common",".ci/wheel/_common.py")); s.loader.exec_module(m)
assert m.NUMPY_PINS=={"3.10":"2.0.2","3.11":"2.0.2","3.12":"2.0.2","3.13":"2.1.2","3.14":"2.3.4","3.15":"2.5.2"}
assert all(hasattr(m,h) for h in ["retry","pip_install","install_numpy","download","write_env_exports","shell_quote"])
PY
# no stray refs to the old dirs; generated workflows reproduce with no diff
grep -rn -- .ci/macwheel .ci/manywheel .github .ci   # (empty)
python .github/scripts/generate_ci_workflows.py       # no-op
spin lint .ci/wheel/_common.py .ci/wheel/*/build_install_deps.py .ci/wheel/*/build_env_setup.py .ci/wheel/README.md

This PR was authored with the assistance of Claude Code.

🤖 Generated with Claude Code

@pytorch-bot

pytorch-bot Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189275

Note: Links to docs will display an error until the docs builds have been completed.

❌ You can merge normally! (28 Unrelated Failures), 2 Unclassified Failures

As of commit 2ee1bc7 with merge base 0b5ae20 (image):

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:

CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the release notes: releng release notes category label Jul 8, 2026
@zklaus zklaus added the ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR label Jul 8, 2026
zklaus added a commit to zklaus/pytorch that referenced this pull request Jul 8, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

## Test plan

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
@zklaus
zklaus force-pushed the cd-pipeline-unification branch from f96c6dc to 8a051ea Compare July 9, 2026 12:25
zklaus added a commit to zklaus/pytorch that referenced this pull request Jul 9, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

## Test plan

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
@huydhn

huydhn commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@pytorchbot rebase -b main

(Rebase to get my latest changes to release workflow)

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased cd-pipeline-unification onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout cd-pipeline-unification && git pull --rebase)

@pytorchmergebot
pytorchmergebot force-pushed the cd-pipeline-unification branch from 8a051ea to aaae181 Compare July 9, 2026 18:35
pytorchmergebot pushed a commit to zklaus/pytorch that referenced this pull request Jul 9, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

## Test plan

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
atalman added a commit that referenced this pull request Jul 14, 2026
#189275)

cp315 has no numpy wheel on any index, so a version-pinned `pip install numpy`
builds it from source -- which fails on the ROCm manylinux image (meson's
Cython check resolves pkg-config python3 to the image's system 3.6).

Adopt the unified numpy handling from #189275: a per-version NUMPY_PINS table
(3.10-3.14) plus install_numpy(), which for a Python with no table entry (3.15)
uses the numpy the CI image pre-provisioned instead of pinning a wheel-less
version, and fails loudly if none exists. Replaces the hardcoded cp315->2.5.0
pin and keeps build_install_deps.py consistent with the .ci consolidation in
#189275.

Note: this relies on the manylinux image pre-provisioning numpy for cp315 (as
the plain CUDA/XPU images do); the ROCm image must ship one for cp315 too.
@zklaus
zklaus force-pushed the cd-pipeline-unification branch from aaae181 to f095335 Compare August 25, 2026 13:24
zklaus added a commit to zklaus/pytorch that referenced this pull request Aug 25, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

## Test plan

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
zklaus added a commit to zklaus/pytorch that referenced this pull request Aug 25, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

## Test plan

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
@zklaus
zklaus force-pushed the cd-pipeline-unification branch from f095335 to 2792b31 Compare August 25, 2026 14:44
@zklaus
zklaus force-pushed the cd-pipeline-unification branch from 2792b31 to 74eee14 Compare September 8, 2026 12:18
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 8, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

Rebasing onto viable/strict brought a third kind of reference the sweep
could not have seen. pytorch#194243 (native-AOT stage 2) landed tests in
tools/test/test_native_aot_tools.py that open `.ci/manywheel/build.sh` by
literal path, and comments in tools/native_aot/build_stage2.py and
.ci/pytorch/build.sh citing the old paths. The tests would raise
FileNotFoundError after the move; all are repointed here. While there,
torch/cuda/__init__.py's arch-table comment cited
`.ci/manywheel/build_cuda.sh`, a file the Python port had already removed;
it now names the build_env_setup.py the matrix validator actually reads.

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
python -m pytest tools/test/test_native_aot_tools.py -k TestCiAndCMakeWiring -q   # 7 passed, 15 subtests
git grep -n -E '\.ci/manywheel/' -- . ':!agent_space'                             # empty
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh \
    tools/test/test_native_aot_tools.py tools/native_aot/build_stage2.py torch/cuda/__init__.py
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
@zklaus
zklaus marked this pull request as ready for review September 8, 2026 23:21
@zklaus
zklaus requested review from a team, Aidyn-A, albanD, eqy, malfet and syed-ahmed as code owners September 8, 2026 23:21
@zklaus
zklaus requested a review from atalman September 9, 2026 09:36
@ezyang ezyang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 10, 2026
@zklaus
zklaus force-pushed the cd-pipeline-unification branch from 74eee14 to 616e52e Compare September 11, 2026 08:12
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 11, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

Rebasing onto viable/strict brought a third kind of reference the sweep
could not have seen. pytorch#194243 (native-AOT stage 2) landed tests in
tools/test/test_native_aot_tools.py that open `.ci/manywheel/build.sh` by
literal path, and comments in tools/native_aot/build_stage2.py and
.ci/pytorch/build.sh citing the old paths. The tests would raise
FileNotFoundError after the move; all are repointed here. While there,
torch/cuda/__init__.py's arch-table comment cited
`.ci/manywheel/build_cuda.sh`, a file the Python port had already removed;
it now names the build_env_setup.py the matrix validator actually reads.

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
python -m pytest tools/test/test_native_aot_tools.py -k TestCiAndCMakeWiring -q   # 7 passed, 15 subtests
git grep -n -E '\.ci/manywheel/' -- . ':!agent_space'                             # empty
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh \
    tools/test/test_native_aot_tools.py tools/native_aot/build_stage2.py torch/cuda/__init__.py
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 16, 2026
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

Rebasing onto viable/strict brought a third kind of reference the sweep
could not have seen. pytorch#194243 (native-AOT stage 2) landed tests in
tools/test/test_native_aot_tools.py that open `.ci/manywheel/build.sh` by
literal path, and comments in tools/native_aot/build_stage2.py and
.ci/pytorch/build.sh citing the old paths. The tests would raise
FileNotFoundError after the move; all are repointed here. While there,
torch/cuda/__init__.py's arch-table comment cited
`.ci/manywheel/build_cuda.sh`, a file the Python port had already removed;
it now names the build_env_setup.py the matrix validator actually reads.

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
python -m pytest tools/test/test_native_aot_tools.py -k TestCiAndCMakeWiring -q   # 7 passed, 15 subtests
git grep -n -E '\.ci/manywheel/' -- . ':!agent_space'                             # empty
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh \
    tools/test/test_native_aot_tools.py tools/native_aot/build_stage2.py torch/cuda/__init__.py
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.

@atalman atalman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@atalman

atalman commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

@pytorchmergebot rebase -b main

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here

First step of consolidating the three CD wheel-build pipelines (Linux,
Windows, macOS) under a common .ci/wheel/ root, so they can later share a
single _common.py (retry, pip_install, numpy_pin, and the env/quoting
helpers) instead of the copy-pasted, drifted copies they carry today.

This commit is a pure rename: .ci/macwheel/ -> .ci/wheel/mac/, with the
literal path references updated in the macOS binary-build template and the
in-tree script comments/messages. The generated workflow is reproduced by
rerunning .github/scripts/generate_ci_workflows.py; its only diff is the
two script paths.

## Test plan

```
# no stray references to the old path
grep -rn -- .ci/macwheel .github/ .ci/ tools/    # (empty)
# regen is a faithful no-op beyond the path change
python .github/scripts/generate_ci_workflows.py
git diff --stat .github/workflows/               # only generated-macos-arm64-binary-wheel-nightly.yml
lintrunner .ci/wheel/mac/* .github/templates/macos_binary_build_workflow.yml.j2
```

Authored with assistance from Claude Code.
Second consolidation step: the dedicated Linux CD wheel dir joins macOS
under the common .ci/wheel/ root. Like the macOS move this is a pure
rename plus reference updates; no build logic changes.

References updated at their source:
- the linux binary-build template (bash .ci/wheel/linux/build_all.sh),
  regenerated into the two linux manywheel nightly workflows;
- generate_binary_build_matrix.py, both the constructed _BUILD_ENV_SETUP
  path (REPO_ROOT / ".ci" / "wheel" / "linux" / ...) and a diagnostic
  message. The semantic package_type="manywheel" label is unrelated to the
  directory and is left untouched;
- prepare_vllm_wheels.sh's provenance comment, and the "mirrors the Linux
  flow" cross-references in the macOS and Windows scripts.

```
grep -rn -- .ci/manywheel .github/ .ci/ tools/          # (empty)
grep -rnE '"manywheel" */' .github/scripts/             # (empty; package_type= stays)
python .github/scripts/generate_ci_workflows.py
git diff .github/workflows/                              # only the two linux paths
lintrunner .ci/wheel/linux/build_install_deps.py .github/scripts/generate_binary_build_matrix.py
```

Authored with assistance from Claude Code.
Third consolidation step. Unlike the dedicated Linux and macOS dirs,
.ci/pytorch/windows/ is a mixed directory: it holds the CD wheel pipeline
(build_env_setup.py, build_install_deps.py, build_wheel.py,
set_desired_python.sh, _common.py) alongside internal/*.bat installers and
the arm64/ scripts, which are shared with non-CD Windows CI (magma,
win-arm64-build-test, regular win-test). So only the five CD pipeline files
move to .ci/wheel/windows/; internal/ and arm64/ stay put.

The pipeline located its siblings via Path(__file__).parent, which doubles
as the runtime workspace (tmp_bin/, magma_*/, the Python install, libuv,
and the internal/*.bat installers). To keep that workspace exactly where it
is, WIN_CI_DIR is re-anchored to .ci/pytorch/windows/ (derived from the
script's new location) while only the _common import follows the moved
files. The orchestrator .ci/pytorch/binary_windows_build.sh now invokes the
pipeline from ../wheel/windows/; its internal/vc_install_helper.bat and
arm64/ calls are unchanged. No template changed, so the generated Windows
workflow is untouched (regen is a no-op).

Note: this pipeline runs only in the nightly CD workflow, which this PR's CI
does not exercise, so the re-anchoring is verified by path-math and review
rather than a green build.

## Test plan

```
# anchors resolve to the unchanged workspace
python - <<'PY'
from pathlib import Path
f = Path(".ci/wheel/windows/build_env_setup.py").resolve()
assert f.parents[2] / "pytorch" / "windows" == Path(".ci/pytorch/windows").resolve()
PY
grep -rn -- '.ci/pytorch/windows/build_' .ci .github   # (no refs to moved files)
python .github/scripts/generate_ci_workflows.py        # no-op
lintrunner .ci/wheel/windows/*.py .ci/wheel/windows/set_desired_python.sh .ci/pytorch/binary_windows_build.sh
```

Authored with assistance from Claude Code.
Fourth consolidation step, and the point of the exercise: the three CD
wheel pipelines carried copy-pasted helpers and three drifted numpy pin
tables. Extract .ci/wheel/_common.py (retry, pip_install, numpy_pin,
shell_quote, write_env_exports, download) and have the three
build_install_deps.py import from it. The Windows _common.py, already the
most complete, is promoted to the shared location; its write_env_exports
(POSIX PATH conversion + bash-identifier filter) is a safe superset -- the
PATH branch is a no-op where PATH has no ';' (Linux/macOS), and the filter
only skips keys bash could never source anyway.

numpy pin -- the tables disagreed for every Python, and Linux's greedy
`cp31` prefix silently overrode its own 2.0.2 default for 3.10-3.12 (and
mis-pinned 3.15). Replaced with one explicit dict + fail-loud (the macOS
design). Each entry is the oldest numpy *minor* that ships a wheel for that
interpreter (verified on PyPI -- widest runtime-numpy range), pinned at the
newest *patch* of that minor already shipped in production by one of the
platforms, so the reconciliation drops no numpy bugfix:

    3.10/3.11/3.12 -> 2.0.2   3.13 -> 2.1.2   3.14 -> 2.3.4   3.15 -> 2.5.2

The only genuine floor change is Linux 3.10-3.12 (2.1.0 -> 2.0.2), undoing
the greedy-prefix accident to match the 2.0.2 that Windows and macOS already
use there; 3.13 and 3.14 converge on the newer of the two patches in use
(Windows' 2.1.2, Linux/macOS' 2.3.4 -- the latter is numpy's 3.14.0-final
release). A read of the 2.1.1/2.1.2 and 2.3.3/2.3.4 notes confirmed the
dropped-vs-kept patch deltas are numpy-internal runtime or numpy's-own-build
fixes, none touching the C-API surface torch compiles against. 3.15 takes
2.5.2, the first numpy with cp315 wheels and the pin every platform now
carries upstream (pytorch#194618, pytorch#194734, pytorch#194741). Provenance
(pytorchgh-182409/184407/187944) found none of the original drift deliberate;
Linux's incidental `--pre` is dropped (every pin is an exact stable release).

These pipelines run only in the nightly CD workflows, which this PR's CI
does not exercise; verified by import/path simulation, the numpy table
against PyPI, and lint rather than a green build. build_env_setup.py on
Linux/macOS still carry their own shell_quote/write_env_exports copies;
deduping those is the next commit.

```
python - <<'PY'
import importlib.util as u
m=u.module_from_spec(s:=u.spec_from_file_location("_common",".ci/wheel/_common.py")); s.loader.exec_module(m)
assert m.NUMPY_PINS=={"3.10":"2.0.2","3.11":"2.0.2","3.12":"2.0.2","3.13":"2.1.2","3.14":"2.3.4","3.15":"2.5.2"}
assert all(hasattr(m,h) for h in ["retry","pip_install","numpy_pin","download","write_env_exports","shell_quote"])
PY
lintrunner .ci/wheel/_common.py .ci/wheel/*/build_install_deps.py .ci/wheel/windows/build_env_setup.py
```

Authored with assistance from Claude Code.
Fifth and final consolidation step. The Linux and macOS build_env_setup.py
still carried their own copies of shell_quote and write_env_exports (the
Windows one already imports both from _common). Drop the local copies and
import write_env_exports from .ci/wheel/_common.py; shell_quote was only ever
called from inside write_env_exports, so it needs no separate import. macOS
gains an `import sys` for the sys.path insert.

This means Linux and macOS now use the shared (formerly Windows)
write_env_exports, which is a safe superset of the simple version they had:
the PATH `;`->`:` conversion is a no-op where PATH has no `;` (i.e. always,
on POSIX), and the bash-identifier filter only ever skips keys bash could
not source anyway -- if a `BASH_FUNC_...%%` function export leaks into the
captured env, the old simple version would have written an unsourceable
`export` line, so the filter is a latent-bug fix, not a behavior change for
any key that mattered.

With this, all three pipelines share one _common.py; the only remaining
per-platform helper is Windows' _to_posix_path_list (still shared in the
module, just unused off Windows). Like the rest of this branch, these
pipelines run only in nightly CD, so this is verified by import/path
simulation and lint, not a green PR build.

## Test plan

```
python - <<'PY'
import ast
for p in ("linux","mac"):
    t=open(f".ci/wheel/{p}/build_env_setup.py").read()
    ast.parse(t)
    assert "def shell_quote" not in t and "def write_env_exports" not in t
    assert "from _common import write_env_exports" in t
    assert "write_env_exports(" in t   # still called in main
PY
lintrunner .ci/wheel/linux/build_env_setup.py .ci/wheel/mac/build_env_setup.py
```

Authored with assistance from Claude Code.
Document the consolidated CD wheel build tree: the shared stage sequence
(set_desired_python -> build_env_setup -> build_install_deps -> build_wheel
-> repair_wheel, threaded via the --env-out hand-off, with the
Linux-CUDA-only native-AOT stage 2 from pytorch#194243 sitting between build and
repair), the per-platform orchestration and topology (Linux/macOS loop over
DESIRED_PYTHONS on one runner, Windows fans out via the CI matrix), the
shared _common.py helpers, and the dependencies that live outside
.ci/wheel/ -- the generated workflows + templates, the Windows workspace and
shared installers under .ci/pytorch/windows/, and the repo-root build
inputs.

Docs only. `lintrunner .ci/wheel/README.md` is clean; repair-tool and path
claims cross-checked against the scripts.

Authored with assistance from Claude Code.
The directory move in "Move Linux CD wheel scripts to .ci/wheel/linux/"
updated every literal `.ci/manywheel` reference, but two callers reach the
Linux build scripts through a *dynamic* path that a string grep never
matched:

- `.github/workflows/_binary-build-linux.yml` runs
  `bash .ci/${{ inputs.PACKAGE_TYPE }}/build.sh` -- with `PACKAGE_TYPE`
  `manywheel`, that resolved to the moved directory, so every Linux
  manywheel binary build (cpu, cuda, rocm, xpu, s390x) failed at
  `docker exec` with `.ci/manywheel/build.sh: No such file or directory`.
- `.ci/libtorch/build.sh` shims to `${SCRIPTPATH}/../manywheel/build.sh`,
  breaking libtorch builds the same way.

`PACKAGE_TYPE` is a semantic label (`manywheel` / `libtorch`), not a
directory, so it is left as-is; instead the reusable workflow remaps the one
type whose scripts moved via a render-time expression
(`manywheel -> wheel/linux`, everything else unchanged), and the libtorch
shim is repointed. The `.ci/${PACKAGE_TYPE}/build.sh` convention otherwise
stands.

Surfaced by a `ciflow/binaries_wheel` run on pytorch#189275; the string-only
reference sweep in the move commit was the gap.

Rebasing onto viable/strict brought a third kind of reference the sweep
could not have seen. pytorch#194243 (native-AOT stage 2) landed tests in
tools/test/test_native_aot_tools.py that open `.ci/manywheel/build.sh` by
literal path, and comments in tools/native_aot/build_stage2.py and
.ci/pytorch/build.sh citing the old paths. The tests would raise
FileNotFoundError after the move; all are repointed here. While there,
torch/cuda/__init__.py's arch-table comment cited
`.ci/manywheel/build_cuda.sh`, a file the Python port had already removed;
it now names the build_env_setup.py the matrix validator actually reads.

```
grep -c "PACKAGE_TYPE == 'manywheel' && 'wheel/linux'" .github/workflows/_binary-build-linux.yml  # 2
grep -c '.ci/${{ inputs.PACKAGE_TYPE }}/build.sh' .github/workflows/_binary-build-linux.yml         # 0
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
python -m pytest tools/test/test_native_aot_tools.py -k TestCiAndCMakeWiring -q   # 7 passed, 15 subtests
git grep -n -E '\.ci/manywheel/' -- . ':!agent_space'                             # empty
lintrunner .github/workflows/_binary-build-linux.yml .ci/libtorch/build.sh \
    tools/test/test_native_aot_tools.py tools/native_aot/build_stage2.py torch/cuda/__init__.py
```
Re-validated by re-running `ciflow/binaries_wheel` on the PR.

Authored with assistance from Claude Code.
Third and final class of reference broken by the manywheel -> wheel/linux
move. The move added a directory level (.ci/manywheel, two levels under the
repo root, became .ci/wheel/linux, three levels), so every script-location-
relative path that reaches *up and out* of the directory resolved one level
too shallow. Neither a literal-string nor a dynamic-path grep can catch
these -- they only surface at runtime:

- build_common.sh:11 sourced `$(dirname "$SOURCE_DIR")/pytorch/rocm_utils.sh`,
  which became .ci/wheel/pytorch/rocm_utils.sh -- the actual failure hit by
  the s390x (and libtorch) builds, which route through build_cpu.sh /
  build_common.sh.
- build.sh:6 and build_env_setup.py:196 compute a repo-root fallback
  (`${SCRIPTPATH}/../..` and `parents[2]`). Both are masked in CI by
  PYTORCH_ROOT / GITHUB_WORKSPACE being set, but were latently wrong; fixed
  for correctness.

build_cpu.sh, build_libtorch.sh, set_desired_python.sh, and test_wheel.sh
were audited and only reference their own directory or runtime-CWD paths, so
they are unaffected. The Python stage scripts' `parents[1]` (the .ci/wheel
_common import) is correct.

With this, all four reference classes from the move -- literal, dynamic
(${PACKAGE_TYPE}), shell up-paths, and Python parents[N] -- are reconciled.

## Test plan

```
python - <<'PY'
from pathlib import Path
r=Path('.').resolve(); sd=r/'.ci/wheel/linux'
assert (sd.parent.parent/'pytorch'/'rocm_utils.sh').exists()          # build_common.sh
assert (sd/'..'/'..'/'..').resolve()==r                                # build.sh
assert (r/'.ci/wheel/linux/build_env_setup.py').resolve().parents[3]==r # build_env_setup.py
PY
lintrunner .ci/wheel/linux/build_common.sh .ci/wheel/linux/build.sh .ci/wheel/linux/build_env_setup.py
```
Re-validated by re-running ciflow/binaries_wheel on the PR.

Authored with assistance from Claude Code.
…shim

PACKAGE_TYPE doubled as both a semantic label (libtorch-or-wheel branches in
the env-population/test/upload scripts, artifact naming) and -- on Linux only
-- a directory selector: _binary-build-linux.yml ran
`bash .ci/${PACKAGE_TYPE}/build.sh`. That second role is what broke when the
manywheel scripts moved to .ci/wheel/linux/ and had to be papered over with a
remapping ternary.

It turns out the directory role is vestigial. No workflow passes
PACKAGE_TYPE=libtorch to _binary-build-linux.yml anymore: since the
libtorch-extraction rework, the nightly libtorch zips are produced by
extract_libtorch_from_wheel.py from the built wheels (the linux workflow's
libtorch jobs are extract + upload, not build). So the interpolation only
ever resolved to `manywheel`, and .ci/libtorch/build.sh -- a 10-line shim
around the wheel pipeline with BUILD_PYTHONLESS=1 -- is dead code.

Replace the interpolation (and the remapping ternary) with the literal
.ci/wheel/linux/build.sh at both call sites, and delete the shim.
.ci/libtorch/extract_libtorch_from_wheel.py stays -- it is what the
extraction jobs on every platform actually run. binary_populate_env.sh's
PACKAGE_TYPE=libtorch branch also stays: the libtorch *test* jobs still use
it. PACKAGE_TYPE itself remains an input/env var everywhere -- it is a pure
label now, never resolved as a path, which also defuses the latent collision
between PACKAGE_TYPE=wheel and the new .ci/wheel/ directory.

A follow-up worth raising with releng separately: PACKAGE_TYPE=manywheel is
fully derivable (it is set iff os is linux*, see
generate_binary_build_matrix.py), and every runtime consumer already
glob-matches `*wheel`; collapsing manywheel->wheel would however rename all
nightly artifacts/jobs, so it needs coordination.

## Test plan

```
# PACKAGE_TYPE is never used as a path anywhere
grep -rnE '\.ci/\$\{\{?[^}]*PACKAGE_TYPE' .github/ .ci/     # (empty)
# nothing calls the deleted shim
grep -rn 'libtorch/build\.sh' .github/ .ci/ tools/           # (empty)
python -c "import yaml; yaml.safe_load(open('.github/workflows/_binary-build-linux.yml'))"
python .github/scripts/generate_ci_workflows.py              # no-op
lintrunner .github/workflows/_binary-build-linux.yml .ci/wheel/README.md
```
Exercised by the ciflow/binaries_wheel run (all Linux manywheel builds route
through the two edited call sites).

Authored with assistance from Claude Code.
The unified numpy table makes an unlisted Python fail loudly and
unconditionally. That is the wrong default for a CD matrix: it turns a
missing table entry into a hard build failure, and in the per-arch loop
builds (manywheel-cpu / cuda / aarch64) an abort at one Python discards the
wheels already built for every earlier one.

Replace numpy_pin() with install_numpy() in _common.py, encapsulating the
policy: a listed Python installs its exact pin; an unlisted one falls back
to a numpy already provisioned in the interpreter, logged with its version;
only when neither exists does it fail loudly.

Every Python in the matrix today is listed, so the fallback is a guard for
the next Python added before its pin lands, not a fix for a live failure.

The "already provisioned" check is a snapshot taken when _common.py is
imported, not a probe at call time. It has to be: on Linux and macOS the
stage installs requirements-build.txt -- which lists a bare `numpy` -- before
it calls install_numpy(), so a call-time probe would always find one and the
fail-loud branch could never fire. An unpinned Python would then quietly
build against whatever pip last resolved, which is the failure the explicit
table exists to prevent, and on macOS would be a regression from the
unconditional fail-loud it had before.

The cp315 pin question a single table raises was settled upstream rather
than here. Windows pinned cp315 at numpy 2.5.2 (pytorch#194618) while Linux and
macOS sat on 2.5.1, which has no cp315 wheel and built numpy from source;
one table cannot hold both. pytorch#194741 (Linux) and pytorch#194734 (macOS) have since
moved both to 2.5.2, so the unified table takes 2.5.2 and no platform's pin
changes in this commit. numpy 2.5.2 publishes cp315 and cp315t wheels for
manylinux, musllinux, macOS and Windows, so every platform in the matrix
installs a wheel.

That upstream move left the ROCm cp315 pkg-config workaround
(is_rocm_py315 / prefer_target_python_pkgconfig, added in pytorch#189722) inert,
since it only guards numpy's from-source meson Cython check. It is
deliberately left in place: it is cheap, the failure it guards against is
nightly-only and image-specific, and the change that stopped exercising it
is not this one. Removing it wants its own change, after a green ROCm cp315
nightly on the wheel install.

Also drops the Linux-only `--pre` flag on the numpy install, which
install_numpy() does not carry. It was a no-op. The install is always an
exact `numpy==X` pin, and pip's prerelease filtering never narrows an exact
specifier -- including one naming a prerelease, because packaging enables
prereleases automatically when the specifier itself references one. So the
flag could not have changed resolution for any value NUMPY_PINS can hold.
It would only matter if the pin stopped being exact.

On Windows and macOS, preinstall_cp315_build_deps() (pytorch#194618, pytorch#194734)
still guards the requirements installs, so install_numpy() takes passthrough
pip args. cp315 has no pyyaml
wheel, so PIP_PACKAGES really does build an sdist and needs the Cython pin to
reach it -- and PIP_CONSTRAINT cannot, which is why pytorch#194618 disables build
isolation instead. numpy resolves to a wheel at the current pin, which makes
the flags inert for that install rather than unnecessary; passing them anyway
keeps the guard in place for a future pin with no cp315 wheel, which is
exactly the case NUMPY_PINS is documented to serve.

install_numpy() policy, all four branches:

```
python - <<'PY'
import importlib.util as u, collections
from unittest import mock
VI = collections.namedtuple("VI", "major minor micro")
s = u.spec_from_file_location("_common", ".ci/wheel/_common.py")
m = u.module_from_spec(s); s.loader.exec_module(m)
for ver, pin in [((3,12,0),"2.0.2"), ((3,14,0),"2.3.4"), ((3,15,0),"2.5.2")]:
    with mock.patch.object(m, "pip_install") as pi, mock.patch.object(m.sys, "version_info", VI(*ver)):
        m.install_numpy(); pi.assert_called_once_with("-q", f"numpy=={pin}")
with mock.patch.object(m, "pip_install") as pi, mock.patch.object(m.sys, "version_info", VI(3,15,0)):
    m.install_numpy("--no-build-isolation")
    pi.assert_called_once_with("-q", "--no-build-isolation", "numpy==2.5.2")
m._IMAGE_NUMPY = "2.6.0"
with mock.patch.object(m, "pip_install") as pi, mock.patch.object(m.sys, "version_info", VI(3,16,0)):
    m.install_numpy(); pi.assert_not_called()
m._IMAGE_NUMPY = None
with mock.patch.object(m.sys, "version_info", VI(3,16,0)), \
     mock.patch.object(m.importlib.util, "find_spec", return_value=object()):
    try: m.install_numpy(); raise AssertionError
    except SystemExit as e: assert "NUMPY_PINS" in str(e.code)
PY
```

`--pre` is a no-op against an exact pin (identical resolution, same wheel):

```
pip install --dry-run --no-deps --ignore-installed --report - numpy==2.0.2
pip install --dry-run --no-deps --ignore-installed --report - --pre numpy==2.0.2
```

Lint:

```
spin lint .ci/wheel/_common.py .ci/wheel/*/build_install_deps.py .ci/wheel/README.md
```

Full CD coverage still comes from a ciflow/binaries_wheel run; the cp315 and
cp315t jobs on every platform are the ones to watch, since they are the
builds this commit moves onto a wheel.

Authored with assistance from Claude Code.
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased cd-pipeline-unification onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout cd-pipeline-unification && git pull --rebase)

…le-runner rebase

The pytorchmergebot rebase onto main brought in pytorch#195699, which routes the
XPU manywheel build through the unified build_all.sh job. That commit's
template change merged cleanly, but the pre-rendered generated workflow was
taken textually from main, where the script still lived at
.ci/manywheel/build_all.sh. This branch moved it to .ci/wheel/linux/, so
manywheel-xpu-build failed with "No such file or directory" and
workflow-checks/lint flagged the generated file as stale. Regenerating from
the merged template fixes exactly that one line.

The same rebase also brought in the native-aot workflow (pytorch#190899), whose
paths filter names .ci/manywheel/build.sh. That entry is repointed to the
moved script so edits to the Linux build script keep triggering the
workflow.

Test Plan:

```
uv run --no-project --python 3.10 --with jinja2 --with typing_extensions --with pyyaml python .github/scripts/generate_ci_workflows.py
git diff --stat   # only generated-linux-binary-manywheel-nightly.yml, 1 line
grep -rn '\.ci/manywheel' .github .ci   # empty
lintrunner .github/workflows/native-aot.yml .github/workflows/generated-linux-binary-manywheel-nightly.yml
```

Authored with an AI assistant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
The previous commit repointed the native-aot workflow's paths filter from
.ci/manywheel/build.sh to .ci/wheel/linux/build.sh, but
tools/test/test_native_aot.py asserts the filter's contents literally, so
"Test tools / lint" failed on the old path. Update the expected path, plus a
comment in test_native_aot_tools.py naming the old directory.

Test Plan:

```
uv run --no-project --python 3.10 --with pyyaml --with expecttest --with typing_extensions python -m unittest tools.test.test_native_aot.TestNativeAotWorkflow -v
lintrunner tools/test/test_native_aot.py tools/test/test_native_aot_tools.py
```

Authored with an AI assistant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@atalman

atalman commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

@pytorchmergebot merge -f "this was tested already, lets merge"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

torchxpubot pushed a commit to intel/torch-xpu-ops that referenced this pull request Sep 17, 2026
## Summary
- update the PyTorch XPU build script to use the consolidated upstream
Linux wheel helper path under .ci/wheel/linux
- align with PyTorch main pytorch/pytorch#189275

## Validation
- bash -n torch-xpu-ops/.github/scripts/build.sh
- git -C torch-xpu-ops diff --check -- .github/scripts/build.sh
orrangetabby17 pushed a commit to intel/torch-xpu-ops that referenced this pull request Oct 8, 2026
## Summary
- update the PyTorch XPU build script to use the consolidated upstream
Linux wheel helper path under .ci/wheel/linux
- align with PyTorch main pytorch/pytorch#189275

## Validation
- bash -n torch-xpu-ops/.github/scripts/build.sh
- git -C torch-xpu-ops diff --check -- .github/scripts/build.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR Merged open source release notes: releng release notes category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants