Skip to content

Commit 3a58f35

Browse files
praguptapytorchmergebotFlamefireBoyuanFengguangyey
authored
[AUTOGENERATED] rocm7.1_internal_testing_IFU_2025-09-09 (#2625)
rocm_base: 1c57644 Tested this PR on MI300x using `registry-sc-harbor.amd.com/framework/compute-rocm-dkms-no-npi-hipclang:16623_ubuntu24.04_py3.12_pytorch_rocm7.1_internal_testing_681e60e1` Ran the following UTs: test_nn, test_torch, test_cuda, test_ops, test_unary_ufuncs, test_autograd, inductor/test_torchinductor All ran fine, attaching logs! [default_ut.log](https://github.com/user-attachments/files/22244687/default_ut.log) Successful wheel build job with this branch: http://rocm-ci.amd.com/view/preview/job/pytorch2.8-manylinux-wheels-preview/116/ --------- Signed-off-by: Edward Yang <[email protected]> Signed-off-by: Edward Z. Yang <[email protected]> Co-authored-by: PyTorch MergeBot <[email protected]> Co-authored-by: Alexander Grund <[email protected]> Co-authored-by: Boyuan Feng <[email protected]> Co-authored-by: Yu, Guangye <[email protected]> Co-authored-by: Lakshay Garg <[email protected]> Co-authored-by: Edward Yang <[email protected]> Co-authored-by: Oguz Ulgen <[email protected]> Co-authored-by: iupaikov-amd <[email protected]> Co-authored-by: Jithun Nair <[email protected]> Co-authored-by: Jack Taylor <[email protected]> Co-authored-by: Max Podkorytov <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Cui, Yifeng <[email protected]> Co-authored-by: William Wen <[email protected]> Co-authored-by: Frank Lin <[email protected]> Co-authored-by: Jeff Daily <[email protected]> Co-authored-by: Ke Wen <[email protected]> Co-authored-by: vasiliy <[email protected]> Co-authored-by: Animesh Jain <[email protected]> Co-authored-by: Albert W <[email protected]> Co-authored-by: eqy <[email protected]> Co-authored-by: mansiag05 <[email protected]> Co-authored-by: Aaron Gokaslan <[email protected]> Co-authored-by: dolpm <[email protected]> Co-authored-by: Ben Niu <[email protected]> Co-authored-by: Wang, Eikan <[email protected]> Co-authored-by: Brian Hirsh <[email protected]> Co-authored-by: Shangdi Yu <[email protected]> Co-authored-by: Pian Pawakapan <[email protected]> Co-authored-by: Yiming Zhou <[email protected]> Co-authored-by: Nan Zhang <[email protected]> Co-authored-by: xinan.lin <[email protected]> Co-authored-by: Nikita Shulga <[email protected]> Co-authored-by: angelayi <[email protected]> Co-authored-by: Jeffro <[email protected]> Co-authored-by: Haifeng Jin <[email protected]> Co-authored-by: Colin L Reliability Rice <[email protected]> Co-authored-by: Nick Riasanovsky <[email protected]> Co-authored-by: PyTorch UpdateBot <[email protected]> Co-authored-by: Zeng, Xiangdong <[email protected]> Co-authored-by: atalman <[email protected]> Co-authored-by: Ting Lu <[email protected]> Co-authored-by: Shunting Zhang <[email protected]> Co-authored-by: Saurabh Mishra <[email protected]> Co-authored-by: Xingyuan Li <[email protected]> Co-authored-by: Nikita Shulga <[email protected]> Co-authored-by: Mikayla Gawarecki <[email protected]> Co-authored-by: Ruben Rodriguez Buchillon <[email protected]> Co-authored-by: Scott Wolchok <[email protected]> Co-authored-by: Justin Chu <[email protected]> Co-authored-by: Xuehai Pan <[email protected]> Co-authored-by: henrylhtsang <[email protected]> Co-authored-by: Shunzhi Wen <[email protected]> Co-authored-by: rzou <[email protected]> Co-authored-by: Laith Sakka <[email protected]> Co-authored-by: Xuan Zhang <[email protected]> Co-authored-by: drisspg <[email protected]> Co-authored-by: Rob Timpe <[email protected]> Co-authored-by: Will Feng <[email protected]> Co-authored-by: Yang Wang <[email protected]> Co-authored-by: ruisizhang123 <[email protected]> Co-authored-by: Raman Kumar <[email protected]> Co-authored-by: Gabriel Ferns <[email protected]> Co-authored-by: Mario Šaško <[email protected]> Co-authored-by: Isuru Fernando <[email protected]> Co-authored-by: orangeH25 <[email protected]> Co-authored-by: morrison-turnansky <[email protected]> Co-authored-by: Codeboi007 <[email protected]> Co-authored-by: Blaine Burton Rister <[email protected]> Co-authored-by: Daniel Vega-Myhre <[email protected]> Co-authored-by: Deng, Daisy <[email protected]> Co-authored-by: Tugsbayasgalan Manlaibaatar <[email protected]> Co-authored-by: Yidi Wu <[email protected]> Co-authored-by: Huy Do <[email protected]> Co-authored-by: Vinayak Pawar <[email protected]> Co-authored-by: James Wu <[email protected]> Co-authored-by: Thomas Bohnstingl <[email protected]> Co-authored-by: David Berard <[email protected]> Co-authored-by: Chien-Chin Huang <[email protected]> Co-authored-by: IvanKobzarev <[email protected]> Co-authored-by: fengqing.lu <[email protected]> Co-authored-by: Benjamin Glass <[email protected]> Co-authored-by: Hao Wu <[email protected]> Co-authored-by: Avik Chaudhuri <[email protected]> Co-authored-by: Colin Peppler <[email protected]> Co-authored-by: Zhengxu Chen <[email protected]> Co-authored-by: karthickai <[email protected]> Co-authored-by: Kurt Mohler <[email protected]> Co-authored-by: Arsh Zahed <[email protected]> Co-authored-by: Sun, Jiayi <[email protected]> Co-authored-by: Jack Taylor <[email protected]> Co-authored-by: Isalia20 <[email protected]> Co-authored-by: Nikita Shulga <[email protected]> Co-authored-by: Mark Saroufim <[email protected]> Co-authored-by: Hashem Hashemi <[email protected]> Co-authored-by: Howard Huang <[email protected]> Co-authored-by: Jane Xu <[email protected]> Co-authored-by: jainapurva <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 1c57644 commit 3a58f35

File tree

2,197 files changed

+115116
-88755
lines changed

Some content is hidden

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

2,197 files changed

+115116
-88755
lines changed

.bc-linter.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 1
2+
paths:
3+
include:
4+
- "**/*.py"
5+
exclude:
6+
- ".*"
7+
- ".*/**"
8+
- "**/.*/**"
9+
- "**/.*"
10+
- "**/_*/**"
11+
- "**/_*.py"
12+
- "**/test/**"
13+
- "**/benchmarks/**"
14+
- "**/test_*.py"
15+
- "**/*_test.py"

.ci/aarch64_linux/aarch64_ci_build.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ set -eux -o pipefail
33

44
GPU_ARCH_VERSION=${GPU_ARCH_VERSION:-}
55

6-
if [[ "$GPU_ARCH_VERSION" == *"12.9"* ]]; then
7-
export TORCH_CUDA_ARCH_LIST="8.0;9.0;10.0;12.0"
6+
# Set CUDA architecture lists to match x86 build_cuda.sh
7+
if [[ "$GPU_ARCH_VERSION" == *"12.6"* ]]; then
8+
export TORCH_CUDA_ARCH_LIST="5.0;6.0;7.0;8.0;9.0"
9+
elif [[ "$GPU_ARCH_VERSION" == *"12.8"* ]]; then
10+
export TORCH_CUDA_ARCH_LIST="7.0;8.0;9.0;10.0;12.0"
11+
elif [[ "$GPU_ARCH_VERSION" == *"13.0"* ]]; then
12+
export TORCH_CUDA_ARCH_LIST="8.0;9.0;10.0;11.0;12.0+PTX"
13+
fi
14+
15+
# Compress the fatbin with -compress-mode=size for CUDA 13
16+
if [[ "$DESIRED_CUDA" == *"13"* ]]; then
17+
export TORCH_NVCC_FLAGS="-compress-mode=size"
818
fi
919

1020
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
@@ -18,14 +28,27 @@ cd /
1828
# on the mounted pytorch repo
1929
git config --global --add safe.directory /pytorch
2030
pip install -r /pytorch/requirements.txt
21-
pip install auditwheel==6.2.0
31+
pip install auditwheel==6.2.0 wheel
2232
if [ "$DESIRED_CUDA" = "cpu" ]; then
2333
echo "BASE_CUDA_VERSION is not set. Building cpu wheel."
2434
#USE_PRIORITIZED_TEXT_FOR_LD for enable linker script optimization https://github.com/pytorch/pytorch/pull/121975/files
2535
USE_PRIORITIZED_TEXT_FOR_LD=1 python /pytorch/.ci/aarch64_linux/aarch64_wheel_ci_build.py --enable-mkldnn
2636
else
2737
echo "BASE_CUDA_VERSION is set to: $DESIRED_CUDA"
2838
export USE_SYSTEM_NCCL=1
39+
40+
# Check if we should use NVIDIA libs from PyPI (similar to x86 build_cuda.sh logic)
41+
if [[ -z "$PYTORCH_EXTRA_INSTALL_REQUIREMENTS" ]]; then
42+
echo "Bundling CUDA libraries with wheel for aarch64."
43+
else
44+
echo "Using nvidia libs from pypi for aarch64."
45+
# Fix platform constraints in PYTORCH_EXTRA_INSTALL_REQUIREMENTS for aarch64
46+
# Replace 'platform_machine == "x86_64"' with 'platform_machine == "aarch64"'
47+
export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${PYTORCH_EXTRA_INSTALL_REQUIREMENTS//platform_machine == \'x86_64\'/platform_machine == \'aarch64\'}"
48+
echo "Updated PYTORCH_EXTRA_INSTALL_REQUIREMENTS for aarch64: $PYTORCH_EXTRA_INSTALL_REQUIREMENTS"
49+
export USE_NVIDIA_PYPI_LIBS=1
50+
fi
51+
2952
#USE_PRIORITIZED_TEXT_FOR_LD for enable linker script optimization https://github.com/pytorch/pytorch/pull/121975/files
3053
USE_PRIORITIZED_TEXT_FOR_LD=1 python /pytorch/.ci/aarch64_linux/aarch64_wheel_ci_build.py --enable-mkldnn --enable-cuda
3154
fi

.ci/aarch64_linux/aarch64_wheel_ci_build.py

Lines changed: 176 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -69,76 +69,190 @@ def replace_tag(filename) -> None:
6969
f.writelines(lines)
7070

7171

72+
def patch_library_rpath(
73+
folder: str,
74+
lib_name: str,
75+
use_nvidia_pypi_libs: bool = False,
76+
desired_cuda: str = "",
77+
) -> None:
78+
"""Apply patchelf to set RPATH for a library in torch/lib"""
79+
lib_path = f"{folder}/tmp/torch/lib/{lib_name}"
80+
81+
if use_nvidia_pypi_libs:
82+
# For PyPI NVIDIA libraries, construct CUDA RPATH
83+
cuda_rpaths = [
84+
"$ORIGIN/../../nvidia/cudnn/lib",
85+
"$ORIGIN/../../nvidia/nvshmem/lib",
86+
"$ORIGIN/../../nvidia/nccl/lib",
87+
"$ORIGIN/../../nvidia/cusparselt/lib",
88+
]
89+
90+
if "130" in desired_cuda:
91+
cuda_rpaths.append("$ORIGIN/../../nvidia/cu13/lib")
92+
else:
93+
cuda_rpaths.extend(
94+
[
95+
"$ORIGIN/../../nvidia/cublas/lib",
96+
"$ORIGIN/../../nvidia/cuda_cupti/lib",
97+
"$ORIGIN/../../nvidia/cuda_nvrtc/lib",
98+
"$ORIGIN/../../nvidia/cuda_runtime/lib",
99+
"$ORIGIN/../../nvidia/cufft/lib",
100+
"$ORIGIN/../../nvidia/curand/lib",
101+
"$ORIGIN/../../nvidia/cusolver/lib",
102+
"$ORIGIN/../../nvidia/cusparse/lib",
103+
"$ORIGIN/../../nvidia/nvtx/lib",
104+
"$ORIGIN/../../nvidia/cufile/lib",
105+
]
106+
)
107+
108+
# Add $ORIGIN for local torch libs
109+
rpath = ":".join(cuda_rpaths) + ":$ORIGIN"
110+
else:
111+
# For bundled libraries, just use $ORIGIN
112+
rpath = "$ORIGIN"
113+
114+
if os.path.exists(lib_path):
115+
os.system(
116+
f"cd {folder}/tmp/torch/lib/; "
117+
f"patchelf --set-rpath '{rpath}' --force-rpath {lib_name}"
118+
)
119+
120+
121+
def copy_and_patch_library(
122+
src_path: str,
123+
folder: str,
124+
use_nvidia_pypi_libs: bool = False,
125+
desired_cuda: str = "",
126+
) -> None:
127+
"""Copy a library to torch/lib and patch its RPATH"""
128+
if os.path.exists(src_path):
129+
lib_name = os.path.basename(src_path)
130+
shutil.copy2(src_path, f"{folder}/tmp/torch/lib/{lib_name}")
131+
patch_library_rpath(folder, lib_name, use_nvidia_pypi_libs, desired_cuda)
132+
133+
72134
def package_cuda_wheel(wheel_path, desired_cuda) -> None:
73135
"""
74136
Package the cuda wheel libraries
75137
"""
76138
folder = os.path.dirname(wheel_path)
77-
wheelname = os.path.basename(wheel_path)
78139
os.mkdir(f"{folder}/tmp")
79140
os.system(f"unzip {wheel_path} -d {folder}/tmp")
80-
libs_to_copy = [
81-
"/usr/local/cuda/extras/CUPTI/lib64/libcupti.so.12",
82-
"/usr/local/cuda/extras/CUPTI/lib64/libnvperf_host.so",
83-
"/usr/local/cuda/lib64/libcudnn.so.9",
84-
"/usr/local/cuda/lib64/libcublas.so.12",
85-
"/usr/local/cuda/lib64/libcublasLt.so.12",
86-
"/usr/local/cuda/lib64/libcudart.so.12",
87-
"/usr/local/cuda/lib64/libcufft.so.11",
88-
"/usr/local/cuda/lib64/libcusparse.so.12",
89-
"/usr/local/cuda/lib64/libcusparseLt.so.0",
90-
"/usr/local/cuda/lib64/libcusolver.so.11",
91-
"/usr/local/cuda/lib64/libcurand.so.10",
92-
"/usr/local/cuda/lib64/libnccl.so.2",
93-
"/usr/local/cuda/lib64/libnvJitLink.so.12",
94-
"/usr/local/cuda/lib64/libnvrtc.so.12",
95-
"/usr/local/cuda/lib64/libcudnn_adv.so.9",
96-
"/usr/local/cuda/lib64/libcudnn_cnn.so.9",
97-
"/usr/local/cuda/lib64/libcudnn_graph.so.9",
98-
"/usr/local/cuda/lib64/libcudnn_ops.so.9",
99-
"/usr/local/cuda/lib64/libcudnn_engines_runtime_compiled.so.9",
100-
"/usr/local/cuda/lib64/libcudnn_engines_precompiled.so.9",
101-
"/usr/local/cuda/lib64/libcudnn_heuristic.so.9",
102-
"/lib64/libgomp.so.1",
103-
"/usr/lib64/libgfortran.so.5",
104-
"/acl/build/libarm_compute.so",
105-
"/acl/build/libarm_compute_graph.so",
106-
"/usr/local/lib/libnvpl_lapack_lp64_gomp.so.0",
107-
"/usr/local/lib/libnvpl_blas_lp64_gomp.so.0",
108-
"/usr/local/lib/libnvpl_lapack_core.so.0",
109-
"/usr/local/lib/libnvpl_blas_core.so.0",
110-
]
111141

112-
if "129" in desired_cuda:
113-
libs_to_copy += [
114-
"/usr/local/cuda/lib64/libnvrtc-builtins.so.12.9",
142+
# Check if we should use PyPI NVIDIA libraries or bundle system libraries
143+
use_nvidia_pypi_libs = os.getenv("USE_NVIDIA_PYPI_LIBS", "0") == "1"
144+
145+
if use_nvidia_pypi_libs:
146+
print("Using nvidia libs from pypi - skipping CUDA library bundling")
147+
# For PyPI approach, we don't bundle CUDA libraries - they come from PyPI packages
148+
# We only need to bundle non-NVIDIA libraries
149+
minimal_libs_to_copy = [
150+
"/lib64/libgomp.so.1",
151+
"/usr/lib64/libgfortran.so.5",
152+
"/acl/build/libarm_compute.so",
153+
"/acl/build/libarm_compute_graph.so",
154+
"/usr/local/lib/libnvpl_lapack_lp64_gomp.so.0",
155+
"/usr/local/lib/libnvpl_blas_lp64_gomp.so.0",
156+
"/usr/local/lib/libnvpl_lapack_core.so.0",
157+
"/usr/local/lib/libnvpl_blas_core.so.0",
158+
]
159+
160+
# Copy minimal libraries to unzipped_folder/torch/lib
161+
for lib_path in minimal_libs_to_copy:
162+
copy_and_patch_library(lib_path, folder, use_nvidia_pypi_libs, desired_cuda)
163+
164+
# Patch torch libraries used for searching libraries
165+
torch_libs_to_patch = [
166+
"libtorch.so",
167+
"libtorch_cpu.so",
168+
"libtorch_cuda.so",
169+
"libtorch_cuda_linalg.so",
170+
"libtorch_global_deps.so",
171+
"libtorch_python.so",
172+
"libtorch_nvshmem.so",
173+
"libc10.so",
174+
"libc10_cuda.so",
175+
"libcaffe2_nvrtc.so",
176+
"libshm.so",
177+
]
178+
for lib_name in torch_libs_to_patch:
179+
patch_library_rpath(folder, lib_name, use_nvidia_pypi_libs, desired_cuda)
180+
else:
181+
print("Bundling CUDA libraries with wheel")
182+
# Original logic for bundling system CUDA libraries
183+
# Common libraries for all CUDA versions
184+
common_libs = [
185+
# Non-NVIDIA system libraries
186+
"/lib64/libgomp.so.1",
187+
"/usr/lib64/libgfortran.so.5",
188+
"/acl/build/libarm_compute.so",
189+
"/acl/build/libarm_compute_graph.so",
190+
# Common CUDA libraries (same for all versions)
191+
"/usr/local/lib/libnvpl_lapack_lp64_gomp.so.0",
192+
"/usr/local/lib/libnvpl_blas_lp64_gomp.so.0",
193+
"/usr/local/lib/libnvpl_lapack_core.so.0",
194+
"/usr/local/lib/libnvpl_blas_core.so.0",
195+
"/usr/local/cuda/extras/CUPTI/lib64/libnvperf_host.so",
196+
"/usr/local/cuda/lib64/libcudnn.so.9",
197+
"/usr/local/cuda/lib64/libcusparseLt.so.0",
198+
"/usr/local/cuda/lib64/libcurand.so.10",
199+
"/usr/local/cuda/lib64/libnccl.so.2",
200+
"/usr/local/cuda/lib64/libnvshmem_host.so.3",
201+
"/usr/local/cuda/lib64/libcudnn_adv.so.9",
202+
"/usr/local/cuda/lib64/libcudnn_cnn.so.9",
203+
"/usr/local/cuda/lib64/libcudnn_graph.so.9",
204+
"/usr/local/cuda/lib64/libcudnn_ops.so.9",
205+
"/usr/local/cuda/lib64/libcudnn_engines_runtime_compiled.so.9",
206+
"/usr/local/cuda/lib64/libcudnn_engines_precompiled.so.9",
207+
"/usr/local/cuda/lib64/libcudnn_heuristic.so.9",
115208
"/usr/local/cuda/lib64/libcufile.so.0",
116209
"/usr/local/cuda/lib64/libcufile_rdma.so.1",
210+
"/usr/local/cuda/lib64/libcusparse.so.12",
117211
]
118212

119-
# Copy libraries to unzipped_folder/a/lib
120-
for lib_path in libs_to_copy:
121-
lib_name = os.path.basename(lib_path)
122-
shutil.copy2(lib_path, f"{folder}/tmp/torch/lib/{lib_name}")
123-
os.system(
124-
f"cd {folder}/tmp/torch/lib/; "
125-
f"patchelf --set-rpath '$ORIGIN' --force-rpath {folder}/tmp/torch/lib/{lib_name}"
126-
)
213+
# CUDA version-specific libraries
214+
if "130" in desired_cuda:
215+
version_specific_libs = [
216+
"/usr/local/cuda/extras/CUPTI/lib64/libcupti.so.13",
217+
"/usr/local/cuda/lib64/libcublas.so.13",
218+
"/usr/local/cuda/lib64/libcublasLt.so.13",
219+
"/usr/local/cuda/lib64/libcudart.so.13",
220+
"/usr/local/cuda/lib64/libcufft.so.12",
221+
"/usr/local/cuda/lib64/libcusolver.so.12",
222+
"/usr/local/cuda/lib64/libnvJitLink.so.13",
223+
"/usr/local/cuda/lib64/libnvrtc.so.13",
224+
"/usr/local/cuda/lib64/libnvrtc-builtins.so.13.0",
225+
]
226+
elif "12" in desired_cuda:
227+
# Get the last character for libnvrtc-builtins version (e.g., "129" -> "9")
228+
minor_version = desired_cuda[-1]
229+
version_specific_libs = [
230+
"/usr/local/cuda/extras/CUPTI/lib64/libcupti.so.12",
231+
"/usr/local/cuda/lib64/libcublas.so.12",
232+
"/usr/local/cuda/lib64/libcublasLt.so.12",
233+
"/usr/local/cuda/lib64/libcudart.so.12",
234+
"/usr/local/cuda/lib64/libcufft.so.11",
235+
"/usr/local/cuda/lib64/libcusolver.so.11",
236+
"/usr/local/cuda/lib64/libnvJitLink.so.12",
237+
"/usr/local/cuda/lib64/libnvrtc.so.12",
238+
f"/usr/local/cuda/lib64/libnvrtc-builtins.so.12.{minor_version}",
239+
]
240+
241+
# Combine all libraries
242+
libs_to_copy = common_libs + version_specific_libs
243+
244+
# Copy libraries to unzipped_folder/torch/lib
245+
for lib_path in libs_to_copy:
246+
copy_and_patch_library(lib_path, folder, use_nvidia_pypi_libs, desired_cuda)
127247

128248
# Make sure the wheel is tagged with manylinux_2_28
129249
for f in os.scandir(f"{folder}/tmp/"):
130250
if f.is_dir() and f.name.endswith(".dist-info"):
131251
replace_tag(f"{f.path}/WHEEL")
132252
break
133253

134-
os.mkdir(f"{folder}/cuda_wheel")
135-
os.system(f"cd {folder}/tmp/; zip -r {folder}/cuda_wheel/{wheelname} *")
136-
shutil.move(
137-
f"{folder}/cuda_wheel/{wheelname}",
138-
f"{folder}/{wheelname}",
139-
copy_function=shutil.copy2,
140-
)
141-
os.system(f"rm -rf {folder}/tmp/ {folder}/cuda_wheel/")
254+
os.system(f"wheel pack {folder}/tmp/ -d {folder}")
255+
os.system(f"rm -rf {folder}/tmp/")
142256

143257

144258
def complete_wheel(folder: str) -> str:
@@ -208,7 +322,17 @@ def parse_arguments():
208322
build_vars = "CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000 "
209323
# MAX_JOB=5 is not required for CPU backend (see commit 465d98b)
210324
if enable_cuda:
211-
build_vars = "MAX_JOBS=5 " + build_vars
325+
build_vars += "MAX_JOBS=5 "
326+
327+
# Handle PyPI NVIDIA libraries vs bundled libraries
328+
use_nvidia_pypi_libs = os.getenv("USE_NVIDIA_PYPI_LIBS", "0") == "1"
329+
if use_nvidia_pypi_libs:
330+
print("Configuring build for PyPI NVIDIA libraries")
331+
# Configure for dynamic linking (matching x86 logic)
332+
build_vars += "ATEN_STATIC_CUDA=0 USE_CUDA_STATIC_LINK=0 USE_CUPTI_SO=1 "
333+
else:
334+
print("Configuring build for bundled NVIDIA libraries")
335+
# Keep existing static linking approach - already configured above
212336

213337
override_package_version = os.getenv("OVERRIDE_PACKAGE_VERSION")
214338
desired_cuda = os.getenv("DESIRED_CUDA")

.ci/aarch64_linux/build_aarch64_wheel.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ def build_torchvision(
438438
)
439439
build_vars += f"BUILD_VERSION={version}.dev{build_date}"
440440
elif build_version is not None:
441-
build_vars += (
442-
f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-')[0]}"
443-
)
441+
build_vars += f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-', maxsplit=1)[0]}"
444442
if host.using_docker():
445443
build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
446444

@@ -495,9 +493,7 @@ def build_torchdata(
495493
)
496494
build_vars += f"BUILD_VERSION={version}.dev{build_date}"
497495
elif build_version is not None:
498-
build_vars += (
499-
f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-')[0]}"
500-
)
496+
build_vars += f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-', maxsplit=1)[0]}"
501497
if host.using_docker():
502498
build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
503499

@@ -553,9 +549,7 @@ def build_torchtext(
553549
)
554550
build_vars += f"BUILD_VERSION={version}.dev{build_date}"
555551
elif build_version is not None:
556-
build_vars += (
557-
f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-')[0]}"
558-
)
552+
build_vars += f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-', maxsplit=1)[0]}"
559553
if host.using_docker():
560554
build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
561555

@@ -613,9 +607,7 @@ def build_torchaudio(
613607
)
614608
build_vars += f"BUILD_VERSION={version}.dev{build_date}"
615609
elif build_version is not None:
616-
build_vars += (
617-
f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-')[0]}"
618-
)
610+
build_vars += f"BUILD_VERSION={build_version} PYTORCH_VERSION={branch[1:].split('-', maxsplit=1)[0]}"
619611
if host.using_docker():
620612
build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
621613

.ci/docker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ If your new Docker image needs a library installed from a specific pinned commit
120120
If you're introducing a new argument to the Docker build, make sure to add it in the Docker build step in `.ci/docker/build.sh`:
121121
```bash
122122
docker build \
123-
....
124-
--build-arg "NEW_ARG_1=${NEW_ARG_1}"
123+
....
124+
--build-arg "NEW_ARG_1=${NEW_ARG_1}"
125125
```
126126

127127
3. **Update Dockerfile logic**:

0 commit comments

Comments
 (0)