From 927e8f2d736ff02b6ca5db98e4927626d7e3624f Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Mon, 7 Jul 2025 14:48:11 -0700 Subject: [PATCH] [release/0.7 only] Fix check_c10_sync being out of sync https://github.com/pytorch/pytorch/pull/157418 was picked to the PyTorch 2.8 branch and puts us out of sync with c10. This re-syncs. I did a mass find/replace of torch/standalone with torch/headeronly; hopefully that caught everything. --- .ci/scripts/check_c10_sync.sh | 2 +- runtime/core/portable_type/c10/README.md | 2 +- runtime/core/portable_type/c10/c10/macros/Export.h | 2 +- runtime/core/portable_type/c10/c10/targets.bzl | 2 +- .../c10/torch/{standalone => headeronly}/TARGETS | 0 .../c10/torch/{standalone => headeronly}/macros/Export.h | 0 .../c10/torch/{standalone => headeronly}/targets.bzl | 4 ++-- scripts/build_apple_frameworks.sh | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename runtime/core/portable_type/c10/torch/{standalone => headeronly}/TARGETS (100%) rename runtime/core/portable_type/c10/torch/{standalone => headeronly}/macros/Export.h (100%) rename runtime/core/portable_type/c10/torch/{standalone => headeronly}/targets.bzl (81%) diff --git a/.ci/scripts/check_c10_sync.sh b/.ci/scripts/check_c10_sync.sh index 67bc8a3e4c0..809a3a0229b 100755 --- a/.ci/scripts/check_c10_sync.sh +++ b/.ci/scripts/check_c10_sync.sh @@ -12,4 +12,4 @@ pushd pytorch git checkout "$pytorch_pin" popd "$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10 -"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/torch/standalone pytorch/torch/standalone +"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/torch/headeronly pytorch/torch/headeronly diff --git a/runtime/core/portable_type/c10/README.md b/runtime/core/portable_type/c10/README.md index 361d4b51c44..c0fa01d7456 100644 --- a/runtime/core/portable_type/c10/README.md +++ b/runtime/core/portable_type/c10/README.md @@ -12,7 +12,7 @@ would cause all headers in that directory to be includeable with `runtime/core/portable_type/complex.h`, which would shadow the C99 `complex.h` standard header. -`torch/standalone` has been added as an extra "even more bottom of +`torch/headeronly` has been added as an extra "even more bottom of stack" directory in PyTorch, so we have to add it to our sync here. The extra "stutter" c10 directory causing `c10/torch/standlone` is unfortunately awkward; perhaps we can rename the top-level diff --git a/runtime/core/portable_type/c10/c10/macros/Export.h b/runtime/core/portable_type/c10/c10/macros/Export.h index 28068bd34d4..b013910902b 100644 --- a/runtime/core/portable_type/c10/c10/macros/Export.h +++ b/runtime/core/portable_type/c10/c10/macros/Export.h @@ -5,7 +5,7 @@ #include #endif // C10_USING_CUSTOM_GENERATED_MACROS -#include +#include // This one is being used by libtorch.so #ifdef CAFFE2_BUILD_MAIN_LIB diff --git a/runtime/core/portable_type/c10/c10/targets.bzl b/runtime/core/portable_type/c10/c10/targets.bzl index 6b5c3bd8bd1..3ea50c25555 100644 --- a/runtime/core/portable_type/c10/c10/targets.bzl +++ b/runtime/core/portable_type/c10/c10/targets.bzl @@ -125,7 +125,7 @@ def define_common_targets(): "@EXECUTORCH_CLIENTS", ], exported_deps = [ - "//executorch/runtime/core/portable_type/c10/torch/standalone:torch_standalone_headers", + "//executorch/runtime/core/portable_type/c10/torch/headeronly:torch_headeronly", ] + select({ "DEFAULT": [], # Half-inl.h depends on vec_half.h from ATen, but only when building for x86. diff --git a/runtime/core/portable_type/c10/torch/standalone/TARGETS b/runtime/core/portable_type/c10/torch/headeronly/TARGETS similarity index 100% rename from runtime/core/portable_type/c10/torch/standalone/TARGETS rename to runtime/core/portable_type/c10/torch/headeronly/TARGETS diff --git a/runtime/core/portable_type/c10/torch/standalone/macros/Export.h b/runtime/core/portable_type/c10/torch/headeronly/macros/Export.h similarity index 100% rename from runtime/core/portable_type/c10/torch/standalone/macros/Export.h rename to runtime/core/portable_type/c10/torch/headeronly/macros/Export.h diff --git a/runtime/core/portable_type/c10/torch/standalone/targets.bzl b/runtime/core/portable_type/c10/torch/headeronly/targets.bzl similarity index 81% rename from runtime/core/portable_type/c10/torch/standalone/targets.bzl rename to runtime/core/portable_type/c10/torch/headeronly/targets.bzl index 1faf1173a4a..0ddce72f237 100644 --- a/runtime/core/portable_type/c10/torch/standalone/targets.bzl +++ b/runtime/core/portable_type/c10/torch/headeronly/targets.bzl @@ -8,7 +8,7 @@ def define_common_targets(): """ runtime.cxx_library( - name = "torch_standalone_headers", + name = "torch_headeronly", exported_headers = glob(["**/*.h"]), - header_namespace = "torch/standalone", + header_namespace = "torch/headeronly", ) diff --git a/scripts/build_apple_frameworks.sh b/scripts/build_apple_frameworks.sh index b98832a2266..8c5e5cfbee8 100755 --- a/scripts/build_apple_frameworks.sh +++ b/scripts/build_apple_frameworks.sh @@ -180,7 +180,7 @@ sed -i '' '1i\ ' \ "$HEADERS_ABSOLUTE_PATH/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h" \ "$HEADERS_ABSOLUTE_PATH/executorch/runtime/core/portable_type/c10/c10/macros/Export.h" \ -"$HEADERS_ABSOLUTE_PATH/executorch/runtime/core/portable_type/c10/torch/standalone/macros/Export.h" +"$HEADERS_ABSOLUTE_PATH/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Export.h" cp -r $HEADERS_ABSOLUTE_PATH/executorch/runtime/core/portable_type/c10/c10 "$HEADERS_ABSOLUTE_PATH/" cp -r $HEADERS_ABSOLUTE_PATH/executorch/runtime/core/portable_type/c10/torch "$HEADERS_ABSOLUTE_PATH/"