Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .ci/scripts/test-rocm-aoti.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ export TORCHINDUCTOR_COMPILE_THREADS=1

read -r TORCH_VERSION TORCHAO_VERSION < <(
python - <<'PY'
from install_requirements import ROCM_TORCHAO_NIGHTLY_VERSION
from torch_pin import TORCH_VERSION
from install_requirements import ROCM_TORCH_VERSION, ROCM_TORCHAO_NIGHTLY_VERSION

print(TORCH_VERSION, ROCM_TORCHAO_NIGHTLY_VERSION)
print(ROCM_TORCH_VERSION, ROCM_TORCHAO_NIGHTLY_VERSION)
PY
)
# TorchAO ROCm wheels are not exposed by the per-version pip index.
Expand Down Expand Up @@ -139,7 +138,7 @@ fi

export EXECUTORCH_EXECUTOR_RUNNER="${PWD}/cmake-out-rocm-llm/executor_runner"
ROCM_EXCLUDED_TESTS=(
# This focused job does not install the optional flash-linear-attention package.
# This focused job does not install the optional fla-core package.
--ignore=backends/cuda/tests/test_chunk_gated_delta_rule.py
# Defer specialized SDPA suites until their CI cost is measured.
--ignore=backends/cuda/tests/test_tq4_sdpa.py
Expand Down
5 changes: 2 additions & 3 deletions .ci/scripts/test-rocm-voxtral.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ export HF_TOKEN

read -r TORCH_VERSION TORCHAO_VERSION < <(
python - <<'PY'
from install_requirements import ROCM_TORCHAO_NIGHTLY_VERSION
from torch_pin import TORCH_VERSION
from install_requirements import ROCM_TORCH_VERSION, ROCM_TORCHAO_NIGHTLY_VERSION

print(TORCH_VERSION, ROCM_TORCHAO_NIGHTLY_VERSION)
print(ROCM_TORCH_VERSION, ROCM_TORCHAO_NIGHTLY_VERSION)
PY
)
# TorchAO ROCm wheels are not exposed by the per-version pip index.
Expand Down
5 changes: 3 additions & 2 deletions .ci/scripts/test_espressif_idf_component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ if not any(l.startswith("generator: ") and l.endswith(" --version-suffix ''") fo
sys.exit("FAIL: the release component's VERSION does not record --version-suffix ''")
sys.path.insert(0, clone)
from install_requirements import TORCH_URL_BASE
from torch_pin import TORCH_VERSION

if not any(re.fullmatch(r"torch_requirement: torch==\d+\.\d+\.\d+\S*", l) for l in lines):
sys.exit("FAIL: the release component's VERSION has no torch_requirement: torch==X.Y.Z")
if f"torch_requirement: torch=={TORCH_VERSION}" not in lines:
sys.exit(f"FAIL: the release component's VERSION has no torch_requirement: torch=={TORCH_VERSION}")
if f"torch_index: {TORCH_URL_BASE}/cpu" not in lines:
sys.exit(f"FAIL: the release component's VERSION has no torch_index: {TORCH_URL_BASE}/cpu")
if f'version: "{version}"' not in (component / "idf_component.yml").read_text().splitlines():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import importlib.util
import io
import os
import re
import subprocess
import sys
import unittest
Expand All @@ -27,7 +28,7 @@ def load_module(name):
return module


class TestCu134Dependencies(unittest.TestCase):
class TestInstallDependencies(unittest.TestCase):
def setUp(self):
self.utils = load_module("install_utils")
self.modules = patch.dict(sys.modules, {"install_utils": self.utils})
Expand Down Expand Up @@ -63,60 +64,40 @@ def install_commands(
self.installer.install_optional_example_requirements(nightly)
return [call.args[0] for call in run.call_args_list]

def test_all_install_steps_preserve_exact_cu134_selection(self):
for machine, ao_variant in (("x86_64", "cu134"), ("aarch64", "cpu")):
with self.subTest(machine=machine):
commands = self.install_commands((13, 4), machine)
self.assertEqual(len(commands), 4)
expected = {
"torch==2.15.0.dev20260921+cu134",
"torchvision==0.30.0.dev20260922+cu134",
"torchaudio==2.11.0.dev20260922+cu134",
f"torchao=={self.installer.TORCHAO_NIGHTLY_VERSION}+{ao_variant}",
}
for index, command in enumerate(commands):
required = (
expected
if index >= 2
else {
requirement
for requirement in expected
if requirement.startswith(("torch==", "torchao=="))
}
)
self.assertTrue(required.issubset(command), command)
if index < 2:
self.assertFalse(
any(
arg.startswith(("torchvision", "torchaudio"))
for arg in command
)
)
self.assertIn(
"https://download.pytorch.org/whl/nightly/cu134", command
)
self.assertNotIn(
"https://download.pytorch.org/whl/test/cu134", command
)
self.assertNotIn("--no-deps", command)
if machine == "aarch64":
self.assertIn(
"https://download.pytorch.org/whl/nightly/cpu", command
)
def assert_pins(self, core, domains, nightly=True):
if nightly:
self.assertIn(f"torch=={self.installer.TORCH_VERSION}", core)
self.assertIn(f"torchvision=={self.installer.TORCHVISION_VERSION}", domains)
self.assertIn(f"torchaudio=={self.installer.TORCHAUDIO_VERSION}", domains)
else:
self.assertIn("torch", core)
self.assertIn("torchvision", domains)
self.assertIn("torchaudio", domains)
self.assertFalse(any(arg.startswith("torch==") for arg in core))

def test_other_cuda_trains_keep_existing_pins(self):
for cuda in ((13, 2),):
def test_cuda_trains_share_one_set_of_pins(self):
for cuda in self.utils.SUPPORTED_CUDA_VERSIONS:
for machine in ("x86_64", "aarch64"):
with self.subTest(cuda=cuda, machine=machine):
core, local, domains, examples = self.install_commands(
cuda, machine
)
self.assertIn("torch==2.14.0", core)
commands = self.install_commands(cuda, machine)
self.assertEqual(len(commands), 4)
core, local, domains, examples = commands
self.assert_pins(core, domains)
self.assertIn(
f"torchao=={self.installer.TORCHAO_NIGHTLY_VERSION}", core
)
self.assertIn("torchvision==0.29.0", domains)
self.assertIn("torchaudio==2.11.0", domains)
train = f"cu{cuda[0]}{cuda[1]}"
self.assertIn(
f"https://download.pytorch.org/whl/test/{train}", core
)
self.assertIn(
f"https://download.pytorch.org/whl/test/{train}", domains
)
torchao_index = "cpu" if machine == "aarch64" else train
self.assertIn(
f"https://download.pytorch.org/whl/nightly/{torchao_index}",
core,
)
self.assertFalse(any("==" in arg for arg in local))
self.assertFalse(any("==" in arg for arg in examples))

Expand All @@ -142,47 +123,39 @@ def test_cuda_13_0_falls_back_to_cpu_with_a_warning(self):
self.assertIn("CUDA 13.0 is installed but not supported", stderr.getvalue())

def test_source_pinned_torch_is_not_replaced(self):
for cuda in ((13, 2), (13, 4)):
for cuda in self.utils.SUPPORTED_CUDA_VERSIONS:
with self.subTest(cuda=cuda):
core, _, domains, _ = self.install_commands(cuda, nightly=False)
self.assertIn("torch", core)
self.assertNotIn("torch==2.15.0.dev20260921+cu134", core)
self.assertIn("torchvision", domains)
self.assertIn("torchaudio", domains)
self.assert_pins(core, domains, nightly=False)

def test_no_cuda_keeps_default_pins(self):
core, _, domains, _ = self.install_commands(None)
self.assertIn("torch==2.14.0", core)
self.assert_pins(core, domains)
self.assertIn(f"torchao=={self.installer.TORCHAO_NIGHTLY_VERSION}", core)
self.assertIn("torchvision==0.29.0", domains)
self.assertIn("https://download.pytorch.org/whl/test/cpu", core)

def test_cpu_release_dependencies_are_opt_in(self):
for machine, python_version, audio in (
("x86_64", (3, 12), "2.11.0"),
("aarch64", (3, 12), "2.11.0"),
("x86_64", (3, 15), "2.11.1"),
("aarch64", (3, 15), "2.11.1"),
):
with self.subTest(machine=machine, python_version=python_version):
core, _, domains, examples = self.install_commands(
None,
machine,
python_version=python_version,
env={"EXECUTORCH_USE_RELEASE_CPU_DEPS": "1"},
)
self.assertIn("torch==2.14.0", core)
self.assertIn(f"torchao=={self.installer.TORCHAO_STABLE_VERSION}", core)
self.assertIn("torchvision==0.29.0", domains)
self.assertIn(f"torchaudio=={audio}", domains)
for command in (core, domains, examples):
self.assertIn("https://download.pytorch.org/whl/cpu", command)
self.assertFalse(
any("/nightly" in arg or "/test/" in arg for arg in command)
for machine in ("x86_64", "aarch64"):
for python_version in ((3, 12), (3, 15)):
with self.subTest(machine=machine, python_version=python_version):
core, _, domains, examples = self.install_commands(
None,
machine,
python_version=python_version,
env={"EXECUTORCH_USE_RELEASE_CPU_DEPS": "1"},
)
self.assert_pins(core, domains)
self.assertIn(
f"torchao=={self.installer.TORCHAO_STABLE_VERSION}", core
)
for command in (core, domains, examples):
self.assertIn("https://download.pytorch.org/whl/cpu", command)
self.assertFalse(
any("/nightly" in arg or "/test/" in arg for arg in command)
)

def test_cpu_release_option_keeps_cuda_pins(self):
for cuda in ((13, 2), (13, 4)):
for cuda in self.utils.SUPPORTED_CUDA_VERSIONS:
for machine in ("x86_64", "aarch64"):
with self.subTest(cuda=cuda, machine=machine):
self.assertEqual(
Expand Down Expand Up @@ -212,47 +185,46 @@ def test_cpu_source_build_keeps_nightly_torchao(self):
self.assertIn("https://download.pytorch.org/whl/test/cpu", command)
self.assertIn("third-party/ao", local)

def test_windows_does_not_select_cu134(self):
def test_windows_uses_cpu_wheels(self):
core, _, domains, _ = self.install_commands((13, 4), system="Windows")
self.assertIn("torch==2.14.0", core)
self.assertIn("torchvision==0.29.0", domains)
self.assert_pins(core, domains)
self.assertIn("https://download.pytorch.org/whl/test/cpu", core)

def test_python315_cpu_domains_use_available_torchaudio(self):
def test_domain_pins_do_not_depend_on_python_version(self):
for system in ("Linux", "Darwin", "Windows"):
for version in ((3, 14), (3, 15)):
for version in ((3, 11), (3, 14), (3, 15)):
with self.subTest(system=system, version=version):
_, _, domains, _ = self.install_commands(
core, _, domains, _ = self.install_commands(
None, machine="arm64", system=system, python_version=version
)
audio = "2.11.1" if version >= (3, 15) else "2.11.0"
self.assertIn(f"torchaudio=={audio}", domains)
self.assertIn("torchvision==0.29.0", domains)
self.assert_pins(core, domains)
self.assertIn("https://download.pytorch.org/whl/test/cpu", domains)

def test_python315_cuda_domains_use_available_torchaudio(self):
for machine in ("x86_64", "aarch64"):
with self.subTest(machine=machine):
_, _, domains, _ = self.install_commands(
(13, 2), machine=machine, python_version=(3, 15)
def test_rocm_scripts_install_the_rocm_torch_pin(self):
if self.installer.ROCM_TORCH_VERSION == self.installer.TORCH_VERSION:
self.skipTest(
"ROCM_TORCH_VERSION equals TORCH_VERSION, so this cannot tell "
"which pin the ROCm scripts install"
)
for script in ("test-rocm-aoti.sh", "test-rocm-voxtral.sh"):
with self.subTest(script=script):
text = (ROOT / ".ci" / "scripts" / script).read_text()
snippet = re.search(r"python - <<'PY'\n(.*?)\nPY\n", text, re.S)
self.assertIsNotNone(snippet)
printed = subprocess.run(
[sys.executable, "-c", snippet.group(1)],
cwd=ROOT,
capture_output=True,
check=True,
text=True,
).stdout.split()
self.assertEqual(
printed,
[
self.installer.ROCM_TORCH_VERSION,
self.installer.ROCM_TORCHAO_NIGHTLY_VERSION,
],
)
self.assertIn("torchaudio==2.11.1", domains)
self.assertIn("torchvision==0.29.0", domains)
self.assertIn("https://download.pytorch.org/whl/test/cu132", domains)

def test_python315_preserves_cu134_and_source_pins(self):
for cuda in ((13, 2), (13, 4)):
for nightly in (True, False):
with self.subTest(cuda=cuda, nightly=nightly):
_, _, domains, _ = self.install_commands(
cuda, nightly=nightly, python_version=(3, 15)
)
audio = (
"torchaudio==2.11.0.dev20260922+cu134"
if nightly and cuda == (13, 4)
else "torchaudio==2.11.1" if nightly else "torchaudio"
)
self.assertIn(audio, domains)

def test_macos_availability_workaround_is_scoped_to_sentencepiece(self):
for version in ((3, 14), (3, 15)):
Expand Down Expand Up @@ -382,7 +354,7 @@ def test_package_install_preserves_source_pinned_torchao(self):
self.assertIn("torch", core)
self.assertFalse(any(arg.startswith("torch==") for arg in core))

def test_cu134_keeps_explicit_torchao_source_build(self):
def test_explicit_torchao_source_build_is_kept(self):
with patch.dict(sys.modules, {"install_requirements": self.installer}):
package_installer = load_module("install_executorch")
for source_flag in (
Expand Down Expand Up @@ -412,11 +384,20 @@ def test_cu134_keeps_explicit_torchao_source_build(self):
self.assertEqual(len(commands), 5)
self.assertIn("third-party/ao", commands[1])
self.assertIn(".", commands[2])
for command in commands:
self.assertFalse(
any(arg.startswith("torchao==") for arg in command)
)
self.assertIn("torch==2.15.0.dev20260921+cu134", commands[-1])
self.assertIn(f"torch=={self.installer.TORCH_VERSION}", commands[0])
self.assertIn(
f"torchao=={self.installer.TORCHAO_NIGHTLY_VERSION}", commands[0]
)
# Nothing after the third-party/ao build may pin torchao, or pip would
# replace the source build.
self.assertFalse(
any(
arg.startswith("torchao==")
for command in commands[2:]
for arg in command
),
commands[2:],
)
source_version = self.installer.TORCHAO_NIGHTLY_VERSION.partition(
".dev"
)[0]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-wheels-cuda-aarch64-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- examples/**/*
- extension/cuda/**/*
- install_requirements.py
- torch_pin.py
- install_utils.py
- pyproject.toml
- setup.py
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-wheels-cuda-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- examples/**/*
- extension/cuda/**/*
- install_requirements.py
- torch_pin.py
- install_utils.py
- pyproject.toml
- setup.py
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-wheels-cuda-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- backends/cuda/**/*
- extension/cuda/**/*
- install_utils.py
- install_requirements.py
- torch_pin.py
- pyproject.toml
- setup.py
- docs/source/using-executorch-cpp.md
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,10 @@ jobs:
popd
fi

# Install flash-linear-attention for chunk_gated_delta_rule triton kernel tests
pip install "flash-linear-attention==0.4.2"
# Install FLA's kernels for the chunk_gated_delta_rule triton kernel tests and the
# Qwen3.5 tests below, which import that kernel. Releases before 0.6.0 fail to
# import under the triton 3.9 that torch 2.15 requires.
pip install -r examples/models/qwen3_5_moe/requirements.txt

# Build executor_runner (needed by CUDA backend e2e tests in both shards)
cmake --build cmake-out --target executor_runner
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ jobs:
contains(needs.changed-files.outputs.changed-files, 'pyproject.toml') ||
contains(needs.changed-files.outputs.changed-files, 'install_executorch') ||
contains(needs.changed-files.outputs.changed-files, 'install_requirements') ||
contains(needs.changed-files.outputs.changed-files, 'torch_pin.py') ||
contains(needs.changed-files.outputs.changed-files, 'install_utils.py') ||
contains(needs.changed-files.outputs.changed-files, 'requirements-') ||
contains(needs.changed-files.outputs.changed-files, 'src/executorch') ||
Expand Down Expand Up @@ -1049,6 +1050,7 @@ jobs:
contains(needs.changed-files.outputs.changed-files, 'install_executorch.py') ||
contains(needs.changed-files.outputs.changed-files, 'install_requirements.sh') ||
contains(needs.changed-files.outputs.changed-files, 'install_requirements.py') ||
contains(needs.changed-files.outputs.changed-files, 'torch_pin.py') ||
contains(needs.changed-files.outputs.changed-files, 'pyproject.toml') ||
contains(needs.changed-files.outputs.changed-files, '.github/workflows/_get-changed-files.yml') ||
contains(needs.changed-files.outputs.changed-files, '.github/workflows/pull.yml')
Expand Down Expand Up @@ -2172,6 +2174,7 @@ jobs:
contains(needs.changed-files.outputs.changed-files, 'install_executorch.py') ||
contains(needs.changed-files.outputs.changed-files, 'install_executorch.sh') ||
contains(needs.changed-files.outputs.changed-files, 'install_requirements.py') ||
contains(needs.changed-files.outputs.changed-files, 'torch_pin.py') ||
contains(needs.changed-files.outputs.changed-files, 'install_requirements.sh') ||
contains(needs.changed-files.outputs.changed-files, '.github/workflows/pull.yml') ||
needs.run-decision.outputs.is-full-run == 'true'
Expand Down
Loading
Loading