8000 Update · pytorch/pytorch@ac9ed89 · GitHub
[go: up one dir, main page]

Skip to content

Commit ac9ed89

Browse files
committed
Update
[ghstack-poisoned]
2 parents ab7e481 + 08fe9f7 commit ac9ed89

File tree

288 files changed

+6848
-3121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+6848
-3121
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a325c56864c5b25630c1ebda03c8f16a96a02a19
1+
b173722085b3f555d6ba4533d6bbaddfd7c71144
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.26.2-1
1+
v2.26.5-1

.ci/docker/common/install_executorch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ clone_executorch() {
1313
# and fetch the target commit
1414
pushd executorch
1515
git checkout "${EXECUTORCH_PINNED_COMMIT}"
16-
git submodule update --init
16+
git submodule update --init --recursive
1717
popd
1818

1919
chown -R jenkins executorch

.ci/manywheel/build_common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/torch*linux*.w
321321
# ROCm workaround for roctracer dlopens
322322
if [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
323323
patchedpath=$(fname_without_so_number $destpath)
324-
# Keep the so number for XPU dependencies
325-
elif [[ "$DESIRED_CUDA" == *"xpu"* ]]; then
324+
# Keep the so number for XPU dependencies and libgomp.so.1 to avoid twice load
325+
elif [[ "$DESIRED_CUDA" == *"xpu"* || "$filename" == "libgomp.so.1" ]]; then
326326
patchedpath=$destpath
327327
else
328328
patchedpath=$(fname_with_sha256 $destpath)

.ci/pytorch/macos-test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ test_torchbench_smoketest() {
247247
PYTHONPATH="$(pwd)"/torchbench python benchmarks/dynamo/torchbench.py \
248248
--performance --only "$model" --backend "$backend" --inference --devices "$device" "$dtype_arg" \
249249
--output "$TEST_REPORTS_DIR/inductor_${backend}_torchbench_${dtype}_inference_${device}_performance.csv" || true
250+
if [ "$backend" == "inductor" ]; then
251+
PYTHONPATH="$(pwd)"/torchbench python benchmarks/dynamo/torchbench.py \
252+
--accuracy --only "$model" --backend "$backend" --inference --devices "$device" "$dtype_arg" \
253+
--output "$TEST_REPORTS_DIR/inductor_${backend}_torchbench_${dtype}_inference_${device}_accuracy.csv" || true
254+
fi
250255
done
251256
done
252257

.ci/pytorch/smoke_test/check_gomp.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import ctypes
2+
import os
3+
import sys
4+
from pathlib import Path
5+
6+
7+
def get_gomp_thread():
8+
"""
9+
Retrieves the maximum number of OpenMP threads after loading the `libgomp.so.1` library
10+
and the `libtorch_cpu.so` library. It then queries the
11+
maximum number of threads available for OpenMP parallel regions using the
12+
`omp_get_max_threads` function.
13+
14+
Returns:
15+
int: The maximum number of OpenMP threads available.
16+
17+
Notes:
18+
- The function assumes the default path for `libgomp.so.1` on AlmaLinux OS.
19+
- The path to `libtorch_cpu.so` is constructed based on the Python executable's
20+
installation directory.
21+
- This function is specific to environments where PyTorch and OpenMP are used
22+
together and may require adjustments for other setups.
23+
"""
24+
python_path = Path(sys.executable).resolve()
25+
python_prefix = (
26+
python_path.parent.parent
27+
) # Typically goes to the Python installation root
28+
29+
# Get the additional ABI flags (if any); it may be an empty string.
30+
abiflags = getattr(sys, "abiflags", "")
31+
32+
# Construct the Python directory name correctly (e.g., "python3.13t").
33+
python_version = (
34+
f"python{sys.version_info.major}.{sys.version_info.minor}{abiflags}"
35+
)
36+
37+
libtorch_cpu_path = (
38+
python_prefix
39+
/ "lib"
40+
/ python_version
41+
/ "site-packages"
42+
/ "torch"
43+
/ "lib"
44+
/ "libtorch_cpu.so"
45+
)
46+
47+
# use the default gomp path of AlmaLinux OS
48+
libgomp_path = "/usr/lib64/libgomp.so.1"
49+
50+
os.environ["GOMP_CPU_AFFINITY"] = "0-3"
51+
52+
libgomp = ctypes.CDLL(libgomp_path)
53+
libgomp = ctypes.CDLL(libtorch_cpu_path)
54+
55+
libgomp.omp_get_max_threads.restype = ctypes.c_int
56+
libgomp.omp_get_max_threads.argtypes = []
57+
58+
omp_max_threads = libgomp.omp_get_max_threads()
59+
return omp_max_threads
60+
61+
62+
def main():
63+
omp_max_threads = get_gomp_thread()
64+
print(
65+
f"omp_max_threads after loading libgomp.so and libtorch_cpu.so: {omp_max_threads}"
66+
)
67+
if omp_max_threads == 1:
68+
raise RuntimeError(
69+
"omp_max_threads is 1. Check whether libgomp.so is loaded twice."
70+
)
71+
72+
73+
if __name__ == "__main__":
74+
main()

.ci/pytorch/test.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,15 @@ test_inductor_aoti() {
408408
# We need to hipify before building again
409409
python3 tools/amd_build/build_amd.py
410410
fi
411-
BUILD_AOT_INDUCTOR_TEST=1 python setup.py develop
412-
CPP_TESTS_DIR="${BUILD_BIN_DIR}" LD_LIBRARY_PATH="${TORCH_LIB_DIR}" python test/run_test.py --cpp --verbose -i cpp/test_aoti_abi_check cpp/test_aoti_inference
411+
if [[ "$BUILD_ENVIRONMENT" == *sm86* ]]; then
412+
BUILD_AOT_INDUCTOR_TEST=1 TORCH_CUDA_ARCH_LIST=8.6 USE_FLASH_ATTENTION=OFF python setup.py develop
413+
# TODO: Replace me completely, as one should not use conda libstdc++, nor need special path to TORCH_LIB
414+
LD_LIBRARY_PATH=/opt/conda/envs/py_3.10/lib/:${TORCH_LIB_DIR}:$LD_LIBRARY_PATH
415+
CPP_TESTS_DIR="${BUILD_BIN_DIR}" python test/run_test.py --cpp --verbose -i cpp/test_aoti_abi_check cpp/test_aoti_inference
416+
else
417+
BUILD_AOT_INDUCTOR_TEST=1 python setup.py develop
418+
CPP_TESTS_DIR="${BUILD_BIN_DIR}" LD_LIBRARY_PATH="${TORCH_LIB_DIR}" python test/run_test.py --cpp --verbose -i cpp/test_aoti_abi_check cpp/test_aoti_inference
419+
fi
413420
}
414421

415422
test_inductor_cpp_wrapper_shard() {
@@ -1486,8 +1493,6 @@ test_executorch() {
14861493
export PYTHON_EXECUTABLE=python
14871494
export CMAKE_ARGS="-DEXECUTORCH_BUILD_PYBIND=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON"
14881495

1489-
# For llama3
1490-
bash examples/models/llama3_2_vision/install_requirements.sh
14911496
# NB: We need to rebuild ExecuTorch runner here because it depends on PyTorch
14921497
# from the PR
14931498
bash .ci/scripts/setup-linux.sh --build-tool cmake

.ci/pytorch/windows/internal/smoke_test.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ goto end
9999
:libtorch
100100
echo "install and test libtorch"
101101

102+
if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1
102103
if "%VC_YEAR%" == "2022" powershell internal\vs2022_install.ps1
103104

104105
if ERRORLEVEL 1 exit /b 1
@@ -110,6 +111,10 @@ pushd tmp\libtorch
110111

111112
set VC_VERSION_LOWER=17
112113
set VC_VERSION_UPPER=18
114+
IF "%VC_YEAR%" == "2019" (
115+
set VC_VERSION_LOWER=16
116+
set VC_VERSION_UPPER=17
117+
)
113118

114119
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
115120
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
set SRC_DIR=%~dp0
2+
3+
pushd %SRC_DIR%\..
4+
5+
if "%CUDA_VERSION%" == "cpu" call internal\driver_update.bat
6+
if errorlevel 1 exit /b 1
7+
8+
call internal\cuda_install.bat
9+
set LIB=%CUDA_PATH%\lib\x64;%LIB%
10+
if errorlevel 1 exit /b 1
11+
set "ORIG_PATH=%PATH%"
12+
13+
setlocal EnableDelayedExpansion
14+
set NVIDIA_GPU_EXISTS=0
15+
for /F "delims=" %%i in ('wmic path win32_VideoController get name') do (
16+
set GPUS=%%i
17+
if not "x!GPUS:NVIDIA=!" == "x!GPUS!" (
18+
SET NVIDIA_GPU_EXISTS=1
19+
goto gpu_check_end
20+
)
21+
)
22+
:gpu_check_end
23+
endlocal & set NVIDIA_GPU_EXISTS=%NVIDIA_GPU_EXISTS%
24+
25+
:: Download MAGMA Files on CUDA builds
26+
set MAGMA_VERSION=2.5.4
27+
set CUDA_PREFIX=cuda%CUDA_VERSION%
28+
if "%CUDA_VERSION%" == "92" set MAGMA_VERSION=2.5.2
29+
if "%CUDA_VERSION%" == "100" set MAGMA_VERSION=2.5.2
30+
31+
if "%DEBUG%" == "1" (
32+
set BUILD_TYPE=debug
33+
) else (
34+
set BUILD_TYPE=release
35+
)
36+
37+
if not "%CUDA_VERSION%" == "cpu" (
38+
rmdir /s /q magma_%CUDA_PREFIX%_%BUILD_TYPE%
39+
del magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z
40+
curl -k https://s3.amazonaws.com/ossci-windows/magma_%MAGMA_VERSION%_%CUDA_PREFIX%_%BUILD_TYPE%.7z -o magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z
41+
7z x -aoa magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z -omagma_%CUDA_PREFIX%_%BUILD_TYPE%
42+
set LIB=%CD%\magma_%CUDA_PREFIX%_%BUILD_TYPE%\lib;%LIB%
43+
)
44+
45+
echo "install conda package"
46+
47+
:: Install Miniconda3
48+
set "CONDA_HOME=%CD%\conda"
49+
set "tmp_conda=%CONDA_HOME%"
50+
set "miniconda_exe=%CD%\miniconda.exe"
51+
52+
rmdir /s /q conda
53+
del miniconda.exe
54+
curl -k https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o "%miniconda_exe%"
55+
start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda%
56+
if ERRORLEVEL 1 exit /b 1
57+
58+
set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"
59+
60+
conda create -qyn testenv python=%DESIRED_PYTHON%
61+
if errorlevel 1 exit /b 1
62+
63+
call %CONDA_HOME%\condabin\activate.bat testenv
64+
if errorlevel 1 exit /b 1
65+
66+
call conda install -y -q -c conda-forge libuv=1.39
67+
call conda install -y -q intel-openmp
68+
69+
echo "install and test libtorch"
70+
pip install cmake
71+
echo "installing cmake"
72+
73+
if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1
74+
if "%VC_YEAR%" == "2022" powershell internal\vs2022_install.ps1
75+
76+
if ERRORLEVEL 1 exit /b 1
77+
78+
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do 7z x "%%i" -otmp
79+
if ERRORLEVEL 1 exit /b 1
80+
81+
82+
pushd tmp\libtorch
83+
84+
set VC_VERSION_LOWER=17
85+
set VC_VERSION_UPPER=18
86+
IF "%VC_YEAR%" == "2019" (
87+
set VC_VERSION_LOWER=16
88+
set VC_VERSION_UPPER=17
89+
)
90+
91+
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
92+
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
93+
set "VS15INSTALLDIR=%%i"
94+
set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat"
95+
goto vswhere
96+
)
97+
)
98+
99+
:vswhere
100+
IF "%VS15VCVARSALL%"=="" (
101+
echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch test on Windows
102+
exit /b 1
103+
)
104+
call "%VS15VCVARSALL%" x64
105+
106+
set install_root=%CD%
107+
set INCLUDE=%INCLUDE%;%install_root%\include;%install_root%\include\torch\csrc\api\include
108+
set LIB=%LIB%;%install_root%\lib\x64
109+
set PATH=%PATH%;%install_root%\lib
110+
111+
112+
cd %PYTORCH_ROOT%\.ci\pytorch\test_example_code\
113+
mkdir build
114+
cd build
115+
116+
cmake -DCMAKE_PREFIX_PATH=%install_root% ..
117+
118+
if ERRORLEVEL 1 exit /b 1
119+
120+
cmake --build . --config Release
121+
122+
.\Release\simple-torch-test.exe
123+
if ERRORLEVEL 1 exit /b 1
124+
125+
popd
126+
127+
echo Cleaning temp files
128+
rd /s /q "tmp" || ver > nul
129+
130+
:end
131+
set "PATH=%ORIG_PATH%"
132+
popd

.ci/pytorch/windows/internal/vc_install_helper.bat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
if "%VC_YEAR%" == "2019" powershell windows/internal/vs2019_install.ps1
12
if "%VC_YEAR%" == "2022" powershell windows/internal/vs2022_install.ps1
23

34
set VC_VERSION_LOWER=17
45
set VC_VERSION_UPPER=18
5-
6+
if "%VC_YEAR%" == "2019" (
7+
set VC_VERSION_LOWER=16
8+
set VC_VERSION_UPPER=17
9+
)
610

711
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
812
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# https://developercommunity.visualstudio.com/t/install-specific-version-of-vs-component/1142479
2+
# https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#release-dates-and-build-numbers
3+
4+
# 16.8.6 BuildTools
5+
$VS_DOWNLOAD_LINK = "https://ossci-windows.s3.us-east-1.amazonaws.com/vs16.8.6_BuildTools.exe"
6+
$COLLECT_DOWNLOAD_LINK = "https://aka.ms/vscollect.exe"
7+
$VS_INSTALL_ARGS = @("--nocache","--quiet","--wait", "--add Microsoft.VisualStudio.Workload.VCTools",
8+
"--add Microsoft.Component.MSBuild",
9+
"--add Microsoft.VisualStudio.Component.Roslyn.Compiler",
10+
"--add Microsoft.VisualStudio.Component.TextTemplating",
11+
"--add Microsoft.VisualStudio.Component.VC.CoreIde",
12+
"--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
13+
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
14+
"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
15+
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81")
16+
17+
curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe
18+
if ($LASTEXITCODE -ne 0) {
19+
echo "Download of the VS 2019 Version 16.8.5 installer failed"
20+
exit 1
21+
}
22+
23+
if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") {
24+
$existingPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products "Microsoft.VisualStudio.Product.BuildTools" -version "[16, 17)" -property installationPath
25+
if ($existingPath -ne $null) {
26+
if (!${env:CIRCLECI}) {
27+
echo "Found correctly versioned existing BuildTools installation in $existingPath"
28+
exit 0
29+
}
30+
echo "Found existing BuildTools installation in $existingPath, keeping it"
31+
}
32+
}
33+
34+
$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru
35+
Remove-Item -Path vs_installer.exe -Force
36+
$exitCode = $process.ExitCode
37+
if (($exitCode -ne 0) -and ($exitCode -ne 3010)) {
38+
echo "VS 2019 installer exited with code $exitCode, which should be one of [0, 3010]."
39+
curl.exe --retry 3 -kL $COLLECT_DOWNLOAD_LINK --output Collect.exe
40+
if ($LASTEXITCODE -ne 0) {
41+
echo "Download of the VS Collect tool failed."
42+
exit 1
43+
}
44+
Start-Process "${PWD}\Collect.exe" -NoNewWindow -Wait -PassThru
45+
New-Item -Path "C:\w\build-results" -ItemType "directory" -Force
46+
Copy-Item -Path "C:\Users\${env:USERNAME}\AppData\Local\Temp\vslogs.zip" -Destination "C:\w\build-results\"
47+
exit 1
48+
}

.circleci/scripts/binary_linux_test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ if [[ "\$GPU_ARCH_TYPE" != *s390x* && "\$GPU_ARCH_TYPE" != *xpu* && "\$GPU_ARCH_
101101
else
102102
python /pytorch/.ci/pytorch/smoke_test/smoke_test.py --package=torchonly --torch-compile-check disabled $extra_parameters
103103
fi
104+
105+
if [[ "\$GPU_ARCH_TYPE" != *cpu-aarch64* ]]; then
106+
# https://github.com/pytorch/pytorch/issues/149422
107+
python /pytorch/.ci/pytorch/smoke_test/check_gomp.py
108+
fi
104109
fi
105110
106111
# Clean temp files

.circleci/scripts/binary_windows_build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ if [[ "$OS" != "windows-arm64" ]]; then
99
export USE_SCCACHE=1
1010
export SCCACHE_BUCKET=ossci-compiler-cache
1111
export SCCACHE_IGNORE_SERVER_IO_ERROR=1
12-
export VC_YEAR=2022
12+
export VC_YEAR=2019
1313
fi
1414

1515
if [[ "$DESIRED_CUDA" == 'xpu' ]]; then
16+
export VC_YEAR=2022
1617
export USE_SCCACHE=0
1718
export XPU_VERSION=2025.0
1819
export XPU_ENABLE_KINETO=1

.circleci/scripts/binary_windows_test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ set -eux -o pipefail
44
source "${BINARY_ENV_FILE:-/c/w/env}"
55

66
export CUDA_VERSION="${DESIRED_CUDA/cu/}"
7-
export VC_YEAR=2022
7+
export VC_YEAR=2019
88

99
if [[ "$DESIRED_CUDA" == 'xpu' ]]; then
10+
export VC_YEAR=2022
1011
export XPU_VERSION=2025.0
1112
fi
1213

0 commit comments

Comments
 (0)
0