From 52b5ef81a12e3eeb0ee710546bfd054b7cf1e6d3 Mon Sep 17 00:00:00 2001 From: Ayan Das Date: Thu, 29 Jan 2026 02:08:56 +0530 Subject: [PATCH] gnu: python-pytorch: Update to 2.10.0. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/machine-learning.scm (%python-pytorch-version): Update to 2.10.0. (%python-pytorch-src)[source]: Update hash. (python-pytorch)[arguments]: Fix build by including Utils.hpp. * gnu/packages/patches/python-pytorch-runpath.patch: Update for 2.10.0. * gnu/packages/patches/python-pytorch-system-libraries.patch: Update for 2.10.0. Change-Id: Ic579058f302d2d8face536ae9980f06854888615 Signed-off-by: Ludovic Courtès --- gnu/packages/machine-learning.scm | 20 +++- .../patches/python-pytorch-runpath.patch | 19 +-- .../python-pytorch-system-libraries.patch | 108 +++++++++--------- 3 files changed, 71 insertions(+), 76 deletions(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index c4bcbbe650..19db91ec36 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -4810,7 +4810,7 @@ contains facebook extensions and is used by PyTorch.") PyTorch.") (license license:expat))) -(define %python-pytorch-version "2.9.0") +(define %python-pytorch-version "2.10.0") (define %python-pytorch-src (origin @@ -4821,7 +4821,7 @@ PyTorch.") (file-name (git-file-name "python-pytorch" %python-pytorch-version)) (sha256 (base32 - "005gj27qikkgbibbk00z8xs9a8xms2fxapm53inp31zxm4853myh")) + "05pw5i1fm1i3grj8ksyrprq3an4a5pzn4ii1jkym00d0nabgbkyx")) (patches (search-patches "python-pytorch-system-libraries.patch" "python-pytorch-runpath.patch" "python-pytorch-without-kineto.patch" @@ -5007,12 +5007,20 @@ PyTorch.") "caffe2/serialize/inline_container.cc" "torch/csrc/inductor/aoti_package/model_package_loader.cpp")) + ;; Fix missing include for getCvarString/getCvarInt. + (substitute* "torch/csrc/distributed/c10d/GlooDeviceFactory.cpp" + (("#include " all) + (string-append + "#include \n\n" + all))) + ;; Fix moodycamel/concurrentqueue includes for system package (substitute* '("c10/util/Semaphore.h" "c10/test/util/Semaphore_test.cpp" "torch/nativert/executor/ParallelGraphExecutor.cpp") (("") "") - (("") "")) + (("") + "")) (substitute* "aten/src/ATen/native/vulkan/api/Allocator.h" (("") @@ -5054,10 +5062,10 @@ PyTorch.") (substitute* '("requirements.txt" "setup.py") (("sympy>=1\\.13\\.3") "sympy>=1.13.1")) - ;; Avoid ModuleNotFoundError. + ;; Avoid ModuleNotFoundError while preserving setup.py flow. (substitute* "setup.py" - (("from build_bundled import create_bundled" all) - (string-append "return # " all))))) + (("from build_bundled import create_bundled") + "create_bundled = lambda *args, **kwargs: None")))) (add-after 'use-system-libraries 'skip-nccl-call (lambda _ ;; Comment-out `checkout_nccl()` invokation in build_pytorch(). diff --git a/gnu/packages/patches/python-pytorch-runpath.patch b/gnu/packages/patches/python-pytorch-runpath.patch index cd8bea370b..d491698f96 100644 --- a/gnu/packages/patches/python-pytorch-runpath.patch +++ b/gnu/packages/patches/python-pytorch-runpath.patch @@ -1,6 +1,6 @@ -Libraries (such as 'libtorch_cpu.so') and executables (such as 'torch_shm_manager') -get installed, quite surprisingly, to 'lib/python3.8/site-packages/{bin,lib}'. -Make sure RUNPATH matches that. +Libraries (such as 'libtorch_cpu.so') and executables (such as +'torch_shm_manager') get installed, quite surprisingly, to +'lib/pythonX.Y/site-packages/{bin,lib}'. Make sure RUNPATH matches that. diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index be45936a8..7b19e5359 100644 @@ -15,16 +15,3 @@ index be45936a8..7b19e5359 100644 endif(APPLE) # Use separate rpaths during build and install phases set(CMAKE_SKIP_BUILD_RPATH FALSE) -diff --git a/functorch/CMakeLists.txt b/functorch/CMakeLists.txt -index bdfa4bfe4..2a75e3825 100644 ---- a/functorch/CMakeLists.txt -+++ b/functorch/CMakeLists.txt -@@ -26,7 +26,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE pybind::pybind11) - - set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/functorch) --set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${_rpath_portable_origin}/../torch/lib") -+set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/../torch/lib") - - # Copy-pasted prefix/suffix logic for Python extensions from - # https://github.com/pytorch/pytorch/blob/33bb8ae350611760139457b85842b1d7edf9aa11/caffe2/CMakeLists.txt#L1975 diff --git a/gnu/packages/patches/python-pytorch-system-libraries.patch b/gnu/packages/patches/python-pytorch-system-libraries.patch index bf88e16ceb..8df5d0e20f 100644 --- a/gnu/packages/patches/python-pytorch-system-libraries.patch +++ b/gnu/packages/patches/python-pytorch-system-libraries.patch @@ -5,10 +5,10 @@ httlib, ideep, miniz, nnpack, oneapi-dnnl, pocketfft, pthreadpool, qnnpack-pytorch, tensorpipe, valgrind and xnnpack packages. diff --git i/aten/src/ATen/CMakeLists.txt w/aten/src/ATen/CMakeLists.txt -index 6c095680733..646d342acc6 100644 +index a3e841ca22a..632274abe5c 100644 --- i/aten/src/ATen/CMakeLists.txt +++ w/aten/src/ATen/CMakeLists.txt -@@ -600,9 +600,9 @@ if(AT_NNPACK_ENABLED) +@@ -638,9 +638,9 @@ if(AT_NNPACK_ENABLED) list(APPEND ATen_CPU_DEPENDENCY_LIBS nnpack) # cpuinfo is added below endif() @@ -22,7 +22,7 @@ index 6c095680733..646d342acc6 100644 if(USE_MKLDNN_ACL) list(APPEND ATen_CPU_INCLUDE ${ACL_INCLUDE_DIRS}) diff --git i/caffe2/CMakeLists.txt w/caffe2/CMakeLists.txt -index 6ab41b6c847..f46610ec4fd 100644 +index 6cbaecc5d2e..339145fab63 100644 --- i/caffe2/CMakeLists.txt +++ w/caffe2/CMakeLists.txt @@ -91,9 +91,6 @@ if(NOT MSVC AND USE_XNNPACK) @@ -35,7 +35,7 @@ index 6ab41b6c847..f46610ec4fd 100644 endif() endif() -@@ -1205,7 +1202,6 @@ if(USE_XPU) +@@ -1212,7 +1209,6 @@ if(USE_XPU) endif() if(NOT MSVC AND USE_XNNPACK) @@ -43,7 +43,7 @@ index 6ab41b6c847..f46610ec4fd 100644 endif() # ========================================================== -@@ -1325,8 +1321,8 @@ endif() +@@ -1332,8 +1328,8 @@ endif() target_include_directories(torch_cpu PRIVATE ${TORCH_ROOT}/third_party/cpp-httplib) @@ -54,7 +54,7 @@ index 6ab41b6c847..f46610ec4fd 100644 install(DIRECTORY "${TORCH_SRC_DIR}/csrc" -@@ -1548,6 +1544,7 @@ target_link_libraries(torch_cpu PUBLIC c10) +@@ -1552,6 +1548,7 @@ target_link_libraries(torch_cpu PUBLIC c10) target_link_libraries(torch_cpu PUBLIC ${Caffe2_PUBLIC_DEPENDENCY_LIBS}) target_link_libraries(torch_cpu PRIVATE ${Caffe2_DEPENDENCY_LIBS}) target_link_libraries(torch_cpu PRIVATE ${Caffe2_DEPENDENCY_WHOLE_LINK_LIBS}) @@ -62,7 +62,7 @@ index 6ab41b6c847..f46610ec4fd 100644 if(USE_MPI) target_link_libraries(torch_cpu PRIVATE MPI::MPI_CXX) endif() -@@ -1815,7 +1812,7 @@ if(BUILD_MOBILE_TEST) +@@ -1819,7 +1816,7 @@ if(BUILD_MOBILE_TEST) foreach(test_src ${ATen_MOBILE_TEST_SRCS}) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} "${test_src}") @@ -71,7 +71,7 @@ index 6ab41b6c847..f46610ec4fd 100644 target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE ${ATen_CPU_INCLUDE}) -@@ -1836,7 +1833,7 @@ if(BUILD_TEST) +@@ -1840,7 +1837,7 @@ if(BUILD_TEST) if(NOT MSVC) add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}" ../aten/src/ATen/native/quantized/AffineQuantizerBase.cpp) # TODO: Get rid of c10 dependency (which is only needed for the implementation of AT_ERROR) @@ -80,7 +80,7 @@ index 6ab41b6c847..f46610ec4fd 100644 if(USE_FBGEMM) target_link_libraries(${test_name}_${CPU_CAPABILITY} fbgemm) endif() -@@ -1850,7 +1847,7 @@ if(BUILD_TEST) +@@ -1860,7 +1857,7 @@ if(BUILD_TEST) endif() else() add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}") @@ -89,7 +89,7 @@ index 6ab41b6c847..f46610ec4fd 100644 endif() target_include_directories(${test_name}_${CPU_CAPABILITY} PRIVATE $) target_include_directories(${test_name}_${CPU_CAPABILITY} PRIVATE $) -@@ -1891,7 +1888,7 @@ if(BUILD_TEST) +@@ -1901,7 +1898,7 @@ if(BUILD_TEST) add_executable(${test_name} "${test_src}") find_library(metal NAMES Metal) find_library(foundation NAMES Foundation) @@ -98,7 +98,7 @@ index 6ab41b6c847..f46610ec4fd 100644 target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) -@@ -1911,7 +1908,7 @@ if(BUILD_TEST) +@@ -1921,7 +1918,7 @@ if(BUILD_TEST) foreach(test_src ${Caffe2_GPU_TEST_SRCS}) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} "${test_src}") @@ -107,16 +107,16 @@ index 6ab41b6c847..f46610ec4fd 100644 if(USE_CUDNN AND ${test_name} MATCHES "cudnn") target_link_libraries(${test_name} torch::cudnn) endif() -@@ -1933,7 +1930,7 @@ if(BUILD_TEST) - foreach(test_src ${Caffe2_XPU_TEST_SRCS}) +@@ -1944,7 +1941,7 @@ if(BUILD_TEST) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} "${test_src}") + torch_compile_options(${test_name}) - target_link_libraries(${test_name} torch_library gtest_main) + target_link_libraries(${test_name} torch_library gtest_main gtest) target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) add_test(NAME ${test_name} COMMAND $) -@@ -1948,7 +1945,7 @@ if(BUILD_TEST) +@@ -1959,7 +1956,7 @@ if(BUILD_TEST) foreach(test_src ${Caffe2_VULKAN_TEST_SRCS}) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} "${test_src}") @@ -125,7 +125,7 @@ index 6ab41b6c847..f46610ec4fd 100644 target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) add_test(NAME ${test_name} COMMAND $) -@@ -1980,7 +1977,7 @@ if(BUILD_TEST) +@@ -1991,7 +1988,7 @@ if(BUILD_TEST) if(test_src MATCHES "^.*\.hip$") set_target_properties(${test_name} PROPERTIES LINKER_LANGUAGE CXX) endif() @@ -147,10 +147,10 @@ index ebbff0f292a..dcded25908e 100644 ${CMAKE_CURRENT_SOURCE_DIR}/istream_adapter.cc ${CMAKE_CURRENT_SOURCE_DIR}/file_adapter.cc diff --git i/cmake/Dependencies.cmake w/cmake/Dependencies.cmake -index ef5c2fd4e97..d6400cb616f 100644 +index 903c212de81..a6972b40370 100644 --- i/cmake/Dependencies.cmake +++ w/cmake/Dependencies.cmake -@@ -299,7 +299,7 @@ endif() +@@ -307,7 +307,7 @@ endif() # --- [ PocketFFT set(AT_POCKETFFT_ENABLED 0) if(NOT AT_MKL_ENABLED) @@ -159,7 +159,7 @@ index ef5c2fd4e97..d6400cb616f 100644 if(NOT EXISTS "${POCKETFFT_INCLUDE_DIR}") message(FATAL_ERROR "pocketfft directory not found, expected ${POCKETFFT_INCLUDE_DIR}") elseif(NOT EXISTS "${POCKETFFT_INCLUDE_DIR}/pocketfft_hdronly.h") -@@ -483,15 +483,6 @@ if(USE_PYTORCH_QNNPACK) +@@ -491,15 +491,6 @@ if(USE_PYTORCH_QNNPACK) set(PYTORCH_QNNPACK_BUILD_TESTS OFF CACHE BOOL "") set(PYTORCH_QNNPACK_BUILD_BENCHMARKS OFF CACHE BOOL "") set(PYTORCH_QNNPACK_LIBRARY_TYPE "static" CACHE STRING "") @@ -175,7 +175,7 @@ index ef5c2fd4e97..d6400cb616f 100644 endif() list(APPEND Caffe2_DEPENDENCY_LIBS pytorch_qnnpack) -@@ -581,16 +572,15 @@ if(USE_XNNPACK AND NOT USE_SYSTEM_XNNPACK) +@@ -595,16 +586,15 @@ if(USE_XNNPACK AND NOT USE_SYSTEM_XNNPACK) list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK microkernels-prod) elseif(NOT TARGET XNNPACK AND USE_SYSTEM_XNNPACK) add_library(XNNPACK SHARED IMPORTED) @@ -196,7 +196,7 @@ index ef5c2fd4e97..d6400cb616f 100644 endif() # ---[ Vulkan deps -@@ -644,9 +634,6 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST) +@@ -658,9 +648,6 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST) set(INSTALL_GTEST OFF CACHE BOOL "Install gtest." FORCE) set(BUILD_GMOCK ON CACHE BOOL "Build gmock." FORCE) @@ -206,7 +206,7 @@ index ef5c2fd4e97..d6400cb616f 100644 # We will not need to test benchmark lib itself. set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.") -@@ -678,16 +665,22 @@ if(USE_FBGEMM) +@@ -692,16 +679,22 @@ if(USE_FBGEMM) set(FBGEMM_BUILD_TESTS OFF CACHE BOOL "") set(FBGEMM_BUILD_BENCHMARKS OFF CACHE BOOL "") set(FBGEMM_LIBRARY_TYPE "static" CACHE STRING "") @@ -235,7 +235,7 @@ index ef5c2fd4e97..d6400cb616f 100644 list(APPEND Caffe2_DEPENDENCY_LIBS fbgemm) endif() endif() -@@ -758,7 +751,7 @@ if(NOT TARGET fp16 AND NOT USE_SYSTEM_FP16) +@@ -772,7 +765,7 @@ if(NOT TARGET fp16 AND NOT USE_SYSTEM_FP16) "${CONFU_DEPENDENCIES_BINARY_DIR}/FP16") endif() elseif(NOT TARGET fp16 AND USE_SYSTEM_FP16) @@ -244,7 +244,7 @@ index ef5c2fd4e97..d6400cb616f 100644 set_target_properties(fp16 PROPERTIES LINKER_LANGUAGE C) endif() list(APPEND Caffe2_DEPENDENCY_LIBS fp16) -@@ -1141,10 +1134,11 @@ if(USE_DISTRIBUTED AND USE_TENSORPIPE) +@@ -1165,10 +1158,11 @@ if(USE_DISTRIBUTED AND USE_TENSORPIPE) # Tensorpipe uses cuda_add_library torch_update_find_cuda_flags() @@ -255,10 +255,10 @@ index ef5c2fd4e97..d6400cb616f 100644 + if(TARGET tensorpipe) + target_compile_options_if_supported(tensorpipe -Wno-missing-template-arg-list-after-template-kw) + endif() - - list(APPEND Caffe2_DEPENDENCY_LIBS tensorpipe) - list(APPEND Caffe2_DEPENDENCY_LIBS nlohmann) -@@ -1320,7 +1314,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + # Workaround for relocation truncated to fit: R_AARCH64_CALL26 against symbol __aarch64_swp4_relax' + # When compiling for ARMv8.0, build uv with embedded atomics, which are slightly slower + # But are used only once during shutdown +@@ -1350,7 +1344,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) endif() set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY}) message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}") @@ -267,7 +267,7 @@ index ef5c2fd4e97..d6400cb616f 100644 endif() # Recover the build shared libs option. set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS}) -@@ -1480,9 +1474,8 @@ if(NOT INTERN_BUILD_MOBILE) +@@ -1513,9 +1507,8 @@ if(NOT INTERN_BUILD_MOBILE) endif() if(USE_MKLDNN) include(${CMAKE_CURRENT_LIST_DIR}/public/mkldnn.cmake) @@ -278,8 +278,8 @@ index ef5c2fd4e97..d6400cb616f 100644 else() message(WARNING "MKLDNN could not be found.") caffe2_update_option(USE_MKLDNN OFF) -@@ -1546,7 +1539,7 @@ endif() - # +@@ -1590,7 +1583,7 @@ endif() + set(FMT_INSTALL ON) set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE) -add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) @@ -287,7 +287,7 @@ index ef5c2fd4e97..d6400cb616f 100644 # Disable compiler feature checks for `fmt`. # -@@ -1555,7 +1548,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) +@@ -1599,7 +1592,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) # CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know # `fmt` is compatible with a superset of the compilers that PyTorch is, it # shouldn't be too bad to just disable the checks. @@ -295,7 +295,7 @@ index ef5c2fd4e97..d6400cb616f 100644 list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only) set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) -@@ -1721,4 +1713,5 @@ include_directories(nlohmann SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/third_party/ +@@ -1695,4 +1687,5 @@ include_directories(nlohmann SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/third_party/ # Include moodycamel add_library(moodycamel INTERFACE IMPORTED) @@ -344,10 +344,10 @@ index 87935625f9b..9f8fa3df81f 100644 - ${MKLDNN_LIBRARIES}) + DNNL::dnnl) diff --git i/setup.py w/setup.py -index 11ca48482a7..0bc17caef68 100644 +index da38ba785f1..2d41bc13107 100644 --- i/setup.py +++ w/setup.py -@@ -1025,13 +1025,9 @@ def build_deps() -> None: +@@ -1060,13 +1060,9 @@ def build_deps() -> None: # Windows has very poor support for them. sym_files = [ CWD / "tools/shared/_utils_internal.py", @@ -362,32 +362,32 @@ index 11ca48482a7..0bc17caef68 100644 for sym_file, orig_file in zip(sym_files, orig_files): same = False diff --git i/test/cpp/aoti_abi_check/CMakeLists.txt w/test/cpp/aoti_abi_check/CMakeLists.txt -index 6898e406fb3..5400c159dac 100644 +index 4146819e2f1..227413712cd 100644 --- i/test/cpp/aoti_abi_check/CMakeLists.txt +++ w/test/cpp/aoti_abi_check/CMakeLists.txt -@@ -28,7 +28,7 @@ target_compile_definitions(test_aoti_abi_check PRIVATE USE_GTEST) +@@ -44,7 +44,7 @@ target_compile_definitions(test_aoti_abi_check PRIVATE USE_GTEST) # WARNING: DO NOT LINK torch!!! - # The purpose is to check if the used aten/c10 headers are writtern in a header-only way --target_link_libraries(test_aoti_abi_check PRIVATE gtest_main) -+target_link_libraries(test_aoti_abi_check PRIVATE gtest_main gtest) + # The purpose is to check if the used aten/c10 headers are written in a header-only way +-target_link_libraries(test_aoti_abi_check PRIVATE gtest_main sleef) ++target_link_libraries(test_aoti_abi_check PRIVATE gtest_main gtest sleef) target_include_directories(test_aoti_abi_check PRIVATE ${ATen_CPU_INCLUDE}) - - foreach(test_src ${AOTI_ABI_CHECK_VEC_TEST_SRCS}) -@@ -39,7 +39,7 @@ foreach(test_src ${AOTI_ABI_CHECK_VEC_TEST_SRCS}) + if(NOT USE_SYSTEM_SLEEF) + target_include_directories(test_aoti_abi_check PRIVATE ${CMAKE_BINARY_DIR}/include) +@@ -66,7 +66,7 @@ foreach(test_src ${AOTI_ABI_CHECK_VEC_TEST_SRCS}) separate_arguments(FLAGS UNIX_COMMAND "${FLAGS}") add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}") -- target_link_libraries(${test_name}_${CPU_CAPABILITY} PRIVATE gtest_main) -+ target_link_libraries(${test_name}_${CPU_CAPABILITY} PRIVATE gtest_main gtest) +- target_link_libraries(${test_name}_${CPU_CAPABILITY} PRIVATE gtest_main sleef) ++ target_link_libraries(${test_name}_${CPU_CAPABILITY} PRIVATE gtest_main gtest sleef) target_include_directories(${test_name}_${CPU_CAPABILITY} PRIVATE ${ATen_CPU_INCLUDE}) - - # Define CPU_CAPABILITY and CPU_CAPABILITY_XXX macros for conditional compilation + if(NOT USE_SYSTEM_SLEEF) + target_include_directories(${test_name}_${CPU_CAPABILITY} PRIVATE ${CMAKE_BINARY_DIR}/include) diff --git i/test/cpp/aoti_inference/CMakeLists.txt w/test/cpp/aoti_inference/CMakeLists.txt -index cd87ba6c505..fc68301451a 100644 +index 79e08471568..39002e7ac69 100644 --- i/test/cpp/aoti_inference/CMakeLists.txt +++ w/test/cpp/aoti_inference/CMakeLists.txt -@@ -56,7 +56,7 @@ add_custom_command( +@@ -29,7 +29,7 @@ target_compile_definitions(test_aoti_inference PRIVATE USE_GTEST) target_link_libraries(test_aoti_inference PRIVATE torch @@ -397,7 +397,7 @@ index cd87ba6c505..fc68301451a 100644 ) diff --git i/test/cpp/api/CMakeLists.txt w/test/cpp/api/CMakeLists.txt -index 8261aae3b56..b8ec6782301 100644 +index a92832a4d04..6f8ec13526c 100644 --- i/test/cpp/api/CMakeLists.txt +++ w/test/cpp/api/CMakeLists.txt @@ -50,7 +50,7 @@ endif() @@ -410,7 +410,7 @@ index 8261aae3b56..b8ec6782301 100644 if(USE_CUDA) target_compile_definitions(test_api PRIVATE "USE_CUDA") diff --git i/test/cpp/c10d/CMakeLists.txt w/test/cpp/c10d/CMakeLists.txt -index 285a5dd2a73..51e76302265 100644 +index 285a5dd2a73..6cb87fcbdd5 100644 --- i/test/cpp/c10d/CMakeLists.txt +++ w/test/cpp/c10d/CMakeLists.txt @@ -32,17 +32,17 @@ function(c10d_add_test test_src) @@ -520,18 +520,18 @@ index 5c27dd84f7c..27f7afdaeb4 100644 if(LINUX) target_link_libraries(test_lite_interpreter_runtime PRIVATE "-Wl,--no-as-needed,$,--as-needed") diff --git i/test/cpp/nativert/CMakeLists.txt w/test/cpp/nativert/CMakeLists.txt -index 1b4752ed908..dc60673afbb 100644 +index 77636a2d109..04921418338 100644 --- i/test/cpp/nativert/CMakeLists.txt +++ w/test/cpp/nativert/CMakeLists.txt -@@ -58,7 +58,7 @@ add_executable(test_nativert +@@ -65,7 +65,7 @@ endif() # TODO temporary until we can delete the old gtest polyfills. target_compile_definitions(test_nativert PRIVATE USE_GTEST) -set(NATIVERT_TEST_DEPENDENCIES torch gtest_main) +set(NATIVERT_TEST_DEPENDENCIES torch gtest_main gtest) + target_link_libraries(test_nativert PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(test_nativert PRIVATE ${NATIVERT_TEST_DEPENDENCIES}) - target_link_libraries(test_nativert PRIVATE fmt::fmt-header-only) diff --git i/test/cpp/rpc/CMakeLists.txt w/test/cpp/rpc/CMakeLists.txt index 454c54a0187..301319bbe71 100644 --- i/test/cpp/rpc/CMakeLists.txt @@ -583,7 +583,7 @@ index d38f0a41e22..136526b9dcd 100644 target_compile_definitions(test_mobile_nnc PRIVATE USE_GTEST) diff --git i/torch/CMakeLists.txt w/torch/CMakeLists.txt -index 1632147f022..eff74feb501 100644 +index 3a3ca0f1236..9d4350a3b7e 100644 --- i/torch/CMakeLists.txt +++ w/torch/CMakeLists.txt @@ -82,9 +82,6 @@ set(TORCH_PYTHON_LINK_LIBRARIES