diff --git a/.ci/docker/ci_commit_pins/pytorch.txt b/.ci/docker/ci_commit_pins/pytorch.txt index 96724b0411b..759062dec6f 100644 --- a/.ci/docker/ci_commit_pins/pytorch.txt +++ b/.ci/docker/ci_commit_pins/pytorch.txt @@ -1 +1 @@ -9b498d3bb28b8e3411ce464dd2755c5b96d92c8f +7cda4017ddda554752e89069ae205be5e8388f59 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/install_requirements.py b/install_requirements.py index cfece24b1c2..43cc3b2c76d 100644 --- a/install_requirements.py +++ b/install_requirements.py @@ -71,7 +71,7 @@ def python_is_compatible(): # # NOTE: If you're changing, make the corresponding change in .ci/docker/ci_commit_pins/pytorch.txt # by picking the hash from the same date in https://hud.pytorch.org/hud/pytorch/pytorch/nightly/ -NIGHTLY_VERSION = "dev20250625" +NIGHTLY_VERSION = "dev20250706" def install_requirements(use_pytorch_nightly): @@ -89,7 +89,7 @@ def install_requirements(use_pytorch_nightly): # Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note # that we don't need to set any version number there because they have already # been installed on CI before this step, so pip won't reinstall them - f"torch==2.8.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torch", + f"torch==2.9.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torch", ] # Install the requirements for core ExecuTorch package. @@ -151,7 +151,7 @@ def install_optional_example_requirements(use_pytorch_nightly): print("Installing torch domain libraries") DOMAIN_LIBRARIES = [ ( - f"torchvision==0.23.0.{NIGHTLY_VERSION}" + f"torchvision==0.24.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torchvision" ), 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/macros/Macros.h b/runtime/core/portable_type/c10/c10/macros/Macros.h index 7d8238f9104..6b51a39f2a9 100644 --- a/runtime/core/portable_type/c10/c10/macros/Macros.h +++ b/runtime/core/portable_type/c10/c10/macros/Macros.h @@ -312,7 +312,21 @@ constexpr uint32_t CUDA_THREADS_PER_BLOCK_FALLBACK = 256; #endif #if defined(USE_ROCM) -#define C10_WARP_SIZE warpSize // = 64 or 32 (Defined in hip_runtime.h) +// C10_WARP_SIZE is only allowed for device code. +// Host code _must_ use at::cuda::warp_size() +// HIP header used to define warpSize as a constexpr that was either 32 or 64 +// depending on the target device, and then always set it to 64 for host code. +// Host pass of HIP compiler needs C10_WARP_SIZE defined to _something_ so we +// set it to something unreasonable to trigger obvious host code errors. +#if defined(__HIP_DEVICE_COMPILE__) +#if defined(__GFX9__) +static constexpr int C10_WARP_SIZE = 64; +#else // __GFX9__ +static constexpr int C10_WARP_SIZE = 32; +#endif // __GFX9__ +#else +static constexpr int C10_WARP_SIZE = 1; +#endif // __HIP_DEVICE_COMPILE__ #else #define C10_WARP_SIZE 32 #endif 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/c10/util/irange.h b/runtime/core/portable_type/c10/c10/util/irange.h index f5310510099..cc52d443ee5 100644 --- a/runtime/core/portable_type/c10/c10/util/irange.h +++ b/runtime/core/portable_type/c10/c10/util/irange.h @@ -24,7 +24,7 @@ struct integer_iterator { using pointer = I*; using reference = I&; - explicit constexpr integer_iterator(I value) : value(value) {} + explicit constexpr integer_iterator(I val) : value(val) {} constexpr I operator*() const { return value; 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/"