From 4473a32a80342b0cc0c735e938d705a0ad1b7d00 Mon Sep 17 00:00:00 2001 From: gasoonjia Date: Fri, 10 Oct 2025 13:11:56 -0700 Subject: [PATCH 1/3] pin bump with better architecture This diff bump torch pin to 1008. also expose cuda version into torch_pin.py for better update if needed; Differential Revision: [D84280496](https://our.internmc.facebook.com/intern/diff/D84280496/) [ghstack-poisoned] --- .ci/docker/ci_commit_pins/pytorch.txt | 2 +- CMakeLists.txt | 15 ++++--- install_requirements.py | 23 +--------- .../c10/torch/headeronly/macros/Macros.h | 42 +++++++++++++++++++ torch_pin.py | 19 ++++++++- 5 files changed, 72 insertions(+), 29 deletions(-) diff --git a/.ci/docker/ci_commit_pins/pytorch.txt b/.ci/docker/ci_commit_pins/pytorch.txt index e3a53c8bcb5..40331b4a2d8 100644 --- a/.ci/docker/ci_commit_pins/pytorch.txt +++ b/.ci/docker/ci_commit_pins/pytorch.txt @@ -1 +1 @@ -53a2908a10f414a2f85caa06703a26a40e873869 +7d06d03434c7c8de8fe1a432ee454b953f84ab0d diff --git a/CMakeLists.txt b/CMakeLists.txt index ad08c72d1ae..47f5e5dccdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -889,16 +889,21 @@ if(EXECUTORCH_BUILD_PYBIND) # Set RPATH to find PyTorch libraries relative to the installation location # This goes from executorch/extension/pybindings up to site-packages, then to - # torch/lib + # torch/lib Note: We disable CMAKE_INSTALL_RPATH_USE_LINK_PATH for this target + # to avoid duplicate RPATHs that can occur with recent PyTorch versions if(APPLE) set_target_properties( - portable_lib PROPERTIES BUILD_RPATH "@loader_path/../../../torch/lib" - INSTALL_RPATH "@loader_path/../../../torch/lib" + portable_lib + PROPERTIES BUILD_RPATH "@loader_path/../../../torch/lib" + INSTALL_RPATH "@loader_path/../../../torch/lib" + INSTALL_RPATH_USE_LINK_PATH OFF ) else() set_target_properties( - portable_lib PROPERTIES BUILD_RPATH "$ORIGIN/../../../torch/lib" - INSTALL_RPATH "$ORIGIN/../../../torch/lib" + portable_lib + PROPERTIES BUILD_RPATH "$ORIGIN/../../../torch/lib" + INSTALL_RPATH "$ORIGIN/../../../torch/lib" + INSTALL_RPATH_USE_LINK_PATH OFF ) endif() diff --git a/install_requirements.py b/install_requirements.py index b84e250cf87..a026e5b9964 100644 --- a/install_requirements.py +++ b/install_requirements.py @@ -12,33 +12,12 @@ from install_utils import determine_torch_url, is_intel_mac_os, python_is_compatible -from torch_pin import NIGHTLY_VERSION, TORCH_VERSION +from torch_pin import NIGHTLY_VERSION, SUPPORTED_CUDA_VERSIONS, TORCH_VERSION # The pip repository that hosts nightly torch packages. # This will be dynamically set based on CUDA availability and CUDA backend enabled/disabled. TORCH_NIGHTLY_URL_BASE = "https://download.pytorch.org/whl/nightly" -# Supported CUDA versions - modify this to add/remove supported versions -# Format: tuple of (major, minor) version numbers -SUPPORTED_CUDA_VERSIONS = ( - (12, 6), - (12, 8), - (13, 0), -) - -# Since ExecuTorch often uses main-branch features of pytorch, only the nightly -# pip versions will have the required features. -# -# NOTE: If a newly-fetched version of the executorch repo changes the value of -# NIGHTLY_VERSION, you should re-run this script to install the necessary -# package versions. -# -# 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/ -# -# NOTE: If you're changing, make the corresponding supported CUDA versions in -# SUPPORTED_CUDA_VERSIONS above if needed. - def install_requirements(use_pytorch_nightly): # Skip pip install on Intel macOS if using nightly. diff --git a/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h b/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h index 558edb175ae..e340e7626a0 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h +++ b/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h @@ -359,6 +359,7 @@ static inline int C10_WARP_SIZE_INTERNAL() { // Those platforms do not support assert() #define CUDA_KERNEL_ASSERT(cond) #define CUDA_KERNEL_ASSERT_MSG(cond, msg) +#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) #define SYCL_KERNEL_ASSERT(cond) #elif defined(_MSC_VER) #if defined(NDEBUG) @@ -396,6 +397,26 @@ __host__ __device__ static_cast(__LINE__)), \ 0); \ } +#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) \ + if (C10_UNLIKELY(!(cond))) { \ + (void)(printf( \ + "[CUDA_KERNEL_ASSERT] " __FILE__ ":" C10_STRINGIZE( \ + __LINE__) ": %s: block: [%d,%d,%d], thread: [%d,%d,%d]: " \ + "Assertion failed: `" #cond "`: " msg "\n", \ + __func__, \ + blockIdx.x, \ + blockIdx.y, \ + blockIdx.z, \ + threadIdx.x, \ + threadIdx.y, \ + threadIdx.z, \ + ##__VA_ARGS__)); \ + (void)(_wassert( \ + _CRT_WIDE(#cond), \ + _CRT_WIDE(__FILE__), \ + static_cast(__LINE__)), \ + 0); \ + } #define SYCL_KERNEL_ASSERT(cond) \ if (C10_UNLIKELY(!(cond))) { \ (void)(_wassert( \ @@ -455,6 +476,10 @@ __host__ __device__ if C10_UNLIKELY (!(cond)) { \ abort(); \ } +#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) \ + if C10_UNLIKELY (!(cond)) { \ + abort(); \ + } #define SYCL_KERNEL_ASSERT(cond) \ if C10_UNLIKELY (!(cond)) { \ abort(); \ @@ -470,6 +495,23 @@ __host__ __device__ __assert_fail( \ msg, __FILE__, static_cast(__LINE__), __func__); \ } +#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) \ + if (C10_UNLIKELY(!(cond))) { \ + printf( \ + "[CUDA_KERNEL_ASSERT] " __FILE__ ":" C10_STRINGIZE( \ + __LINE__) ": %s: block: [%d,%d,%d], thread: [%d,%d,%d]: " \ + "Assertion failed: `" #cond "`: " msg "\n", \ + __func__, \ + blockIdx.x, \ + blockIdx.y, \ + blockIdx.z, \ + threadIdx.x, \ + threadIdx.y, \ + threadIdx.z, \ + ##__VA_ARGS__); \ + __assert_fail( \ + #cond, __FILE__, static_cast(__LINE__), __func__); \ + } #define SYCL_KERNEL_ASSERT(cond) \ if (C10_UNLIKELY(!(cond))) { \ __assert_fail( \ diff --git a/torch_pin.py b/torch_pin.py index 02040c91963..765922cfdf0 100644 --- a/torch_pin.py +++ b/torch_pin.py @@ -1,2 +1,19 @@ +# Since ExecuTorch often uses main-branch features of pytorch, only the nightly +# pip versions will have the required features. +# +# NOTE: If a newly-fetched version of the executorch repo changes the value of +# NIGHTLY_VERSION, you should re-run install_executorch.sh script to install the necessary +# package versions. +# +# 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/ +# +# NOTE: If you're changing, make the corresponding supported CUDA versions in +# SUPPORTED_CUDA_VERSIONS above if needed. TORCH_VERSION = "2.10.0" -NIGHTLY_VERSION = "dev20251003" +NIGHTLY_VERSION = "dev20251008" +SUPPORTED_CUDA_VERSIONS = ( + (12, 6), + (12, 8), + (13, 0), +) From 53e44cf06e1c8d2eba9fd873a3801b77caac219e Mon Sep 17 00:00:00 2001 From: gasoonjia Date: Fri, 10 Oct 2025 14:23:30 -0700 Subject: [PATCH 2/3] Update on "pin bump with better architecture" This diff bump torch pin to 1008. also expose cuda version into torch_pin.py for better update if needed; Differential Revision: [D84280496](https://our.internmc.facebook.com/intern/diff/D84280496/) [ghstack-poisoned] --- .ci/docker/ci_commit_pins/pytorch.txt | 2 +- CMakeLists.txt | 15 +++++---------- torch_pin.py | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.ci/docker/ci_commit_pins/pytorch.txt b/.ci/docker/ci_commit_pins/pytorch.txt index 40331b4a2d8..aafc7565373 100644 --- a/.ci/docker/ci_commit_pins/pytorch.txt +++ b/.ci/docker/ci_commit_pins/pytorch.txt @@ -1 +1 @@ -7d06d03434c7c8de8fe1a432ee454b953f84ab0d +cf9d09490c7f6685ec68d5db3acf2e0d73c54d00 diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f5e5dccdf..ad08c72d1ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -889,21 +889,16 @@ if(EXECUTORCH_BUILD_PYBIND) # Set RPATH to find PyTorch libraries relative to the installation location # This goes from executorch/extension/pybindings up to site-packages, then to - # torch/lib Note: We disable CMAKE_INSTALL_RPATH_USE_LINK_PATH for this target - # to avoid duplicate RPATHs that can occur with recent PyTorch versions + # torch/lib if(APPLE) set_target_properties( - portable_lib - PROPERTIES BUILD_RPATH "@loader_path/../../../torch/lib" - INSTALL_RPATH "@loader_path/../../../torch/lib" - INSTALL_RPATH_USE_LINK_PATH OFF + portable_lib PROPERTIES BUILD_RPATH "@loader_path/../../../torch/lib" + INSTALL_RPATH "@loader_path/../../../torch/lib" ) else() set_target_properties( - portable_lib - PROPERTIES BUILD_RPATH "$ORIGIN/../../../torch/lib" - INSTALL_RPATH "$ORIGIN/../../../torch/lib" - INSTALL_RPATH_USE_LINK_PATH OFF + portable_lib PROPERTIES BUILD_RPATH "$ORIGIN/../../../torch/lib" + INSTALL_RPATH "$ORIGIN/../../../torch/lib" ) endif() diff --git a/torch_pin.py b/torch_pin.py index 765922cfdf0..bb8d32d4716 100644 --- a/torch_pin.py +++ b/torch_pin.py @@ -11,7 +11,7 @@ # NOTE: If you're changing, make the corresponding supported CUDA versions in # SUPPORTED_CUDA_VERSIONS above if needed. TORCH_VERSION = "2.10.0" -NIGHTLY_VERSION = "dev20251008" +NIGHTLY_VERSION = "dev20251004" SUPPORTED_CUDA_VERSIONS = ( (12, 6), (12, 8), From 0899bd3eb0634135b27047d2219cd70324543923 Mon Sep 17 00:00:00 2001 From: gasoonjia Date: Fri, 10 Oct 2025 15:49:53 -0700 Subject: [PATCH 3/3] Update on "pin bump with better architecture" This diff bump torch pin to 1008. also expose cuda version into torch_pin.py for better update if needed; Differential Revision: [D84280496](https://our.internmc.facebook.com/intern/diff/D84280496/) [ghstack-poisoned] --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index f1869d38a46..b1c6b8b43a2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,7 @@ import sys from typing import Any -import pytorch_sphinx_theme2 # type: ignore[import-untyped] +import pytorch_sphinx_theme2 # type: ignore[import-not-found] # To let us import ./custom_directives.py sys.path.insert(0, os.path.abspath("."))