install: make torch 2.11 the default supported line on wheel-backed platforms

Fresh installs now resolve the torch 2.11 trio (torch 2.11.0,
torchvision 0.26.0, torchaudio 2.11.0) everywhere the wheels exist,
verified by live index resolution for py3.11-3.13: Linux x86_64
(cpu, cu126, cu128, cu130, rocm7.1, rocm7.2), Linux aarch64 (cpu,
cu130), Windows x86_64 (cpu, cu126, cu128, cu130; triton-windows<3.7
resolves 3.6.0.post26, the 2.11 pairing) and macOS arm64. Existing
installs are unaffected: the release preservation on both installers
keeps the installed torch on re-runs (verified end to end against the
live cpu index: a seeded 2.10.0 venv stays 2.10.0 with paired 0.25/2.10
companions while a fresh venv resolves the 2.11 trio).

- install.sh: the supported range is centralized in _TORCH_CEILING /
  _TORCHVISION_CEILING / _TORCHAUDIO_CEILING and composed into the
  default constraints, so the next bump (torch 2.12) is a three-line
  change. The now-redundant cu* widen arm and custom-pin companion
  block collapse into the default; the curated ROCm >=2.11 floors stay
  literal.
- install.ps1: the hoisted default trio, the CUDA flavor repair and the
  ROCm CPU fallback all use the <2.12 trio (the leaf gate collapsed
  since cu and non-cu now share the range).
- setup.ps1: the unknown-leaf pinned CUDA trio widens to <2.12,
  matching the pinned cpu path.

Deliberately NOT widened: rocm6.4 (tops at torch 2.9.1) and rocm7.0
(2.10.0) by index content; macOS x86_64 (no >=2.4 wheels, stays
no-torch); the AMD per-arch repo.amd.com curated bounds for arches
outside the 2.11 allowlist.

Constraint suites updated to the ceiling scheme; parity suites updated
to the widened trio. All sh, ps1 and pytest installer suites pass (the
host-defaults suite and the tokenizers negative-control are known
pre-existing failures).
This commit is contained in:
Daniel Han 2026-07-20 10:44:42 +00:00
commit 3f79b5e53d
6 changed files with 100 additions and 132 deletions

View file

@ -405,30 +405,25 @@ class TestKnown211SetParity:
), f"{label} floor gate must not use the unanchored ^rocm(\\d+)\\.(\\d+) prefix"
def test_install_ps1_bounds_unknown_leaf_pinned_torch(self):
"""install.ps1's pinned-torch install must bound BOTH companions on EVERY
index, cu<digits> families included: torchaudio 2.11 dropped its exact torch
pin from the wheel metadata, so a bare companion beside torch<2.11 can
resolve a mismatched 2.11.0 build (Codex P2, then unconditional per the
torchaudio 2.11 unpinning)."""
"""install.ps1's pinned-torch install must bound the whole trio on EVERY
index with the default torch 2.11 line (<2.12 trio, matching install.sh's
ceiling-composed default and _CUDA_TORCH_PKG_SPEC): torchaudio 2.11
dropped its exact torch pin from the wheel metadata, so a bare companion
beside a capped torch can resolve a mismatched build."""
text = INSTALL_PS1.read_text(encoding = "utf-8")
assert (
'$_pinVisionSpec = "torchvision>=0.19,<0.26.0"' in text
), "install.ps1 custom-pin install must bound torchvision (>=0.19,<0.26.0)"
assert (
'$_pinAudioSpec = "torchaudio>=2.4,<2.11.0"' in text
), "install.ps1 custom-pin install must bound torchaudio (>=2.4,<2.11.0)"
# cu<digits> leaves widen the whole trio to the torch 2.11 line (<2.12),
# matching install.sh's cu[0-9]* widen and _CUDA_TORCH_PKG_SPEC; other
# leaves keep the 2.10 line. The trio stays bounded on every index.
assert '$_pinTorchSpec = "torch>=2.4,<2.12.0"' in text, (
"install.ps1 must widen torch to <2.12.0 on cu<digits> index leaves"
"install.ps1 default install must use the torch 2.11 line (<2.12.0)"
)
assert (
'$_pinVisionSpec = "torchvision>=0.19,<0.27.0"' in text
), "install.ps1 cu-leaf install must pair torchvision <0.27.0 with torch <2.12"
), "install.ps1 must pair torchvision <0.27.0 with torch <2.12"
assert (
'$_pinAudioSpec = "torchaudio>=2.4,<2.12.0"' in text
), "install.ps1 cu-leaf install must pair torchaudio <2.12.0 with torch <2.12"
), "install.ps1 must pair torchaudio <2.12.0 with torch <2.12"
# No stale 2.10-line default remains anywhere in the Windows installer.
assert '"torch>=2.4,<2.11.0"' not in text, (
"install.ps1 must not retain a <2.11.0 default torch range"
)
# The bounded trio must actually be passed to the install command.
assert re.search(
r'\$_pinTorchSpec \$_pinVisionSpec \$_pinAudioSpec --default-index \$TorchIndexUrl',
@ -672,9 +667,9 @@ class TestPinnedIndexClearsUvEnvParity:
# The custom-leaf branch bounds torch AND both companions (parity with the
# other installers' custom-pin trio bounds), gated on a non-cu-family leaf.
for spec in (
'$cudaTorchSpec = "torch>=2.4,<2.11.0"',
'$cudaVisionSpec = "torchvision>=0.19,<0.26.0"',
'$cudaAudioSpec = "torchaudio>=2.4,<2.11.0"',
'$cudaTorchSpec = "torch>=2.4,<2.12.0"',
'$cudaVisionSpec = "torchvision>=0.19,<0.27.0"',
'$cudaAudioSpec = "torchaudio>=2.4,<2.12.0"',
):
assert spec in text, f"setup.ps1 must bound the custom-leaf trio: {spec}"
assert (

View file

@ -64,35 +64,30 @@ class TestStructuralTorchConstraint:
_sh = _read(_INSTALL_SH)
def test_default_assignment_exists(self):
assert 'TORCH_CONSTRAINT="torch>=2.4,<2.11.0"' in self._sh
"""The default range composes the per-file ceiling variable, so the
supported line (torch 2.11 today) is bumped in one place."""
assert '_TORCH_CEILING="2.12.0"' in self._sh
assert 'TORCH_CONSTRAINT="torch>=2.4,<${_TORCH_CEILING}"' in self._sh
def test_tightened_assignment_exists(self):
assert 'TORCH_CONSTRAINT="torch>=2.6,<2.11.0"' in self._sh
assert 'TORCH_CONSTRAINT="torch>=2.6,<${_TORCH_CEILING}"' in self._sh
def test_cuda_constraint_widened_to_2_12(self):
"""A fresh CUDA install widens the ceiling to <2.12.0 so cu12x/cu13x
land torch 2.11.x (matches the base image and _CUDA_TORCH_PKG_SPEC);
without it cu128/cu130 resolves torch 2.10.x."""
assert 'TORCH_CONSTRAINT="torch>=2.4,<2.12.0"' in self._sh
def test_cuda_case_widens_via_index_leaf(self):
"""The cu* branch of the _torch_index_leaf case sets the widened
constraint (parallel to rocm7.2), anchored on the leaf."""
m = re.search(
r'cu\[0-9\]\*\)\s*TORCH_CONSTRAINT="torch>=2\.4,<2\.12\.0"',
self._sh,
)
assert m is not None, "CUDA (cu*) TORCH_CONSTRAINT widening case not found"
def test_companion_ceilings_composed(self):
"""Companions bound to the same window via their own ceiling vars."""
assert '_TORCHVISION_CEILING="0.27.0"' in self._sh
assert '_TORCHAUDIO_CEILING="2.12.0"' in self._sh
assert 'TORCHVISION_CONSTRAINT="torchvision>=0.19,<${_TORCHVISION_CEILING}"' in self._sh
assert 'TORCHAUDIO_CONSTRAINT="torchaudio>=2.4,<${_TORCHAUDIO_CEILING}"' in self._sh
def test_variable_used_in_pip_install(self):
"""$TORCH_CONSTRAINT must appear in a uv pip install line."""
assert '"$TORCH_CONSTRAINT"' in self._sh
def test_hardcoded_torch_constraint_only_once(self):
"""The hard-coded torch>=2.4,<2.11.0 string should appear exactly once
in install.sh (the default assignment), not in pip install lines."""
count = self._sh.count('"torch>=2.4,<2.11.0"')
assert count == 1, f"Expected 1, found {count}"
def test_hardcoded_torch_constraint_gone(self):
"""No hard-coded default ranges remain outside the ceiling-composed
assignments (curated ROCm >=2.11 floors stay literal)."""
assert self._sh.count('"torch>=2.4,<2.11.0"') == 0
assert self._sh.count('"torch>=2.4,<2.12.0"') == 0
def test_tightening_guarded_by_skip_torch(self):
"""The block must check SKIP_TORCH=false."""
@ -122,7 +117,7 @@ class TestStructuralInstallPs1Unchanged:
assert "$TorchConstraint" not in self._ps1
def test_hardcoded_torch_constraint_present(self):
assert '"torch>=2.4,<2.11.0"' in self._ps1
assert '"torch>=2.4,<2.12.0"' in self._ps1
class TestInstallPs1UvDefaultIndex: