Skip to content

[BE] Build all CUDA wheels per (arch, cuda) on a single runner - #184045

Closed
malfet wants to merge 1 commit into
gh/malfet/907/basefrom
gh/malfet/907/head
Closed

malfet wants to merge 1 commit into
gh/malfet/907/basefrom
gh/malfet/907/head

Conversation

@malfet

@malfet malfet commented May 16, 2026 •

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

Extends #183931 to CUDA: unified_arch_types now includes cuda and cuda-aarch64, and the template groups by (gpu_arch_type, desired_cuda) so each (arch, cuda) variant gets one build job that loops over all CPython versions. libtorch_cuda is Python-ABI-free and shared across iterations alongside libtorch_cpu.

Job names: manywheel-cuda-cu126-build, manywheel-cuda-aarch64-cu130-build, etc. CPU job names (manywheel-cpu-build, manywheel-cpu-aarch64-build) stay unchanged. Per-group env now also carries GPU_ARCH_VERSION and PYTORCH_EXTRA_INSTALL_REQUIREMENTS (constant within a group). BUILD_NAME_SUFFIX is derived from the first config's build_name instead of hardcoded so it picks up the cuda-version part automatically.

ROCm and XPU stay on the per-Python matrix; test+upload stay per-Python so failure on one Python only blocks that Python's upload.

Authored with Claude.

Before vs after

Comparing 2026-05-17 nightly (per-Python CUDA matrix) to this PR's aarch64 run 25974013813 and x86 run 25974013818:

CUDA build runner-minutes

Representative "before" links go to the py3_10 matrix entry of each variant; the matrix had 5 more identically-shaped entries (py3_11..py3_14t).

Arch Variant Before (per-Python matrix, 6 jobs) After (1 unified job) Δ
linux-aarch64 cu126 6 × ~78m = 468m (py3_10) 148m (job) −68%
linux-aarch64 cu130 6 × ~136m = 814m (py3_10) 203m (job) −75%
linux-aarch64 cu132 6 × ~140m = 841m (py3_10) 210m (job) −75%
linux-aarch64 CUDA total 2123m 561m −74%
linux-x86 cu126 6 × ~137m = 822m (py3_10) 225m (job) −73%
linux-x86 cu130 6 × ~160m = 962m (py3_10) 230m (job) −76%
linux-x86 cu132 6 × ~167m = 1004m (py3_10) 237m (job) −76%
linux-x86 CUDA total 2787m 692m −75%

~3.6k runner-minutes saved per nightly on CUDA builds alone (~74% reduction), on top of the ~320m/nightly already saved on CPU by #183931.

Per-iteration breakdown (aarch64 cu132 unified job)

  • First Python: ~140m (from-scratch build, matches nightly's matrix entry duration)
  • Subsequent 5 Pythons: 70m / 5 ≈ ~14m each (libtorch_cuda reused, only libtorch_python + _C rebuilt)
  • Confirms the cmake.py cross-Python cache invalidation works for CUDA the same as it does for CPU.

Wall-clock (cu132, the slowest variant)

Arch Before (matrix max) After (unified) Δ
linux-aarch64 ~142m ~210m +1.5×
linux-x86 ~167m ~237m +1.4×

Binary-size sanity check

Spot-checking py3_10 and py3_14t artifacts of both runs to confirm CUDA wheels are actually produced and not accidentally CPU-only:

Arch Variant Nightly py3_10 PR py3_10 Nightly py3_14t PR py3_14t
aarch64 cu126 327.85 MB 327.80 MB 327.88 MB 327.82 MB
aarch64 cu130 515.26 MB 515.19 MB 515.27 MB 515.21 MB
aarch64 cu132 525.04 MB 524.97 MB 525.13 MB 525.00 MB
x86 cu126 841.74 MB 841.74 MB 841.76 MB 841.69 MB
x86 cu130 615.60 MB 615.54 MB 615.61 MB 615.56 MB
x86 cu132 624.16 MB 624.09 MB 624.17 MB 624.11 MB

All deltas are within 0.05 MB (~0.01%) — well within normal build-timestamp/dep-version variance. The CUDA payload (libtorch_cuda, cuDNN, NCCL, cuSPARSELt, etc.) is intact in every unified-build wheel.

Within a single unified job, sizes across Pythons are nearly identical (within ~10 KB) — exactly the expected shape: only _C.so varies per interpreter, while the multi-hundred-MB libtorch_cuda.so is reused.

Data: aarch64 nightly 25985669026, x86 nightly 25985669024, aarch64 PR 25974013813, x86 PR 25974013818.

[ghstack-poisoned]
@malfet
malfet requested a review from a team as a code owner May 16, 2026 19:49
@pytorch-bot

pytorch-bot Bot commented May 16, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 Unclassified Failures

As of commit 75cb3b2 with merge base 9df9278 (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:

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

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label May 16, 2026
malfet added a commit that referenced this pull request May 16, 2026
Extends #183931 to CUDA: `unified_arch_types` now includes `cuda` and `cuda-aarch64`, and the template groups by `(gpu_arch_type, desired_cuda)` so each (arch, cuda) variant gets one build job that loops over all CPython versions. libtorch_cuda is Python-ABI-free and shared across iterations alongside libtorch_cpu.

Job names: `manywheel-cuda-cu126-build`, `manywheel-cuda-aarch64-cu130-build`, etc. CPU job names (`manywheel-cpu-build`, `manywheel-cpu-aarch64-build`) stay unchanged. Per-group env now also carries `GPU_ARCH_VERSION` and `PYTORCH_EXTRA_INSTALL_REQUIREMENTS` (constant within a group). `BUILD_NAME_SUFFIX` is derived from the first config's build_name instead of hardcoded so it picks up the cuda-version part automatically.

ROCm and XPU stay on the per-Python matrix; test+upload stay per-Python so failure on one Python only blocks that Python's upload.

Authored with Claude.


ghstack-source-id: 881b0ae
Pull-Request: #184045
@malfet malfet added the ciflow/binaries Trigger all binary build and upload jobs on the PR label May 16, 2026
@malfet

malfet commented May 18, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -f "Binary builds are green"

@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

@github-actions
github-actions Bot deleted the gh/malfet/907/head branch June 18, 2026 02:30
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…ch#184045)

Extends pytorch#183931 to CUDA: `unified_arch_types` now includes `cuda` and `cuda-aarch64`, and the template groups by `(gpu_arch_type, desired_cuda)` so each (arch, cuda) variant gets one build job that loops over all CPython versions. libtorch_cuda is Python-ABI-free and shared across iterations alongside libtorch_cpu.

Job names: `manywheel-cuda-cu126-build`, `manywheel-cuda-aarch64-cu130-build`, etc. CPU job names (`manywheel-cpu-build`, `manywheel-cpu-aarch64-build`) stay unchanged. Per-group env now also carries `GPU_ARCH_VERSION` and `PYTORCH_EXTRA_INSTALL_REQUIREMENTS` (constant within a group). `BUILD_NAME_SUFFIX` is derived from the first config's build_name instead of hardcoded so it picks up the cuda-version part automatically.

ROCm and XPU stay on the per-Python matrix; test+upload stay per-Python so failure on one Python only blocks that Python's upload.

Authored with Claude.

## Before vs after

Comparing 2026-05-17 nightly (per-Python CUDA matrix) to this PR's [aarch64 run 25974013813](https://github.com/pytorch/pytorch/actions/runs/25974013813) and [x86 run 25974013818](https://github.com/pytorch/pytorch/actions/runs/25974013818):

### CUDA build runner-minutes

Representative "before" links go to the **py3_10** matrix entry of each variant; the matrix had 5 more identically-shaped entries (py3_11..py3_14t).

| Arch | Variant | Before (per-Python matrix, 6 jobs) | After (1 unified job) | Δ |
|---|---|---:|---:|---:|
| linux-aarch64 | cu126 | 6 × ~78m = **468m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669026/job/76382390578)) | **148m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013813/job/76350905733)) | −68% |
| linux-aarch64 | cu130 | 6 × ~136m = **814m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669026/job/76382390569)) | **203m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013813/job/76350905740)) | −75% |
| linux-aarch64 | cu132 | 6 × ~140m = **841m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669026/job/76382390541)) | **210m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013813/job/76350905728)) | −75% |
| linux-aarch64 | **CUDA total** | **2123m** | **561m** | **−74%** |
| linux-x86 | cu126 | 6 × ~137m = **822m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669024/job/76382391975)) | **225m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013818/job/76350906051)) | −73% |
| linux-x86 | cu130 | 6 × ~160m = **962m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669024/job/76382391995)) | **230m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013818/job/76350906044)) | −76% |
| linux-x86 | cu132 | 6 × ~167m = **1004m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669024/job/76382392005)) | **237m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013818/job/76350906050)) | −76% |
| linux-x86 | **CUDA total** | **2787m** | **692m** | **−75%** |

**~3.6k runner-minutes saved per nightly on CUDA builds alone** (~74% reduction), on top of the ~320m/nightly already saved on CPU by pytorch#183931.

### Per-iteration breakdown (aarch64 cu132 unified job)

- First Python: ~140m (from-scratch build, matches nightly's matrix entry duration)
- Subsequent 5 Pythons: 70m / 5 ≈ **~14m each** (libtorch_cuda reused, only libtorch_python + `_C` rebuilt)
- Confirms the cmake.py cross-Python cache invalidation works for CUDA the same as it does for CPU.

### Wall-clock (cu132, the slowest variant)

| Arch | Before (matrix max) | After (unified) | Δ |
|---|---:|---:|---:|
| linux-aarch64 | ~142m | ~210m | +1.5× |
| linux-x86 | ~167m | ~237m | +1.4× |

## Binary-size sanity check

Spot-checking py3_10 and py3_14t artifacts of both runs to confirm CUDA wheels are actually produced and not accidentally CPU-only:

| Arch | Variant | Nightly py3_10 | PR py3_10 | Nightly py3_14t | PR py3_14t |
|---|---|---:|---:|---:|---:|
| aarch64 | cu126 | 327.85 MB | **327.80 MB** | 327.88 MB | **327.82 MB** |
| aarch64 | cu130 | 515.26 MB | **515.19 MB** | 515.27 MB | **515.21 MB** |
| aarch64 | cu132 | 525.04 MB | **524.97 MB** | 525.13 MB | **525.00 MB** |
| x86 | cu126 | 841.74 MB | **841.74 MB** | 841.76 MB | **841.69 MB** |
| x86 | cu130 | 615.60 MB | **615.54 MB** | 615.61 MB | **615.56 MB** |
| x86 | cu132 | 624.16 MB | **624.09 MB** | 624.17 MB | **624.11 MB** |

All deltas are within **0.05 MB** (~0.01%) — well within normal build-timestamp/dep-version variance. The CUDA payload (libtorch_cuda, cuDNN, NCCL, cuSPARSELt, etc.) is intact in every unified-build wheel.

Within a single unified job, sizes across Pythons are nearly identical (within ~10 KB) — exactly the expected shape: only `_C.so` varies per interpreter, while the multi-hundred-MB `libtorch_cuda.so` is reused.

Data: aarch64 nightly [25985669026](https://github.com/pytorch/pytorch/actions/runs/25985669026), x86 nightly [25985669024](https://github.com/pytorch/pytorch/actions/runs/25985669024), aarch64 PR [25974013813](https://github.com/pytorch/pytorch/actions/runs/25974013813), x86 PR [25974013818](https://github.com/pytorch/pytorch/actions/runs/25974013818).

Pull Request resolved: pytorch#184045
Approved by: https://github.com/Skylion007
ghstack dependencies: pytorch#183931
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…ch#184045)

Extends pytorch#183931 to CUDA: `unified_arch_types` now includes `cuda` and `cuda-aarch64`, and the template groups by `(gpu_arch_type, desired_cuda)` so each (arch, cuda) variant gets one build job that loops over all CPython versions. libtorch_cuda is Python-ABI-free and shared across iterations alongside libtorch_cpu.

Job names: `manywheel-cuda-cu126-build`, `manywheel-cuda-aarch64-cu130-build`, etc. CPU job names (`manywheel-cpu-build`, `manywheel-cpu-aarch64-build`) stay unchanged. Per-group env now also carries `GPU_ARCH_VERSION` and `PYTORCH_EXTRA_INSTALL_REQUIREMENTS` (constant within a group). `BUILD_NAME_SUFFIX` is derived from the first config's build_name instead of hardcoded so it picks up the cuda-version part automatically.

ROCm and XPU stay on the per-Python matrix; test+upload stay per-Python so failure on one Python only blocks that Python's upload.

Authored with Claude.

## Before vs after

Comparing 2026-05-17 nightly (per-Python CUDA matrix) to this PR's [aarch64 run 25974013813](https://github.com/pytorch/pytorch/actions/runs/25974013813) and [x86 run 25974013818](https://github.com/pytorch/pytorch/actions/runs/25974013818):

### CUDA build runner-minutes

Representative "before" links go to the **py3_10** matrix entry of each variant; the matrix had 5 more identically-shaped entries (py3_11..py3_14t).

| Arch | Variant | Before (per-Python matrix, 6 jobs) | After (1 unified job) | Δ |
|---|---|---:|---:|---:|
| linux-aarch64 | cu126 | 6 × ~78m = **468m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669026/job/76382390578)) | **148m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013813/job/76350905733)) | −68% |
| linux-aarch64 | cu130 | 6 × ~136m = **814m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669026/job/76382390569)) | **203m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013813/job/76350905740)) | −75% |
| linux-aarch64 | cu132 | 6 × ~140m = **841m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669026/job/76382390541)) | **210m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013813/job/76350905728)) | −75% |
| linux-aarch64 | **CUDA total** | **2123m** | **561m** | **−74%** |
| linux-x86 | cu126 | 6 × ~137m = **822m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669024/job/76382391975)) | **225m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013818/job/76350906051)) | −73% |
| linux-x86 | cu130 | 6 × ~160m = **962m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669024/job/76382391995)) | **230m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013818/job/76350906044)) | −76% |
| linux-x86 | cu132 | 6 × ~167m = **1004m** ([py3_10](https://github.com/pytorch/pytorch/actions/runs/25985669024/job/76382392005)) | **237m** ([job](https://github.com/pytorch/pytorch/actions/runs/25974013818/job/76350906050)) | −76% |
| linux-x86 | **CUDA total** | **2787m** | **692m** | **−75%** |

**~3.6k runner-minutes saved per nightly on CUDA builds alone** (~74% reduction), on top of the ~320m/nightly already saved on CPU by pytorch#183931.

### Per-iteration breakdown (aarch64 cu132 unified job)

- First Python: ~140m (from-scratch build, matches nightly's matrix entry duration)
- Subsequent 5 Pythons: 70m / 5 ≈ **~14m each** (libtorch_cuda reused, only libtorch_python + `_C` rebuilt)
- Confirms the cmake.py cross-Python cache invalidation works for CUDA the same as it does for CPU.

### Wall-clock (cu132, the slowest variant)

| Arch | Before (matrix max) | After (unified) | Δ |
|---|---:|---:|---:|
| linux-aarch64 | ~142m | ~210m | +1.5× |
| linux-x86 | ~167m | ~237m | +1.4× |

## Binary-size sanity check

Spot-checking py3_10 and py3_14t artifacts of both runs to confirm CUDA wheels are actually produced and not accidentally CPU-only:

| Arch | Variant | Nightly py3_10 | PR py3_10 | Nightly py3_14t | PR py3_14t |
|---|---|---:|---:|---:|---:|
| aarch64 | cu126 | 327.85 MB | **327.80 MB** | 327.88 MB | **327.82 MB** |
| aarch64 | cu130 | 515.26 MB | **515.19 MB** | 515.27 MB | **515.21 MB** |
| aarch64 | cu132 | 525.04 MB | **524.97 MB** | 525.13 MB | **525.00 MB** |
| x86 | cu126 | 841.74 MB | **841.74 MB** | 841.76 MB | **841.69 MB** |
| x86 | cu130 | 615.60 MB | **615.54 MB** | 615.61 MB | **615.56 MB** |
| x86 | cu132 | 624.16 MB | **624.09 MB** | 624.17 MB | **624.11 MB** |

All deltas are within **0.05 MB** (~0.01%) — well within normal build-timestamp/dep-version variance. The CUDA payload (libtorch_cuda, cuDNN, NCCL, cuSPARSELt, etc.) is intact in every unified-build wheel.

Within a single unified job, sizes across Pythons are nearly identical (within ~10 KB) — exactly the expected shape: only `_C.so` varies per interpreter, while the multi-hundred-MB `libtorch_cuda.so` is reused.

Data: aarch64 nightly [25985669026](https://github.com/pytorch/pytorch/actions/runs/25985669026), x86 nightly [25985669024](https://github.com/pytorch/pytorch/actions/runs/25985669024), aarch64 PR [25974013813](https://github.com/pytorch/pytorch/actions/runs/25974013813), x86 PR [25974013818](https://github.com/pytorch/pytorch/actions/runs/25974013818).

Pull Request resolved: pytorch#184045
Approved by: https://github.com/Skylion007
ghstack dependencies: pytorch#183931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries Trigger all binary build and upload jobs on the PR Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants