Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d91269e
Revert "[ROCm] enable fastSpecializedAtomicAdd for gfx950 (#167661)"
pytorchmergebot Nov 18, 2025
57927a6
[Profiler] Deprecate export_memory_timeline method (#168036)
sraikund16 Nov 18, 2025
20cae80
`ComplexTensor` subclass (#167621)
hameerabbasi Nov 18, 2025
0e13964
[CI] Disable ET tests (again) (#168090)
malfet Nov 18, 2025
5333e51
[CUDA][Thor] Enable CUTLASS matmuls on Thor (#164836)
Aidyn-A Nov 18, 2025
d1f6dd6
distributed/debug: add an HTTP server for debugging running jobs (#16…
d4l3k Nov 18, 2025
aa22d41
[refcycle-logger] Output tensor size in the refcycle visualization (#…
czardoz Nov 18, 2025
14f370f
[xpu][test] port some distributed tensor test files for Intel GPU (#1…
wincent8 Nov 18, 2025
e3c5b78
small changes (#167852)
eellison Nov 18, 2025
4c5042b
Fix all gather bucketing fusion in of dtype casts (#167853)
eellison Nov 18, 2025
dda2cb3
Handled erased hiding nodes from dtype bucketing (#167863)
eellison Nov 18, 2025
7921c0e
[ROCm][CI] Limit caching to ROCm jammy docker images (#168088)
jithunnair-amd Nov 18, 2025
ae85307
huber_loss numerical issue (#166952)
jturney Nov 18, 2025
ebb2001
[codemod][lowrisk] Remove unused exception parameter from caffe2/torc…
r-barnes Nov 18, 2025
41999a5
Fix Tensor use_count check in VariableType.cpp (#168060)
colesbury Nov 18, 2025
e8970ba
[CI] Migrate all gcc9 jobs to gcc11 (#167933)
malfet Nov 18, 2025
dc4f3c7
[MPS] Move `elu` impl to Metal (#166903)
kurtamohler Nov 4, 2025
1efc14a
[ROCm][CI] Update concurrency setting for docker-cache-rocm.yml (#168…
jithunnair-amd Nov 19, 2025
a4e0720
typo corrected in type.cpp (#167907)
RajeshvShiyal Nov 19, 2025
a369a56
[ROCm][CI] forward fix libtorch agnostic tests (#168087)
jeffdaily Nov 19, 2025
878757c
[CI][CUDA] Unskip nvshmem triton tests (#167760)
nWEIdia Nov 19, 2025
c8d790b
[xpu][fix] Fix empty cache on mempool (#168074)
guangyey Nov 18, 2025
8f16199
Fix stable ABI to/from deprecation warnings. Add my_shape test. (#167…
pearu Nov 18, 2025
b8a3165
[2/3][XPU][feature] The implementation of MemPool for XPU (#166833)
majing921201 Nov 19, 2025
cdca10b
[AOTI] Fix a GPU memory leak caused by reference circle (#168063)
desertfire Nov 18, 2025
cea8678
[CD] Add `cuda-bindings` dependency to CUDA wheels (#167769)
malfet Nov 13, 2025
13ec55d
Update AGENTS.md (#168111)
oulgen Nov 19, 2025
65f08ee
[MPS][1/N] Fix unsupported dtypes error checking for some MPS ops (#1…
malfet Nov 19, 2025
d48cae9
Shrink binary size (#168080)
colesbury Nov 19, 2025
6fc4306
Improve build logic in activities for kineto (#167204)
guangyey Nov 6, 2025
28c7602
[vision hash update] update the pinned vision hash (#168130)
pytorchupdatebot Nov 19, 2025
f49833d
[hoo] Invoke subgraph + effect (#167231)
angelayi Nov 18, 2025
789240b
[invoke_subgraph] Don't run the graph twice when autograd enabled (#1…
angelayi Nov 18, 2025
9abc9aa
fix: use grad div factor when fsdp_degree=1 (#167178)
garrett361 Nov 19, 2025
1c0bf2a
[CUDA][Complex] Bump tolerances for `TestFFTCUDA.test_reference_nd__r…
eqy Nov 19, 2025
a5f36a8
[DTensor] Fix deadlock after fast cache clear (#168069)
zpcore Nov 19, 2025
e5a766e
[user-streams] Insert backward syncs (#167747)
mlazos Nov 18, 2025
9f94c7b
[fix] Assign CUDAEvent external member properly (#167711)
guangyey Nov 19, 2025
7a963ff
LocalTensor for random_ops tests (#166540)
dolpm Nov 19, 2025
be33b7f
[DeviceMemory] Add Basic Statistics to Device Memory in OpenReg (#166…
licy666 Nov 19, 2025
8f4dc30
Hide all symbols (except stable/headeronly/shim) if TORCH_STABLE_ONLY…
mikaylagawarecki Nov 18, 2025
a0ccd3e
Error when non stable/headeronly/shim headers are included by stable …
mikaylagawarecki Nov 18, 2025
5abb7bf
Revert "[SymmMem] Skip multicast init if any CUDA call fails (#168049)"
pytorchmergebot Nov 19, 2025
c7cf3fb
Revert "[pytree][compile] Slightly faster TreeSpec init (#168024)"
pytorchmergebot Nov 19, 2025
eefc0f8
Fix link for core maintainers request form (#168089)
albanD Nov 19, 2025
962f13f
[compile][to_local] Support Sequence-like placement user defined obje…
anijain2305 Nov 19, 2025
f2dc4ba
Fixing multi-kernel autotune for different size hints on ROCm
chinmaydk99 Nov 17, 2025
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
14 changes: 2 additions & 12 deletions .ci/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ case "$tag" in
UCC_COMMIT=${_UCC_COMMIT}
TRITON=yes
;;
pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc9-inductor-benchmarks)
pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11-inductor-benchmarks)
CUDA_VERSION=12.8.1
ANACONDA_PYTHON_VERSION=3.10
GCC_VERSION=9
GCC_VERSION=11
VISION=yes
KATEX=yes
UCX_COMMIT=${_UCX_COMMIT}
Expand All @@ -146,16 +146,6 @@ case "$tag" in
UCC_COMMIT=${_UCC_COMMIT}
TRITON=yes
;;
pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc9)
CUDA_VERSION=12.8.1
ANACONDA_PYTHON_VERSION=3.10
GCC_VERSION=9
VISION=yes
KATEX=yes
UCX_COMMIT=${_UCX_COMMIT}
UCC_COMMIT=${_UCC_COMMIT}
TRITON=yes
;;
pytorch-linux-jammy-py3-clang12-onnx)
ANACONDA_PYTHON_VERSION=3.10
CLANG_VERSION=12
Expand Down
3 changes: 3 additions & 0 deletions .ci/docker/requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,6 @@ scikit-build==0.18.1
pyre-extensions==0.0.32
tabulate==0.9.0
#Description: These package are needed to build FBGEMM and torchrec on PyTorch CI

Jinja2==3.1.6
#Description: required for torch.distributed.debug
348 changes: 348 additions & 0 deletions .ci/pytorch/smoke_test/check_binary_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,347 @@ def check_lib_statically_linked_libstdc_cxx_abi_symbols(lib: str) -> None:
)


def _compile_and_extract_symbols(
cpp_content: str, compile_flags: list[str], exclude_list: list[str] | None = None
) -> list[str]:
"""
Helper to compile a C++ file and extract all symbols.

Args:
cpp_content: C++ source code to compile
compile_flags: Compilation flags
exclude_list: List of symbol names to exclude. Defaults to ["main"].

Returns:
List of all symbols found in the object file (excluding those in exclude_list).
"""
import subprocess
import tempfile

if exclude_list is None:
exclude_list = ["main"]

with tempfile.TemporaryDirectory() as tmpdir:
tmppath = Path(tmpdir)
cpp_file = tmppath / "test.cpp"
obj_file = tmppath / "test.o"

cpp_file.write_text(cpp_content)

result = subprocess.run(
compile_flags + [str(cpp_file), "-o", str(obj_file)],
capture_output=True,
text=True,
timeout=60,
)

if result.returncode != 0:
raise RuntimeError(f"Compilation failed: {result.stderr}")

symbols = get_symbols(str(obj_file))

# Return all symbol names, excluding those in the exclude list
return [name for _addr, _stype, name in symbols if name not in exclude_list]


def check_stable_only_symbols(install_root: Path) -> None:
"""
Test TORCH_STABLE_ONLY and TORCH_TARGET_VERSION by compiling test code.

This approach tests:
1. WITHOUT macros -> many torch symbols exposed (compilation succeeds)
2. WITH TORCH_STABLE_ONLY -> compilation fails with #error directive
3. WITH TORCH_TARGET_VERSION -> compilation fails with #error directive
4. WITH both macros -> compilation fails with #error directive
"""
import subprocess
import tempfile

include_dir = install_root / "include"
assert include_dir.exists(), f"Expected {include_dir} to be present"

test_cpp_content = """
// Main torch C++ API headers
#include <torch/torch.h>
#include <torch/all.h>

// ATen tensor library
#include <ATen/ATen.h>

// Core c10 headers (commonly used)
#include <c10/core/Device.h>
#include <c10/core/DeviceType.h>
#include <c10/core/ScalarType.h>
#include <c10/core/TensorOptions.h>
#include <c10/util/Optional.h>

int main() { return 0; }
"""

base_compile_flags = [
"g++",
"-std=c++17",
f"-I{include_dir}",
f"-I{include_dir}/torch/csrc/api/include",
"-c", # Compile only, don't link
]

# Compile WITHOUT any macros - should succeed
symbols_without = _compile_and_extract_symbols(
cpp_content=test_cpp_content,
compile_flags=base_compile_flags,
)

# We expect constexpr symbols, inline functions used by other headers etc.
# to produce symbols
num_symbols_without = len(symbols_without)
print(f"Found {num_symbols_without} symbols without any macros defined")
assert num_symbols_without != 0, (
"Expected a non-zero number of symbols without any macros"
)

# Helper to verify compilation fails with expected error
def _expect_compilation_failure(compile_flags: list[str], macro_name: str) -> None:
with tempfile.TemporaryDirectory() as tmpdir:
tmppath = Path(tmpdir)
cpp_file = tmppath / "test.cpp"
obj_file = tmppath / "test.o"

cpp_file.write_text(test_cpp_content)

result = subprocess.run(
compile_flags + [str(cpp_file), "-o", str(obj_file)],
capture_output=True,
text=True,
timeout=60,
)

if result.returncode == 0:
raise RuntimeError(
f"Expected compilation to fail with {macro_name} defined, but it succeeded"
)

stderr = result.stderr
expected_error_msg = (
"This file should not be included when either TORCH_STABLE_ONLY "
"or TORCH_TARGET_VERSION is defined."
)

if expected_error_msg not in stderr:
raise RuntimeError(
f"Expected error message to contain:\n '{expected_error_msg}'\n"
f"but got:\n{stderr[:1000]}"
)

print(f"Compilation correctly failed with {macro_name} defined")

compile_flags_with_stable_only = base_compile_flags + ["-DTORCH_STABLE_ONLY"]
_expect_compilation_failure(compile_flags_with_stable_only, "TORCH_STABLE_ONLY")

compile_flags_with_target_version = base_compile_flags + [
"-DTORCH_TARGET_VERSION=1"
]
_expect_compilation_failure(
compile_flags_with_target_version, "TORCH_TARGET_VERSION"
)

compile_flags_with_both = base_compile_flags + [
"-DTORCH_STABLE_ONLY",
"-DTORCH_TARGET_VERSION=1",
]
_expect_compilation_failure(compile_flags_with_both, "both macros")


def check_stable_api_symbols(install_root: Path) -> None:
"""
Test that stable API headers still expose symbols with TORCH_STABLE_ONLY.
The torch/csrc/stable/c/shim.h header is tested in check_stable_c_shim_symbols
"""
include_dir = install_root / "include"
assert include_dir.exists(), f"Expected {include_dir} to be present"

stable_dir = include_dir / "torch" / "csrc" / "stable"
assert stable_dir.exists(), f"Expected {stable_dir} to be present"

stable_headers = list(stable_dir.rglob("*.h"))
if not stable_headers:
raise RuntimeError("Could not find any stable headers")

includes = []
for header in stable_headers:
rel_path = header.relative_to(include_dir)
includes.append(f"#include <{rel_path.as_posix()}>")

includes_str = "\n".join(includes)
test_stable_content = f"""
{includes_str}
int main() {{ return 0; }}
"""

compile_flags = [
"g++",
"-std=c++17",
f"-I{include_dir}",
f"-I{include_dir}/torch/csrc/api/include",
"-c",
"-DTORCH_STABLE_ONLY",
]

symbols_stable = _compile_and_extract_symbols(
cpp_content=test_stable_content,
compile_flags=compile_flags,
)
num_symbols_stable = len(symbols_stable)
print(f"Found {num_symbols_stable} symbols in torch/csrc/stable")
assert num_symbols_stable > 0, (
f"Expected stable headers to expose symbols with TORCH_STABLE_ONLY, "
f"but found {num_symbols_stable} symbols"
)


def check_headeronly_symbols(install_root: Path) -> None:
"""
Test that header-only utility headers still expose symbols with TORCH_STABLE_ONLY.
"""
include_dir = install_root / "include"
assert include_dir.exists(), f"Expected {include_dir} to be present"

# Find all headers in torch/headeronly
headeronly_dir = include_dir / "torch" / "headeronly"
assert headeronly_dir.exists(), f"Expected {headeronly_dir} to be present"
headeronly_headers = list(headeronly_dir.rglob("*.h"))
if not headeronly_headers:
raise RuntimeError("Could not find any headeronly headers")

# Filter out platform-specific headers that may not compile everywhere
platform_specific_keywords = [
"cpu/vec",
]

filtered_headers = []
for header in headeronly_headers:
rel_path = header.relative_to(include_dir).as_posix()
if not any(
keyword in rel_path.lower() for keyword in platform_specific_keywords
):
filtered_headers.append(header)

includes = []
for header in filtered_headers:
rel_path = header.relative_to(include_dir)
includes.append(f"#include <{rel_path.as_posix()}>")

includes_str = "\n".join(includes)
test_headeronly_content = f"""
{includes_str}
int main() {{ return 0; }}
"""

compile_flags = [
"g++",
"-std=c++17",
f"-I{include_dir}",
f"-I{include_dir}/torch/csrc/api/include",
"-c",
"-DTORCH_STABLE_ONLY",
]

symbols_headeronly = _compile_and_extract_symbols(
cpp_content=test_headeronly_content,
compile_flags=compile_flags,
)
num_symbols_headeronly = len(symbols_headeronly)
print(f"Found {num_symbols_headeronly} symbols in torch/headeronly")
assert num_symbols_headeronly > 0, (
f"Expected headeronly headers to expose symbols with TORCH_STABLE_ONLY, "
f"but found {num_symbols_headeronly} symbols"
)


def check_aoti_shim_symbols(install_root: Path) -> None:
"""
Test that AOTI shim headers still expose symbols with TORCH_STABLE_ONLY.
"""
include_dir = install_root / "include"
assert include_dir.exists(), f"Expected {include_dir} to be present"

# There are no constexpr symbols etc., so we need to actually use functions
# so that some symbols are found.
test_shim_content = """
#include <torch/csrc/inductor/aoti_torch/c/shim.h>
int main() {
int32_t (*fp1)() = &aoti_torch_device_type_cpu;
int32_t (*fp2)() = &aoti_torch_dtype_float32;
(void)fp1; (void)fp2;
return 0;
}
"""

compile_flags = [
"g++",
"-std=c++17",
f"-I{include_dir}",
f"-I{include_dir}/torch/csrc/api/include",
"-c",
"-DTORCH_STABLE_ONLY",
]

symbols_shim = _compile_and_extract_symbols(
cpp_content=test_shim_content,
compile_flags=compile_flags,
)
num_symbols_shim = len(symbols_shim)
assert num_symbols_shim > 0, (
f"Expected shim headers to expose symbols with TORCH_STABLE_ONLY, "
f"but found {num_symbols_shim} symbols"
)


def check_stable_c_shim_symbols(install_root: Path) -> None:
"""
Test that stable C shim headers still expose symbols with TORCH_STABLE_ONLY.
"""
include_dir = install_root / "include"
assert include_dir.exists(), f"Expected {include_dir} to be present"

# Check if the stable C shim exists
stable_shim = include_dir / "torch" / "csrc" / "stable" / "c" / "shim.h"
if not stable_shim.exists():
raise RuntimeError("Could not find stable c shim")

# There are no constexpr symbols etc., so we need to actually use functions
# so that some symbols are found.
test_stable_shim_content = """
#include <torch/csrc/stable/c/shim.h>
int main() {
// Reference stable C API functions to create undefined symbols
AOTITorchError (*fp1)(const char*, uint32_t*, int32_t*) = &torch_parse_device_string;
AOTITorchError (*fp2)(uint32_t*) = &torch_get_num_threads;
(void)fp1; (void)fp2;
return 0;
}
"""

compile_flags = [
"g++",
"-std=c++17",
f"-I{include_dir}",
f"-I{include_dir}/torch/csrc/api/include",
"-c",
"-DTORCH_STABLE_ONLY",
]

symbols_stable_shim = _compile_and_extract_symbols(
cpp_content=test_stable_shim_content,
compile_flags=compile_flags,
)
num_symbols_stable_shim = len(symbols_stable_shim)
assert num_symbols_stable_shim > 0, (
f"Expected stable C shim headers to expose symbols with TORCH_STABLE_ONLY, "
f"but found {num_symbols_stable_shim} symbols"
)


def check_lib_symbols_for_abi_correctness(lib: str) -> None:
print(f"lib: {lib}")
cxx11_symbols = grep_symbols(lib, LIBTORCH_CXX11_PATTERNS)
Expand Down Expand Up @@ -129,6 +470,13 @@ def main() -> None:
check_lib_symbols_for_abi_correctness(libtorch_cpu_path)
check_lib_statically_linked_libstdc_cxx_abi_symbols(libtorch_cpu_path)

# Check symbols when TORCH_STABLE_ONLY is defined
check_stable_only_symbols(install_root)
check_stable_api_symbols(install_root)
check_headeronly_symbols(install_root)
check_aoti_shim_symbols(install_root)
check_stable_c_shim_symbols(install_root)


if __name__ == "__main__":
main()
Loading