Skip to content

Commit 7e3efa5

Browse files
committed
Bump PyTorch pin to 2.13
1 parent e500fee commit 7e3efa5

9 files changed

Lines changed: 47 additions & 38 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
release/2.12
1+
release/2.13

‎.ci/docker/common/install_pytorch.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ install_pytorch_and_domains() {
4040
# Grab the pinned audio and vision commits from PyTorch
4141
TORCHAUDIO_VERSION=release/2.11
4242
export TORCHAUDIO_VERSION
43-
TORCHVISION_VERSION=release/0.27
43+
TORCHVISION_VERSION=release/0.28
4444
export TORCHVISION_VERSION
4545

4646
install_domains

‎.ci/scripts/utils.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ install_pytorch_and_domains() {
107107
local torch_release=$(cat version.txt)
108108
# Download key must match the upload key below (basename of dist/*.whl,
109109
# which always carries setup.py's resolved +gitHASH). Branch-ref pins
110-
# like `release/2.12` would otherwise produce `+gitrelease` here and
110+
# like `release/2.13` would otherwise produce `+gitrelease` here and
111111
# never hit the cache.
112112
local torch_short_hash=$(git rev-parse --short=7 HEAD)
113113
local torch_wheel_path="cached_artifacts/pytorch/executorch/pytorch_wheels/${system_name}/${python_version}"
@@ -178,7 +178,7 @@ install_pytorch_and_domains() {
178178
# Grab the pinned audio and vision commits from PyTorch
179179
TORCHAUDIO_VERSION=release/2.11
180180
export TORCHAUDIO_VERSION
181-
TORCHVISION_VERSION=release/0.27
181+
TORCHVISION_VERSION=release/0.28
182182
export TORCHVISION_VERSION
183183

184184
install_domains

‎install_requirements.py‎

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# The pip repository that hosts nightly torch packages.
1616
# This will be dynamically set based on CUDA availability and CUDA backend enabled/disabled.
1717
TORCH_URL_BASE = "https://download.pytorch.org/whl/test"
18+
TORCHAO_URL_BASE = "https://download.pytorch.org/whl/nightly"
19+
TORCHAO_NIGHTLY_VERSION = "0.18.0.dev20260715"
1820

1921
# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
2022
# pip versions will have the required features.
@@ -43,13 +45,19 @@ def install_requirements(use_pytorch_nightly):
4345

4446
# Determine the appropriate PyTorch URL based on CUDA delegate status
4547
torch_url = determine_torch_url(TORCH_URL_BASE)
48+
torchao_url = determine_torch_url(TORCHAO_URL_BASE)
4649

4750
# pip packages needed by exir.
4851
TORCH_PACKAGE = [
4952
# Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note
5053
# that we don't need to set any version number there because they have already
5154
# been installed on CI before this step, so pip won't reinstall them
52-
("torch==2.12.0" if use_pytorch_nightly else "torch"),
55+
("torch==2.13.0" if use_pytorch_nightly else "torch"),
56+
(
57+
f"torchao=={TORCHAO_NIGHTLY_VERSION}"
58+
if use_pytorch_nightly
59+
else "torchao"
60+
),
5361
]
5462

5563
# Install the requirements for core ExecuTorch package.
@@ -66,44 +74,45 @@ def install_requirements(use_pytorch_nightly):
6674
*TORCH_PACKAGE,
6775
"--extra-index-url",
6876
torch_url,
77+
"--extra-index-url",
78+
torchao_url,
6979
],
7080
check=True,
7181
)
7282

73-
LOCAL_REQUIREMENTS = [
74-
"third-party/ao", # We need the latest kernels for fast iteration, so not relying on pypi.
75-
] + (
83+
LOCAL_REQUIREMENTS = (
7684
[
7785
"extension/llm/tokenizers", # TODO(larryliu0820): Setup a pypi package for this.
7886
]
7987
if sys.platform != "win32"
8088
else []
8189
) # TODO(gjcomer): Re-enable when buildable on Windows.
8290

83-
# Install packages directly from local copy instead of pypi.
84-
# This is usually not recommended.
85-
new_env = os.environ.copy()
86-
if ("EXECUTORCH_BUILD_KERNELS_TORCHAO" not in new_env) or (
87-
new_env["EXECUTORCH_BUILD_KERNELS_TORCHAO"] == "0"
88-
):
89-
new_env["USE_CPP"] = "0"
90-
else:
91-
assert new_env["EXECUTORCH_BUILD_KERNELS_TORCHAO"] == "1"
92-
new_env["USE_CPP"] = "1"
93-
new_env["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5"
94-
subprocess.run(
95-
[
96-
sys.executable,
97-
"-m",
98-
"pip",
99-
"install",
100-
# Without --no-build-isolation, setup.py can't find the torch module.
101-
"--no-build-isolation",
102-
*LOCAL_REQUIREMENTS,
103-
],
104-
env=new_env,
105-
check=True,
106-
)
91+
if LOCAL_REQUIREMENTS:
92+
# Install packages directly from local copy instead of pypi.
93+
# This is usually not recommended.
94+
new_env = os.environ.copy()
95+
if ("EXECUTORCH_BUILD_KERNELS_TORCHAO" not in new_env) or (
96+
new_env["EXECUTORCH_BUILD_KERNELS_TORCHAO"] == "0"
97+
):
98+
new_env["USE_CPP"] = "0"
99+
else:
100+
assert new_env["EXECUTORCH_BUILD_KERNELS_TORCHAO"] == "1"
101+
new_env["USE_CPP"] = "1"
102+
new_env["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5"
103+
subprocess.run(
104+
[
105+
sys.executable,
106+
"-m",
107+
"pip",
108+
"install",
109+
# Without --no-build-isolation, setup.py can't find the torch module.
110+
"--no-build-isolation",
111+
*LOCAL_REQUIREMENTS,
112+
],
113+
env=new_env,
114+
check=True,
115+
)
107116

108117

109118
def install_optional_example_requirements(use_pytorch_nightly):
@@ -112,7 +121,7 @@ def install_optional_example_requirements(use_pytorch_nightly):
112121

113122
print("Installing torch domain libraries")
114123
DOMAIN_LIBRARIES = [
115-
("torchvision==0.27.0" if use_pytorch_nightly else "torchvision"),
124+
("torchvision==0.28.0" if use_pytorch_nightly else "torchvision"),
116125
("torchaudio==2.11.0" if use_pytorch_nightly else "torchaudio"),
117126
]
118127
# Then install domain libraries

‎runtime/core/portable_type/c10/c10/util/BFloat16-math.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ template <
181181
typename T,
182182
typename std::enable_if_t<c10::is_reduced_floating_point_v<T>, int> = 0>
183183
inline T rsqrt(T a) {
184-
return 1.0 / std::sqrt(float(a));
184+
return 1.0f / std::sqrt(float(a));
185185
}
186186
template <
187187
typename T,

‎runtime/core/portable_type/c10/c10/util/complex_math.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ C10_HOST_DEVICE inline c10::complex<T> atanh(const c10::complex<T>& x) {
327327
template <typename T>
328328
C10_HOST_DEVICE inline c10::complex<T> log1p(const c10::complex<T>& z) {
329329
#if defined(__APPLE__) || defined(__MACOSX) || defined(__CUDACC__) || \
330-
defined(__HIPCC__)
330+
defined(__HIPCC__) || defined(__SYCL_DEVICE_ONLY__)
331331
// For Mac, the new implementation yielded a high relative error. Falling back
332332
// to the old version for now.
333333
// See https://github.com/numpy/numpy/pull/22611#issuecomment-1667945354

‎runtime/core/portable_type/c10/torch/headeronly/util/Half.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ C10_HOST_DEVICE inline float fp16_ieee_to_fp32_value(uint16_t h) {
236236
/*
237237
* - Choose either results of conversion of input as a normalized number, or
238238
* as a denormalized number, depending on the input exponent. The variable
239-
* two_w contains input exponent in bits 27-31, therefore if its smaller than
239+
* two_w contains input exponent in bits 27-31, therefore if it's smaller than
240240
* 2**27, the input is either a denormal number, or zero.
241241
* - Combine the result of conversion of exponent and mantissa with the sign
242242
* of the input number.

‎third-party/ao‎

Submodule ao updated 351 files

‎torch_pin.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
TORCH_VERSION = "2.12.0"
1+
TORCH_VERSION = "2.13.0"
22
# NIGHTLY_VERSION = "dev20260318" Temporarily pinning to stable release candidate. Revert https://github.com/pytorch/executorch/pull/18287

0 commit comments

Comments
 (0)