Skip to content

Commit 727aee7

Browse files
committed
Bump PyTorch pin to 2.13
1 parent af62dce commit 727aee7

29 files changed

Lines changed: 294 additions & 59 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: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ install_domains() {
1616
pip_install --no-build-isolation --user "git+https://github.com/pytorch/vision.git@${TORCHVISION_VERSION}"
1717
}
1818

19+
configure_pytorch_compiler() {
20+
local cxx_version
21+
cxx_version=$(/usr/bin/c++ --version | head -n1)
22+
if [[ "${cxx_version}" == *clang* ]]; then
23+
local clang_major
24+
clang_major=$(/usr/bin/c++ -dumpversion | cut -d. -f1)
25+
if [[ "${clang_major}" =~ ^[0-9]+$ && "${clang_major}" -lt 16 ]] &&
26+
command -v gcc >/dev/null &&
27+
command -v g++ >/dev/null; then
28+
export CC=gcc
29+
export CXX=g++
30+
fi
31+
fi
32+
}
33+
1934
install_pytorch_and_domains() {
2035
git clone https://github.com/pytorch/pytorch.git
2136

@@ -33,14 +48,15 @@ install_pytorch_and_domains() {
3348
if [[ -n "${PYTORCH_BUILD_MAX_JOBS:-}" ]]; then
3449
export MAX_JOBS="${PYTORCH_BUILD_MAX_JOBS}"
3550
fi
51+
configure_pytorch_compiler
3652
# Then build and install PyTorch
3753
conda_run python setup.py bdist_wheel
3854
pip_install "$(echo dist/*.whl)"
3955

4056
# Grab the pinned audio and vision commits from PyTorch
4157
TORCHAUDIO_VERSION=release/2.11
4258
export TORCHAUDIO_VERSION
43-
TORCHVISION_VERSION=release/0.27
59+
TORCHVISION_VERSION=release/0.28
4460
export TORCHVISION_VERSION
4561

4662
install_domains

‎.ci/scripts/setup-windows.ps1‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ conda activate et
1414
# Install test dependencies
1515
pip install -r .ci/docker/requirements-ci.txt
1616

17+
# PyTorch 2.13 headers use designated initializers in c10, which require C++20
18+
# with MSVC.
19+
$env:CMAKE_ARGS = "$env:CMAKE_ARGS -DCMAKE_CXX_STANDARD=20"
20+
1721
# The Windows CI image ships CUDA toolkits on PATH, so install_executorch
1822
# (setup.py) auto-enables EXECUTORCH_BUILD_CUDA whenever the detected nvcc
1923
# version is in SUPPORTED_CUDA_VERSIONS. CPU-only jobs install CPU torch, so a

‎.ci/scripts/test_model_e2e_windows.ps1‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,35 @@ try {
172172
"-DCUDAToolkit_ROOT=$env:CUDA_HOME"
173173
)
174174
}
175+
$cmakeCommonArgs = @("-DCMAKE_CXX_STANDARD=20")
175176
Write-Host "::endgroup::"
176177

177178
Write-Host "::group::Build ExecuTorch (CUDA)"
178179
$numCores = [Math]::Max([Environment]::ProcessorCount - 1, 1)
180+
$cmakeOut = Join-Path -Path $executorchRoot -ChildPath "cmake-out"
181+
$executorchCmakeDir = Join-Path -Path $cmakeOut -ChildPath "lib\cmake\ExecuTorch"
182+
$executorchConfig = Join-Path -Path $executorchCmakeDir -ChildPath "executorch-config.cmake"
179183
# EXECUTORCH_BUILD_EXTENSION_IMAGE defaults OFF in the preset, so it must be
180184
# enabled explicitly here (matching the Makefile CUDA target used on Linux).
181185
# The dinov2 runner links the installed extension_image.lib; without this the
182186
# main install never builds it and dinov2_runner fails to link (LNK1181).
183-
cmake --preset llm-release-cuda -DEXECUTORCH_BUILD_EXTENSION_IMAGE=ON @cmakeCudaArgs
184-
cmake --build cmake-out --target install --config Release -j $numCores
187+
cmake --preset llm-release-cuda -DEXECUTORCH_BUILD_EXTENSION_IMAGE=ON @cmakeCommonArgs @cmakeCudaArgs
188+
cmake --build $cmakeOut --config Release -j $numCores
189+
cmake --install $cmakeOut --config Release
190+
if (-not (Test-Path -Path $executorchConfig -PathType Leaf)) {
191+
throw "ExecuTorch CMake package config not found after install: $executorchConfig"
192+
}
185193
Write-Host "::endgroup::"
186194

187195
Write-Host "::group::Build $runnerTarget"
196+
$cmakePackageArgs = @(
197+
"-DCMAKE_FIND_ROOT_PATH=$cmakeOut",
198+
"-DCMAKE_PREFIX_PATH=$cmakeOut;$executorchCmakeDir",
199+
"-Dexecutorch_DIR=$executorchCmakeDir"
200+
)
188201
Push-Location (Join-Path -Path $executorchRoot -ChildPath "examples\models\$runnerPath")
189202
try {
190-
cmake --preset $runnerPreset @cmakeCudaArgs
203+
cmake --preset $runnerPreset @cmakeCommonArgs @cmakePackageArgs @cmakeCudaArgs
191204
cmake --build (Join-Path -Path $executorchRoot -ChildPath "cmake-out\examples\models\$runnerPath") --target $runnerTarget --config Release -j $numCores
192205
}
193206
finally {

‎.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

‎.github/workflows/mlx.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ jobs:
158158
--prompt-len 4 \
159159
--max-new-tokens 5 2>&1)
160160
echo "$OUTPUT"
161-
if echo "$OUTPUT" | grep -q "Generated token ids: \[167, 94, 253, 88, 227\]"; then
161+
if echo "$OUTPUT" | grep -q "Generated token ids: \[167, 180, 167, 180, 167\]"; then
162162
echo "Success: Qwen 3.5 MoE MLX export + inference completed with expected output"
163163
else
164-
echo "Failed: unexpected output (expected [167, 94, 253, 88, 227])"
164+
echo "Failed: unexpected output (expected [167, 180, 167, 180, 167])"
165165
exit 1
166166
fi
167167
echo "::endgroup::"

‎backends/aoti/common_shims.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ AOTITorchError aoti_torch_get_dim(Tensor* tensor, int64_t* ret_dim) {
154154
return Error::Ok;
155155
}
156156

157+
AOTITorchError aoti_torch_get_numel(Tensor* tensor, int64_t* ret_numel) {
158+
*ret_numel = static_cast<int64_t>(tensor->numel());
159+
return Error::Ok;
160+
}
161+
157162
// Device and layout utility functions
158163
int32_t aoti_torch_device_type_cpu() {
159164
// Let's say cpu is 0 for ET as well

‎backends/aoti/common_shims.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ aoti_torch_get_device_index(Tensor* tensor, int32_t* ret_device_index);
5959
AOTI_SHIM_EXPORT AOTITorchError
6060
aoti_torch_get_dim(Tensor* tensor, int64_t* ret_dim);
6161

62+
AOTI_SHIM_EXPORT AOTITorchError
63+
aoti_torch_get_numel(Tensor* tensor, int64_t* ret_numel);
64+
6265
// Utility functions for device and layout information
6366
AOTI_SHIM_EXPORT int32_t aoti_torch_device_type_cpu();
6467
AOTI_SHIM_EXPORT int32_t aoti_torch_layout_strided();

‎backends/aoti/common_shims_slim.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ AOTITorchError aoti_torch_get_dim(Tensor* tensor, int64_t* ret_dim) {
6060
return Error::Ok;
6161
}
6262

63+
AOTITorchError aoti_torch_get_numel(Tensor* tensor, int64_t* ret_numel) {
64+
if (tensor == nullptr || ret_numel == nullptr) {
65+
return Error::InvalidArgument;
66+
}
67+
*ret_numel = static_cast<int64_t>(tensor->numel());
68+
return Error::Ok;
69+
}
70+
6371
int32_t aoti_torch_layout_strided() {
6472
// Slimtensor only support strided layout, the return value will always be 0,
6573
// a.k.a at::Layout::Strided;

‎backends/aoti/common_shims_slim.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ aoti_torch_get_dtype(Tensor* tensor, int32_t* ret_dtype);
4848
AOTI_SHIM_EXPORT AOTITorchError
4949
aoti_torch_get_dim(Tensor* tensor, int64_t* ret_dim);
5050

51+
AOTI_SHIM_EXPORT AOTITorchError
52+
aoti_torch_get_numel(Tensor* tensor, int64_t* ret_numel);
53+
5154
AOTI_SHIM_EXPORT int32_t aoti_torch_layout_strided();
5255

5356
// ============================================================

0 commit comments

Comments
 (0)