Repository navigation
Commit cf30153
authored
Strip +PTX from CUDA arch list on release/RC builds (in build_env_setup.py) (#188914)
## Summary
Restore the pre-2.13 behavior where **release/RC** CUDA wheels ship **without `+PTX`**, while nightlies keep it for forward-compat.
### Background
`libtorch_cuda.so` grew ~80-90 MB from 2.12.1 to 2.13.0 (cu130): 2.13 started emitting `12.0+PTX` (sm_120 PTX) in the release wheels. The SASS arch set is unchanged; the growth is the embedded compute_120 PTX.
The branch-cut script `scripts/release/apply-release-changes.sh` was *supposed* to strip `+PTX` for releases, but it edited `.ci/manywheel/build_cuda.sh` — which was refactored into `.ci/manywheel/build_env_setup.py`. The `sed` silently became a no-op, so 2.13.0 shipped with `+PTX`.
### Fix
Detect release/RC builds in Python instead of relying on a branch-cut `sed`:
- `build_env_setup.py`: add `_is_release_build()` (true when `PYTORCH_BUILD_VERSION` is set and has no `.dev` suffix — i.e. tagged release/RC builds, per `binary_populate_env.sh`) and `_ptx_arches()`; emit `+PTX` only for nightly/dev builds.
- `apply-release-changes.sh`: drop the now-redundant/broken `+PTX` `sed`.
### Behavior (cuda 13.0, x86_64)
| Build | `PYTORCH_BUILD_VERSION` | arch list |
|---|---|---|
| nightly | `2.13.0.dev...+cu130` | `7.5;8.0;8.6;9.0;10.0;12.0+PTX` |
| RC / release | `2.13.0+cu130` | `7.5;8.0;8.6;9.0;10.0;12.0` |
| local / unset | `''` | `...;12.0+PTX` (safe default) |
This is drift-proof: the logic lives next to the arch table it depends on, keyed off a signal the repo already uses.
*Authored with AI assistance.*
Pull Request resolved: #188914
Approved by: https://github.com/zxiiro, https://github.com/huydhn
(cherry picked from commit 089472d)
1 parent 3e3e24b commit cf30153
2 files changed
Lines changed: 25 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
98 | | - | |
| 118 | + | |
| 119 | + | |
99 | 120 | | |
100 | 121 | | |
101 | 122 | | |
| |||
106 | 127 | | |
107 | 128 | | |
108 | 129 | | |
| 130 | + | |
109 | 131 | | |
110 | | - | |
| 132 | + | |
111 | 133 | | |
112 | 134 | | |
113 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 47 | | |
52 | 48 | | |
53 | 49 | | |
| |||
0 commit comments