mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:59:06 +08:00
[libtorch] update to 2.1.2 (#36246)
* [libtorch] update to 2.1.2 * adjust features and deps * remove dep * fix onnx case * use system fxdiv * update xnnpack * fxdiv fix in libtorch * add newline * xnnpack does not install configs * more patching * fix patch * more fixes * use full lib for sleef. * fix glog symbol on osx * try fixing msvc ice * ok renaming did nothing * v db * remove comments * v db * cuda is only for x64 * v db * fix usage since cuda is still external to vcpkg * v db --------- Co-authored-by: Jim wang (BEYONDSOFT CONSULTING INC) <v-wangjim@microsoft.com>
This commit is contained in:
parent
7233110263
commit
20584b9d44
47
ports/libtorch/clang-cl.patch
Normal file
47
ports/libtorch/clang-cl.patch
Normal file
@ -0,0 +1,47 @@
|
||||
diff --git a/c10/util/Exception.h b/c10/util/Exception.h
|
||||
index 2dd1001..b3f3d60 100644
|
||||
--- a/c10/util/Exception.h
|
||||
+++ b/c10/util/Exception.h
|
||||
@@ -233,12 +233,16 @@ struct C10_API WarnAlways {
|
||||
// IndexError when they cross to Python.
|
||||
class C10_API IndexError : public Error {
|
||||
using Error::Error;
|
||||
+public:
|
||||
+ inline IndexError(SourceLocation source_location, std::string msg) : Error(source_location,msg) {};
|
||||
};
|
||||
|
||||
// Used in ATen for invalid values. These turn into
|
||||
// ValueError when they cross to Python.
|
||||
class C10_API ValueError : public Error {
|
||||
using Error::Error;
|
||||
+public:
|
||||
+ inline ValueError(SourceLocation source_location, std::string msg) : Error(source_location,msg) {};
|
||||
};
|
||||
|
||||
// Used in ATen for invalid types. These turn into
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index cf349c2..f7a595e 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -830,7 +830,7 @@ if(BUILD_CAFFE2 AND NOT MSVC)
|
||||
target_compile_options(torch_cpu PRIVATE "-Wno-sign-compare")
|
||||
endif()
|
||||
|
||||
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT USE_VULKAN AND NOT USE_IOS AND NOT USE_PYTORCH_METAL AND NOT USE_COREML_DELEGATE)
|
||||
+if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT USE_VULKAN AND NOT USE_IOS AND NOT USE_PYTORCH_METAL AND NOT USE_COREML_DELEGATE AND NOT MSVC)
|
||||
target_compile_options_if_supported(torch_cpu "-Wmissing-prototypes")
|
||||
target_compile_options_if_supported(torch_cpu "-Werror=missing-prototypes")
|
||||
get_target_property(TORCH_CPU_SOURCES torch_cpu SOURCES)
|
||||
diff --git a/functorch/csrc/dim/arena.h b/functorch/csrc/dim/arena.h
|
||||
index 3251321..cb09b7c 100644
|
||||
--- a/functorch/csrc/dim/arena.h
|
||||
+++ b/functorch/csrc/dim/arena.h
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <ATen/ATen.h>
|
||||
#include "minpybind.h"
|
||||
|
||||
-#ifdef _WIN32
|
||||
+#if defined(_WIN32) && !defined(__clang__)
|
||||
#include <intrin.h>
|
||||
// https://stackoverflow.com/questions/355967/how-to-use-msvc-intrinsics-to-get-the-equivalent-of-this-gcc-code
|
||||
inline unsigned int __builtin_clz(unsigned int x) {
|
235
ports/libtorch/cmake-fixes.patch
Normal file
235
ports/libtorch/cmake-fixes.patch
Normal file
@ -0,0 +1,235 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 3a48eaf4e2..7b8bc7cb6e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1049,8 +1049,7 @@ if(USE_MIMALLOC)
|
||||
set(MI_BUILD_OBJECT OFF)
|
||||
set(MI_BUILD_TESTS OFF)
|
||||
add_definitions(-DUSE_MIMALLOC)
|
||||
- add_subdirectory(third_party/mimalloc)
|
||||
- include_directories(third_party/mimalloc/include)
|
||||
+ find_package(mimalloc REQUIRED)
|
||||
endif()
|
||||
|
||||
# ---[ Main build
|
||||
diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
index fd6b7ff551..d185233529 100644
|
||||
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
@@ -368,7 +368,7 @@ elseif(NOT TARGET pthreadpool AND USE_SYSTEM_PTHREADPOOL)
|
||||
if(NOT PTHREADPOOL_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find pthreadpool")
|
||||
endif()
|
||||
- message("-- Found pthreadpool: ${PTHREADPOOL_LIBRARY}")
|
||||
+ message("-- Found pthreadpool cpu qnnpack: ${PTHREADPOOL_LIBRARY}")
|
||||
set_target_properties(pthreadpool PROPERTIES
|
||||
IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}")
|
||||
add_library(pthreadpool_interface INTERFACE)
|
||||
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt
|
||||
index feebad7cbb..ad407e18cb 100644
|
||||
--- a/c10/CMakeLists.txt
|
||||
+++ b/c10/CMakeLists.txt
|
||||
@@ -109,8 +109,7 @@ else()
|
||||
endif()
|
||||
|
||||
if(USE_MIMALLOC)
|
||||
- target_link_libraries(c10 PRIVATE "mimalloc-static")
|
||||
- add_dependencies(c10 mimalloc-static)
|
||||
+ target_link_libraries(c10 PRIVATE "mimalloc")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
|
||||
index c3abce52e4..cd27c728ff 100644
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -285,7 +285,7 @@ endif()
|
||||
set(AT_FFTW_ENABLED 0)
|
||||
set(USE_FFTW OFF)
|
||||
if(USE_FFTW OR NOT MKL_FOUND)
|
||||
- find_library(LIBFFTW3 fftw3)
|
||||
+ find_library(LIBFFTW3 NAMES fftw3 REQUIRED)
|
||||
if(LIBFFTW3)
|
||||
find_path(FFTW3_INCLUDE_DIR NAMES fftw3.h ONLY_CMAKE_FIND_ROOT_PATH)
|
||||
if(FFTW3_INCLUDE_DIR)
|
||||
@@ -415,8 +415,8 @@ if(INTERN_BUILD_MOBILE OR NOT DISABLE_NNPACK_AND_FAMILY)
|
||||
|
||||
if(NOT TARGET pthreadpool)
|
||||
if(USE_SYSTEM_PTHREADPOOL)
|
||||
- add_library(pthreadpool SHARED IMPORTED)
|
||||
- find_library(PTHREADPOOL_LIBRARY pthreadpool)
|
||||
+ add_library(pthreadpool UNKNOWN IMPORTED)
|
||||
+ find_library(PTHREADPOOL_LIBRARY pthreadpool PATH_SUFFIXES lib)
|
||||
set_property(TARGET pthreadpool PROPERTY IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}")
|
||||
if(NOT PTHREADPOOL_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find pthreadpool")
|
||||
@@ -450,13 +450,15 @@ endif()
|
||||
|
||||
# ---[ Caffe2 uses cpuinfo library in the thread pool
|
||||
if(NOT TARGET cpuinfo AND USE_SYSTEM_CPUINFO)
|
||||
- add_library(cpuinfo SHARED IMPORTED)
|
||||
- find_library(CPUINFO_LIBRARY cpuinfo)
|
||||
+ add_library(cpuinfo UNKNOWN IMPORTED)
|
||||
+ find_library(CPUINFO_LIBRARY NAMES cpuinfo REQUIRED)
|
||||
+ find_library(CLOG_LIBRARY NAMES clog REQUIRED)
|
||||
if(NOT CPUINFO_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find cpuinfo")
|
||||
endif()
|
||||
message("Found cpuinfo: ${CPUINFO_LIBRARY}")
|
||||
set_target_properties(cpuinfo PROPERTIES IMPORTED_LOCATION "${CPUINFO_LIBRARY}")
|
||||
+ target_link_libraries(cpuinfo INTERFACE "${CLOG_LIBRARY}")
|
||||
elseif(NOT TARGET cpuinfo)
|
||||
if(NOT DEFINED CPUINFO_SOURCE_DIR)
|
||||
set(CPUINFO_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../third_party/cpuinfo" CACHE STRING "cpuinfo source directory")
|
||||
@@ -659,8 +661,8 @@ if(USE_XNNPACK AND NOT USE_SYSTEM_XNNPACK)
|
||||
include_directories(SYSTEM ${XNNPACK_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK)
|
||||
elseif(NOT TARGET XNNPACK AND USE_SYSTEM_XNNPACK)
|
||||
- add_library(XNNPACK SHARED IMPORTED)
|
||||
- find_library(XNNPACK_LIBRARY XNNPACK)
|
||||
+ add_library(XNNPACK UNKNOWN IMPORTED)
|
||||
+ find_library(XNNPACK_LIBRARY NAMES XNNPACK REQUIRED)
|
||||
set_property(TARGET XNNPACK PROPERTY IMPORTED_LOCATION "${XNNPACK_LIBRARY}")
|
||||
if(NOT XNNPACK_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find XNNPACK")
|
||||
@@ -858,7 +860,7 @@ endif()
|
||||
|
||||
# ---[ LMDB
|
||||
if(USE_LMDB)
|
||||
- find_package(LMDB)
|
||||
+ find_package(LMDB REQUIRED)
|
||||
if(LMDB_FOUND)
|
||||
include_directories(SYSTEM ${LMDB_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${LMDB_LIBRARIES})
|
||||
@@ -1002,8 +1004,9 @@ if(NOT TARGET fp16 AND NOT USE_SYSTEM_FP16)
|
||||
"${FP16_SOURCE_DIR}"
|
||||
"${CONFU_DEPENDENCIES_BINARY_DIR}/FP16")
|
||||
elseif(NOT TARGET fp16 AND USE_SYSTEM_FP16)
|
||||
- add_library(fp16 STATIC "/usr/include/fp16.h")
|
||||
- set_target_properties(fp16 PROPERTIES LINKER_LANGUAGE C)
|
||||
+ find_path(FP16_INCLUDE_DIR NAMES fp16.h PATH_SUFFIXES include)
|
||||
+ add_library(fp16 INTERFACE)
|
||||
+ target_include_directories(fp16 INTERFACE "${FP16_INCLUDE_DIR}")
|
||||
endif()
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS fp16)
|
||||
|
||||
@@ -1244,8 +1247,8 @@ endif(USE_LLVM)
|
||||
|
||||
# ---[ cuDNN
|
||||
if(USE_CUDNN)
|
||||
- set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include)
|
||||
- target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR})
|
||||
+ find_package(CUDNN REQUIRED)
|
||||
+ target_include_directories(torch::cudnn INTERFACE "${CUDNN_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
# ---[ HIP
|
||||
@@ -1555,7 +1558,10 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
|
||||
set_target_properties(onnx_proto PROPERTIES CXX_STANDARD 17)
|
||||
endif()
|
||||
endif()
|
||||
- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL)
|
||||
+
|
||||
+ # setup foxi
|
||||
+ find_library(FOXI_LOADER_LIBPATH NAMES foxi_loader REQUIRED)
|
||||
+ list(APPEND Caffe2_DEPENDENCY_LIBS "${FOXI_LOADER_LIBPATH}")
|
||||
|
||||
add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE})
|
||||
if(NOT USE_SYSTEM_ONNX)
|
||||
@@ -1573,14 +1579,14 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
|
||||
target_compile_options(onnx PRIVATE -Wno-deprecated-declarations)
|
||||
endif()
|
||||
else()
|
||||
- add_library(onnx SHARED IMPORTED)
|
||||
- find_library(ONNX_LIBRARY onnx)
|
||||
+ add_library(onnx UNKNOWN IMPORTED)
|
||||
+ find_library(ONNX_LIBRARY NAMES onnx REQUIRED)
|
||||
if(NOT ONNX_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find onnx")
|
||||
endif()
|
||||
set_property(TARGET onnx PROPERTY IMPORTED_LOCATION ${ONNX_LIBRARY})
|
||||
- add_library(onnx_proto SHARED IMPORTED)
|
||||
- find_library(ONNX_PROTO_LIBRARY onnx_proto)
|
||||
+ add_library(onnx_proto UNKNOWN IMPORTED)
|
||||
+ find_library(ONNX_PROTO_LIBRARY NAMES onnx_proto REQUIRED)
|
||||
if(NOT ONNX_PROTO_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find onnx")
|
||||
endif()
|
||||
@@ -1589,7 +1595,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
|
||||
endif()
|
||||
include_directories(${FOXI_INCLUDE_DIRS})
|
||||
- list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader)
|
||||
+ list(APPEND Caffe2_DEPENDENCY_LIBS "${FOXI_LOADER_LIBPATH}")
|
||||
# Recover the build shared libs option.
|
||||
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS})
|
||||
endif()
|
||||
@@ -1834,8 +1840,8 @@ endif()
|
||||
#
|
||||
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)
|
||||
-
|
||||
+#add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)
|
||||
+find_package(fmt REQUIRED)
|
||||
# Disable compiler feature checks for `fmt`.
|
||||
#
|
||||
# CMake compiles a little program to check compiler features. Some of our build
|
||||
@@ -1843,7 +1849,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.
|
||||
-set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "")
|
||||
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
|
||||
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE)
|
||||
diff --git a/cmake/Modules/FindLMDB.cmake b/cmake/Modules/FindLMDB.cmake
|
||||
index 2f0adb1b6d..8a817fd6f1 100644
|
||||
--- a/cmake/Modules/FindLMDB.cmake
|
||||
+++ b/cmake/Modules/FindLMDB.cmake
|
||||
@@ -12,12 +12,8 @@
|
||||
# Copyright 2013 Conrad Steenberg <conrad.steenberg@gmail.com>
|
||||
# Aug 31, 2013
|
||||
|
||||
-if(MSVC)
|
||||
- find_package(LMDB NO_MODULE)
|
||||
-else()
|
||||
- find_path(LMDB_INCLUDE_DIR NAMES lmdb.h PATHS "$ENV{LMDB_DIR}/include")
|
||||
- find_library(LMDB_LIBRARIES NAMES lmdb PATHS "$ENV{LMDB_DIR}/lib" )
|
||||
-endif()
|
||||
+find_path(LMDB_INCLUDE_DIR NAMES lmdb.h PATHS "$ENV{LMDB_DIR}/include")
|
||||
+find_library(LMDB_LIBRARIES NAMES lmdb PATHS "$ENV{LMDB_DIR}/lib" )
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARIES)
|
||||
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
|
||||
index 32f3ba375b..411293794f 100644
|
||||
--- a/cmake/public/cuda.cmake
|
||||
+++ b/cmake/public/cuda.cmake
|
||||
@@ -67,8 +67,8 @@ if(NOT CMAKE_CUDA_COMPILER_VERSION STREQUAL CUDAToolkit_VERSION OR
|
||||
"V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR}'")
|
||||
endif()
|
||||
|
||||
-if(NOT TARGET CUDA::nvToolsExt)
|
||||
- message(FATAL_ERROR "Failed to find nvToolsExt")
|
||||
+if(NOT TARGET CUDA::nvToolsExt AND TARGET CUDA::nvtx3)
|
||||
+ add_library(CUDA::nvToolsExt ALIAS CUDA::nvtx3)
|
||||
endif()
|
||||
|
||||
message(STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION})
|
||||
diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake
|
||||
index 4d48c0f0f3..ebdd39a7fd 100644
|
||||
--- a/cmake/public/utils.cmake
|
||||
+++ b/cmake/public/utils.cmake
|
||||
@@ -185,9 +185,9 @@ endfunction()
|
||||
macro(caffe2_update_option variable value)
|
||||
if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO)
|
||||
get_property(__help_string CACHE ${variable} PROPERTY HELPSTRING)
|
||||
- set(${variable} ${value} CACHE BOOL ${__help_string} FORCE)
|
||||
+ set("${variable}" "${value}" CACHE BOOL "${__help_string}" FORCE)
|
||||
else()
|
||||
- set(${variable} ${value})
|
||||
+ set("${variable}" "${value}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
61
ports/libtorch/cuda-adjustments.patch
Normal file
61
ports/libtorch/cuda-adjustments.patch
Normal file
@ -0,0 +1,61 @@
|
||||
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
|
||||
index 9293df3..11bc4bf 100644
|
||||
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
|
||||
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
|
||||
@@ -126,11 +126,11 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
|
||||
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
|
||||
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
|
||||
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
|
||||
-if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
|
||||
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER AND 0)
|
||||
if (CUDA_HOST_COMPILER STREQUAL "@_CUDA_MSVC_HOST_COMPILER@" AND DEFINED CCBIN)
|
||||
- set(CCBIN -ccbin "${CCBIN}")
|
||||
+ #set(CCBIN -ccbin "${CCBIN}")
|
||||
else()
|
||||
- set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
|
||||
+ #set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
|
||||
index d917738..8f832fe 100644
|
||||
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
|
||||
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
|
||||
@@ -30,7 +30,7 @@ endif()
|
||||
set(CUDA_KNOWN_GPU_ARCHITECTURES "Kepler" "Maxwell")
|
||||
|
||||
# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default)
|
||||
-set(CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")
|
||||
+# set(CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")
|
||||
|
||||
# This list is used to filter CUDA archs when autodetecting
|
||||
set(CUDA_ALL_GPU_ARCHITECTURES "3.5" "5.0")
|
||||
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
|
||||
index 420ee63..f029b66 100644
|
||||
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
|
||||
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
|
||||
@@ -1694,9 +1694,9 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
|
||||
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
|
||||
# Match VERBATIM check below.
|
||||
if(CUDA_HOST_COMPILER MATCHES "\\$\\(VCInstallDir\\)")
|
||||
- list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
|
||||
+ #list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
|
||||
else()
|
||||
- list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")
|
||||
+ #list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
|
||||
index 4112937..3e1af83 100644
|
||||
--- a/cmake/public/cuda.cmake
|
||||
+++ b/cmake/public/cuda.cmake
|
||||
@@ -42,7 +42,7 @@ set(CUDAToolkit_ROOT "${CUDA_TOOLKIT_ROOT_DIR}")
|
||||
# Must be done before CUDA language is enabled, see
|
||||
# https://cmake.org/cmake/help/v3.15/variable/CMAKE_CUDA_HOST_COMPILER.html
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
- set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
|
||||
+ #set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
|
||||
endif()
|
||||
enable_language(CUDA)
|
||||
if("X${CMAKE_CUDA_STANDARD}" STREQUAL "X" )
|
39
ports/libtorch/fix-api-export.patch
Normal file
39
ports/libtorch/fix-api-export.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff --git a/aten/src/ATen/Context.h b/aten/src/ATen/Context.h
|
||||
index 285c6f7..1040acc 100644
|
||||
--- a/aten/src/ATen/Context.h
|
||||
+++ b/aten/src/ATen/Context.h
|
||||
@@ -28,7 +28,7 @@ namespace at {
|
||||
|
||||
class Tensor;
|
||||
|
||||
-enum class TORCH_API Float32MatmulPrecision { HIGHEST, HIGH, MEDIUM };
|
||||
+enum class Float32MatmulPrecision { HIGHEST, HIGH, MEDIUM };
|
||||
|
||||
class TORCH_API Context {
|
||||
public:
|
||||
diff --git a/aten/src/ATen/core/function_schema.h b/aten/src/ATen/core/function_schema.h
|
||||
index c48e9b0..cd8d4dd 100644
|
||||
--- a/aten/src/ATen/core/function_schema.h
|
||||
+++ b/aten/src/ATen/core/function_schema.h
|
||||
@@ -206,7 +206,7 @@ inline bool operator!=(const Argument& lhs, const Argument& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
-enum struct TORCH_API SchemaArgType { input, output };
|
||||
+enum struct SchemaArgType { input, output };
|
||||
|
||||
/**
|
||||
* struct SchemaArgument
|
||||
diff --git a/torch/csrc/jit/runtime/static/native_ops.cpp b/torch/csrc/jit/runtime/static/native_ops.cpp
|
||||
index 7f3cbcf..fe80ab1 100644
|
||||
--- a/torch/csrc/jit/runtime/static/native_ops.cpp
|
||||
+++ b/torch/csrc/jit/runtime/static/native_ops.cpp
|
||||
@@ -1055,7 +1055,7 @@ namespace {
|
||||
execution is completed, future is marked as complete to
|
||||
indicate aten::wait() to proceed
|
||||
*/
|
||||
-class TORCH_API ForkedSubgraphSRLauncher {
|
||||
+class ForkedSubgraphSRLauncher {
|
||||
public:
|
||||
ForkedSubgraphSRLauncher(
|
||||
std::shared_ptr<StaticModule> smodule,
|
184
ports/libtorch/fix-build.patch
Normal file
184
ports/libtorch/fix-build.patch
Normal file
@ -0,0 +1,184 @@
|
||||
diff --git a/c10/cuda/CMakeLists.txt b/c10/cuda/CMakeLists.txt
|
||||
index c0628d0c96..5dfb7f2abb 100644
|
||||
--- a/c10/cuda/CMakeLists.txt
|
||||
+++ b/c10/cuda/CMakeLists.txt
|
||||
@@ -74,7 +74,11 @@ add_subdirectory(test)
|
||||
# Note: for now, we will put all export path into one single Caffe2Targets group
|
||||
# to deal with the cmake deployment need. Inside the Caffe2Targets set, the
|
||||
# individual libraries like libc10.so and libcaffe2.so are still self-contained.
|
||||
-install(TARGETS c10_cuda EXPORT Caffe2Targets DESTINATION lib)
|
||||
+install(TARGETS c10_cuda EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ )
|
||||
foreach(file ${C10_CUDA_HEADERS})
|
||||
get_filename_component( dir ${file} DIRECTORY )
|
||||
install( FILES ${file} DESTINATION include/c10/cuda/${dir} )
|
||||
diff --git a/c10/util/Exception.h b/c10/util/Exception.h
|
||||
index ecbc7c1345..2dd1001c9e 100644
|
||||
--- a/c10/util/Exception.h
|
||||
+++ b/c10/util/Exception.h
|
||||
@@ -14,6 +14,9 @@
|
||||
#define __func__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
+#pragma warning(suppress : 4251)
|
||||
+#endif
|
||||
namespace c10 {
|
||||
|
||||
/// The primary ATen error class.
|
||||
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
|
||||
index 2c5c5b95d8..8c1742591f 100644
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -1581,19 +1581,10 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
|
||||
target_compile_options(onnx PRIVATE -Wno-deprecated-declarations)
|
||||
endif()
|
||||
else()
|
||||
- add_library(onnx UNKNOWN IMPORTED)
|
||||
- find_library(ONNX_LIBRARY NAMES onnx REQUIRED)
|
||||
- if(NOT ONNX_LIBRARY)
|
||||
- message(FATAL_ERROR "Cannot find onnx")
|
||||
- endif()
|
||||
- set_property(TARGET onnx PROPERTY IMPORTED_LOCATION ${ONNX_LIBRARY})
|
||||
- add_library(onnx_proto UNKNOWN IMPORTED)
|
||||
- find_library(ONNX_PROTO_LIBRARY NAMES onnx_proto REQUIRED)
|
||||
- if(NOT ONNX_PROTO_LIBRARY)
|
||||
- message(FATAL_ERROR "Cannot find onnx")
|
||||
- endif()
|
||||
- set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY})
|
||||
- message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}")
|
||||
+ find_package(onnx REQUIRED)
|
||||
+ set(ONNX_LIBRARY onnx)
|
||||
+ set(ONNX_PROTO_LIBRARY onnx_proto)
|
||||
+ message("-- Found onnx")
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
|
||||
endif()
|
||||
include_directories(${FOXI_INCLUDE_DIRS})
|
||||
diff --git a/pyproject.toml b/pyproject.toml
|
||||
index eb764cb895..c70f317c2f 100644
|
||||
--- a/pyproject.toml
|
||||
+++ b/pyproject.toml
|
||||
@@ -4,11 +4,9 @@ requires = [
|
||||
"wheel",
|
||||
"astunparse",
|
||||
"numpy",
|
||||
- "ninja",
|
||||
"pyyaml",
|
||||
- "cmake",
|
||||
"typing-extensions",
|
||||
- "requests",
|
||||
+# "requests",
|
||||
]
|
||||
# Use legacy backend to import local packages in setup.py
|
||||
build-backend = "setuptools.build_meta:__legacy__"
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 17bf16b89a..b90ebbc9eb 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -263,7 +263,7 @@ from tools.setup_helpers.env import build_type, IS_DARWIN, IS_LINUX, IS_WINDOWS
|
||||
################################################################################
|
||||
|
||||
VERBOSE_SCRIPT = True
|
||||
-RUN_BUILD_DEPS = True
|
||||
+RUN_BUILD_DEPS = False
|
||||
# see if the user passed a quiet flag to setup.py arguments and respect
|
||||
# that in our parts of the build
|
||||
EMIT_BUILD_WARNING = False
|
||||
@@ -307,9 +307,9 @@ else:
|
||||
|
||||
# Constant known variables used throughout this file
|
||||
cwd = os.path.dirname(os.path.abspath(__file__))
|
||||
-lib_path = os.path.join(cwd, "torch", "lib")
|
||||
+lib_path = os.path.join(cwd, "../../@TARGET_TRIPLET@/", "lib")
|
||||
third_party_path = os.path.join(cwd, "third_party")
|
||||
-caffe2_build_dir = os.path.join(cwd, "build")
|
||||
+caffe2_build_dir = os.path.join(cwd, "../../@TARGET_TRIPLET@")
|
||||
|
||||
# CMAKE: full path to python library
|
||||
if IS_WINDOWS:
|
||||
@@ -759,7 +759,7 @@ class build_ext(setuptools.command.build_ext.build_ext):
|
||||
with open(filename) as f:
|
||||
return json.load(f)
|
||||
|
||||
- ninja_files = glob.glob("build/*compile_commands.json")
|
||||
+ ninja_files = glob.glob("../../@TARGET_TRIPLET@/*compile_commands.json")
|
||||
cmake_files = glob.glob("torch/lib/build/*/compile_commands.json")
|
||||
all_commands = [entry for f in ninja_files + cmake_files for entry in load(f)]
|
||||
|
||||
diff --git a/third_party/nvfuser/csrc/instrumentation.h b/third_party/nvfuser/csrc/instrumentation.h
|
||||
index cd57825a24..75e81e9fac 100644
|
||||
--- a/third_party/nvfuser/csrc/instrumentation.h
|
||||
+++ b/third_party/nvfuser/csrc/instrumentation.h
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <utils.h>
|
||||
|
||||
-#include <nvToolsExt.h>
|
||||
+#include <nvtx3/nvToolsExt.h>
|
||||
|
||||
// NOLINTNEXTLINE(modernize-deprecated-headers)
|
||||
#include <stdio.h>
|
||||
diff --git a/tools/setup_helpers/env.py b/tools/setup_helpers/env.py
|
||||
index d87e97a2bb..e1bc42e87c 100644
|
||||
--- a/tools/setup_helpers/env.py
|
||||
+++ b/tools/setup_helpers/env.py
|
||||
@@ -19,7 +19,7 @@ CONDA_DIR = os.path.join(os.path.dirname(sys.executable), "..")
|
||||
|
||||
IS_64BIT = struct.calcsize("P") == 8
|
||||
|
||||
-BUILD_DIR = "build"
|
||||
+BUILD_DIR = "../../@TARGET_TRIPLET@"
|
||||
|
||||
|
||||
def check_env_flag(name: str, default: str = "") -> bool:
|
||||
diff --git a/torch/lib/libshm/CMakeLists.txt b/torch/lib/libshm/CMakeLists.txt
|
||||
index 20158a9a25..7d3c475a9b 100644
|
||||
--- a/torch/lib/libshm/CMakeLists.txt
|
||||
+++ b/torch/lib/libshm/CMakeLists.txt
|
||||
@@ -71,6 +71,10 @@ target_link_libraries(torch_shm_manager PRIVATE shm)
|
||||
set_target_properties(torch_shm_manager PROPERTIES
|
||||
INSTALL_RPATH "${_rpath_portable_origin}/../lib")
|
||||
|
||||
-install(TARGETS shm LIBRARY DESTINATION ${LIBSHM_INSTALL_LIB_SUBDIR})
|
||||
+install(TARGETS shm
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ LIBRARY DESTINATION lib
|
||||
+)
|
||||
install(FILES libshm.h DESTINATION "include")
|
||||
install(TARGETS torch_shm_manager DESTINATION "bin")
|
||||
diff --git a/torch/lib/libshm_windows/CMakeLists.txt b/torch/lib/libshm_windows/CMakeLists.txt
|
||||
index df2a106493..b86e0b6872 100644
|
||||
--- a/torch/lib/libshm_windows/CMakeLists.txt
|
||||
+++ b/torch/lib/libshm_windows/CMakeLists.txt
|
||||
@@ -19,9 +19,12 @@ target_include_directories(shm PRIVATE
|
||||
target_link_libraries(shm torch c10)
|
||||
|
||||
|
||||
-install(TARGETS shm DESTINATION "${LIBSHM_INSTALL_LIB_SUBDIR}")
|
||||
+install(TARGETS shm
|
||||
+ LIBRARY DESTINATION "${LIBSHM_INSTALL_LIB_SUBDIR}"
|
||||
+ ARCHIVE DESTINATION "${LIBSHM_INSTALL_LIB_SUBDIR}"
|
||||
+ RUNTIME DESTINATION "${LIBSHM_INSTALL_BIN_SUBDIR}")
|
||||
install(FILES libshm.h DESTINATION "include")
|
||||
|
||||
if(MSVC AND BUILD_SHARED_LIBS)
|
||||
- install(FILES $<TARGET_PDB_FILE:shm> DESTINATION "${LIBSHM_INSTALL_LIB_SUBDIR}" OPTIONAL)
|
||||
+ install(FILES $<TARGET_PDB_FILE:shm> DESTINATION "${LIBSHM_INSTALL_BIN_SUBDIR}" OPTIONAL)
|
||||
endif()
|
||||
diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py
|
||||
index 6600eb3cb5..1d5e451c14 100644
|
||||
--- a/torch/utils/cpp_extension.py
|
||||
+++ b/torch/utils/cpp_extension.py
|
||||
@@ -38,7 +38,7 @@ SHARED_FLAG = '/DLL' if IS_WINDOWS else '-shared'
|
||||
|
||||
_HERE = os.path.abspath(__file__)
|
||||
_TORCH_PATH = os.path.dirname(os.path.dirname(_HERE))
|
||||
-TORCH_LIB_PATH = os.path.join(_TORCH_PATH, 'lib')
|
||||
+TORCH_LIB_PATH = os.path.join(_TORCH_PATH, '../../../@TARGET_TRIPLET@', 'lib')
|
||||
|
||||
|
||||
SUBPROCESS_DECODE_ARGS = ('oem',) if IS_WINDOWS else ()
|
@ -1,61 +0,0 @@
|
||||
diff --git a/c10/util/Logging.cpp b/c10/util/Logging.cpp
|
||||
index fe74e49..06e09d6 100644
|
||||
--- a/c10/util/Logging.cpp
|
||||
+++ b/c10/util/Logging.cpp
|
||||
@@ -4,7 +4,7 @@
|
||||
#ifdef FBCODE_CAFFE2
|
||||
#include <folly/synchronization/SanitizeThread.h>
|
||||
#endif
|
||||
-
|
||||
+#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@@ -192,23 +194,13 @@ C10_DEFINE_int(
|
||||
google::GLOG_WARNING,
|
||||
"The minimum log level that caffe2 will output.");
|
||||
|
||||
-// Google glog's api does not have an external function that allows one to check
|
||||
-// if glog is initialized or not. It does have an internal function - so we are
|
||||
-// declaring it here. This is a hack but has been used by a bunch of others too
|
||||
-// (e.g. Torch).
|
||||
-namespace google {
|
||||
-namespace glog_internal_namespace_ {
|
||||
-bool IsGoogleLoggingInitialized();
|
||||
-} // namespace glog_internal_namespace_
|
||||
-} // namespace google
|
||||
-
|
||||
namespace c10 {
|
||||
namespace {
|
||||
|
||||
void initGoogleLogging(char const* name) {
|
||||
#if !defined(_MSC_VER)
|
||||
// This trick can only be used on UNIX platforms
|
||||
- if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized())
|
||||
+ if (!::google::IsGoogleLoggingInitialized())
|
||||
#endif
|
||||
{
|
||||
::google::InitGoogleLogging(name);
|
||||
diff --git a/c10/util/Logging.cpp b/c10/util/Logging.cpp
|
||||
index 1864f17..b958fa0 100644
|
||||
--- a/c10/util/Logging.cpp
|
||||
+++ b/c10/util/Logging.cpp
|
||||
@@ -154,18 +154,6 @@ void setLogLevelFlagFromEnv();
|
||||
} // namespace detail
|
||||
} // namespace c10
|
||||
|
||||
-#if defined(C10_USE_GFLAGS) && defined(C10_USE_GLOG)
|
||||
-// When GLOG depends on GFLAGS, these variables are being defined in GLOG
|
||||
-// directly via the GFLAGS definition, so we will use DECLARE_* to declare
|
||||
-// them, and use them in Caffe2.
|
||||
-// GLOG's minloglevel
|
||||
-DECLARE_int32(minloglevel);
|
||||
-// GLOG's verbose log value.
|
||||
-DECLARE_int32(v);
|
||||
-// GLOG's logtostderr value
|
||||
-DECLARE_bool(logtostderr);
|
||||
-#endif // defined(C10_USE_GFLAGS) && defined(C10_USE_GLOG)
|
||||
-
|
||||
#if !defined(C10_USE_GLOG)
|
||||
// This backward compatibility flags are in order to deal with cases where
|
||||
// Caffe2 are not built with glog, but some init flags still pass in these
|
@ -1,142 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4bf1e85..48b01ae 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -693,7 +693,7 @@ endif()
|
||||
|
||||
set(BUILD_ONEDNN_GRAPH OFF)
|
||||
|
||||
-include(cmake/Dependencies.cmake)
|
||||
+include(cmake/vcpkg-dependencies.cmake)
|
||||
|
||||
if(USE_CUDA AND (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.2) AND (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows"))
|
||||
# CUDA < 10.2 doesn't support compiling and extracting header dependencies in
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 48b01ae..8e46275 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -660,7 +660,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
# The below means we are cross compiling for arm64 or x86_64 on MacOSX
|
||||
-if(NOT IOS AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64|arm64)$")
|
||||
+if(false)
|
||||
set(CROSS_COMPILING_MACOSX TRUE)
|
||||
# We need to compile a universal protoc to not fail protobuf build
|
||||
# We set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY (vs executable) to succeed the cmake compiler check for cross-compiling
|
||||
@@ -678,6 +678,7 @@ if(NOT IOS AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_ARCHITECTURES M
|
||||
set(PROTOBUF_PROTOC_EXECUTABLE "${PROJECT_SOURCE_DIR}/build_host_protoc/bin/protoc")
|
||||
set(CAFFE2_CUSTOM_PROTOC_EXECUTABLE "${PROJECT_SOURCE_DIR}/build_host_protoc/bin/protoc")
|
||||
endif()
|
||||
+include(cmake/ProtoBuf.cmake)
|
||||
|
||||
# ---[ Misc checks to cope with various compiler modes
|
||||
include(cmake/MiscCheck.cmake)
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 328210c..c407442 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -112,13 +112,8 @@ endif()
|
||||
# addressed yet.
|
||||
|
||||
if(NOT MSVC AND USE_XNNPACK)
|
||||
- if(NOT TARGET fxdiv)
|
||||
- set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
|
||||
- set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
- add_subdirectory(
|
||||
- "${FXDIV_SOURCE_DIR}"
|
||||
- "${CMAKE_BINARY_DIR}/FXdiv")
|
||||
- endif()
|
||||
+ find_path(FXDIV_INCLUDE_DIRS "fxdiv.h" REQUIRED)
|
||||
+ include_directories(${FXDIV_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
add_subdirectory(core)
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index c407442..16fa898 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -1011,10 +1011,6 @@ if(USE_CUDA OR USE_ROCM)
|
||||
include(${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/nvfuser.cmake)
|
||||
endif()
|
||||
|
||||
-if(NOT MSVC AND USE_XNNPACK)
|
||||
- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
|
||||
-endif()
|
||||
-
|
||||
# ==========================================================
|
||||
# formerly-libtorch flags
|
||||
# ==========================================================
|
||||
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt
|
||||
index 41b1a1a..3b390ec 100644
|
||||
--- a/c10/CMakeLists.txt
|
||||
+++ b/c10/CMakeLists.txt
|
||||
@@ -110,7 +110,11 @@ endif()
|
||||
# Note: for now, we will put all export path into one single Caffe2Targets group
|
||||
# to deal with the cmake deployment need. Inside the Caffe2Targets set, the
|
||||
# individual libraries like libc10.so and libcaffe2.so are still self-contained.
|
||||
-install(TARGETS c10 EXPORT Caffe2Targets DESTINATION lib)
|
||||
+install(TARGETS c10 EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 16fa898..7a343f7 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -1547,7 +1547,11 @@ endif()
|
||||
|
||||
caffe2_interface_library(torch torch_library)
|
||||
|
||||
-install(TARGETS torch_cpu torch_cpu_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+install(TARGETS torch_cpu torch_cpu_library EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+)
|
||||
|
||||
if(USE_CUDA)
|
||||
install(TARGETS torch_cuda torch_cuda_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
@@ -1558,7 +1562,11 @@ if(USE_CUDA)
|
||||
elseif(USE_ROCM)
|
||||
install(TARGETS torch_hip torch_hip_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
endif()
|
||||
-install(TARGETS torch torch_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+install(TARGETS torch torch_library EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+)
|
||||
|
||||
target_link_libraries(torch PUBLIC torch_cpu_library)
|
||||
|
||||
@@ -1688,7 +1696,11 @@ if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(torch_global_deps TBB::tbb)
|
||||
endif()
|
||||
|
||||
- install(TARGETS torch_global_deps DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS torch_global_deps
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ )
|
||||
endif()
|
||||
|
||||
# ---[ Caffe2 HIP sources.
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 7a343f7..3390f9b 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -1673,7 +1673,7 @@ target_link_libraries(torch_cpu PRIVATE flatbuffers)
|
||||
# namespaces, so libtorch is loaded with all its dependencies in a local scope.
|
||||
# That usually leads to missing symbol errors at run-time, so to avoid a situation like
|
||||
# this we have to preload those libs in a global namespace.
|
||||
-if(BUILD_SHARED_LIBS)
|
||||
+if(BUILD_SHARED_LIBS AND (NOT WIN32))
|
||||
add_library(torch_global_deps SHARED ${TORCH_SRC_DIR}/csrc/empty.c)
|
||||
if(HAVE_SOVERSION)
|
||||
set_target_properties(torch_global_deps PROPERTIES
|
@ -1,32 +0,0 @@
|
||||
diff --git a/aten/src/ATen/native/quantized/cpu/qembeddingbag_prepack.cpp b/aten/src/ATen/native/quantized/cpu/qembeddingbag_prepack.cpp
|
||||
index 224a66f..eb42317 100644
|
||||
--- a/aten/src/ATen/native/quantized/cpu/qembeddingbag_prepack.cpp
|
||||
+++ b/aten/src/ATen/native/quantized/cpu/qembeddingbag_prepack.cpp
|
||||
@@ -8,7 +8,10 @@
|
||||
#include <torch/library.h>
|
||||
|
||||
#include <c10/util/irange.h>
|
||||
-
|
||||
+#ifdef USE_FBGEMM
|
||||
+#include <fbgemm/Fbgemm.h>
|
||||
+#include <fbgemm/FbgemmEmbedding.h>
|
||||
+#endif
|
||||
int register_embedding_params();
|
||||
|
||||
/*
|
||||
diff --git a/aten/src/ATen/native/quantized/cpu/qembeddingbag_unpack.cpp b/aten/src/ATen/native/quantized/cpu/qembeddingbag_unpack.cpp
|
||||
index f94d27b..299b88b 100644
|
||||
--- a/aten/src/ATen/native/quantized/cpu/qembeddingbag_unpack.cpp
|
||||
+++ b/aten/src/ATen/native/quantized/cpu/qembeddingbag_unpack.cpp
|
||||
@@ -4,7 +4,10 @@
|
||||
#include <ATen/native/quantized/cpu/fbgemm_utils.h>
|
||||
#include <c10/util/irange.h>
|
||||
#include <torch/library.h>
|
||||
-
|
||||
+#ifdef USE_FBGEMM
|
||||
+#include <fbgemm/Fbgemm.h>
|
||||
+#include <fbgemm/FbgemmEmbedding.h>
|
||||
+#endif
|
||||
int register_embedding_params();
|
||||
|
||||
at::Tensor PackedEmbeddingBagWeight::unpack() {
|
30
ports/libtorch/fix-glog.patch
Normal file
30
ports/libtorch/fix-glog.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/c10/util/Logging.cpp b/c10/util/Logging.cpp
|
||||
index ff8e1d6cc..306dac51f 100644
|
||||
--- a/c10/util/Logging.cpp
|
||||
+++ b/c10/util/Logging.cpp
|
||||
@@ -218,24 +218,11 @@ C10_DEFINE_int(
|
||||
google::GLOG_WARNING,
|
||||
"The minimum log level that caffe2 will output.");
|
||||
|
||||
-// Google glog's api does not have an external function that allows one to check
|
||||
-// if glog is initialized or not. It does have an internal function - so we are
|
||||
-// declaring it here. This is a hack but has been used by a bunch of others too
|
||||
-// (e.g. Torch).
|
||||
-namespace google {
|
||||
-namespace glog_internal_namespace_ {
|
||||
-bool IsGoogleLoggingInitialized();
|
||||
-} // namespace glog_internal_namespace_
|
||||
-} // namespace google
|
||||
-
|
||||
namespace c10 {
|
||||
namespace {
|
||||
|
||||
void initGoogleLogging(char const* name) {
|
||||
-#if !defined(_MSC_VER)
|
||||
- // This trick can only be used on UNIX platforms
|
||||
- if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized())
|
||||
-#endif
|
||||
+ if (!::google::IsGoogleLoggingInitialized())
|
||||
{
|
||||
::google::InitGoogleLogging(name);
|
||||
#if !defined(_MSC_VER)
|
@ -1,15 +1,15 @@
|
||||
diff --git a/aten/src/ATen/cpu/vec/vec_base.h b/aten/src/ATen/cpu/vec/vec_base.h
|
||||
index 635ec8c82e5d..1974d55943b3 100644
|
||||
--- a/aten/src/ATen/cpu/vec/vec_base.h
|
||||
index f68e9c6eb..c42a9b8bb 100644
|
||||
--- a/aten/src/ATen/cpu/vec/vec_base.h
|
||||
+++ b/aten/src/ATen/cpu/vec/vec_base.h
|
||||
@@ -132,8 +132,9 @@ struct Vectorized {
|
||||
@@ -150,9 +150,8 @@ public:
|
||||
// versions GCC/Clang have buggy determinations on whether or not an
|
||||
// identifier is odr-used or not, and in any case it's hard to tell if
|
||||
// a variable is odr-used or not. So best to just cut the problem at the root.
|
||||
+ static constexpr size_type size_T = sizeof(T); // Workaround to compile with VS2022.
|
||||
- static constexpr size_type size_T = sizeof(T); // Workaround to compile with VS2022.
|
||||
static constexpr size_type size() {
|
||||
- return VECTOR_WIDTH / sizeof(T);
|
||||
+ return VECTOR_WIDTH / size_T;
|
||||
- return VECTOR_WIDTH / size_T;
|
||||
+ return VECTOR_WIDTH / sizeof(T);
|
||||
}
|
||||
Vectorized() : values{static_cast<T>(0)} {}
|
||||
Vectorized(T val) {
|
13
ports/libtorch/fix-onnx-case.patch
Normal file
13
ports/libtorch/fix-onnx-case.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
|
||||
index 8c1742591..a2ca73b6e 100644
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -1581,7 +1581,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
|
||||
target_compile_options(onnx PRIVATE -Wno-deprecated-declarations)
|
||||
endif()
|
||||
else()
|
||||
- find_package(onnx REQUIRED)
|
||||
+ find_package(ONNX REQUIRED)
|
||||
set(ONNX_LIBRARY onnx)
|
||||
set(ONNX_PROTO_LIBRARY onnx_proto)
|
||||
message("-- Found onnx")
|
22
ports/libtorch/fix-sleef.patch
Normal file
22
ports/libtorch/fix-sleef.patch
Normal file
@ -0,0 +1,22 @@
|
||||
diff --git a/aten/src/ATen/CMakeLists.txt b/aten/src/ATen/CMakeLists.txt
|
||||
index f3281d3cb..c8b6ed30e 100644
|
||||
--- a/aten/src/ATen/CMakeLists.txt
|
||||
+++ b/aten/src/ATen/CMakeLists.txt
|
||||
@@ -418,7 +418,7 @@ if(NOT MSVC AND NOT EMSCRIPTEN AND NOT INTERN_BUILD_MOBILE)
|
||||
list(APPEND ATen_THIRD_PARTY_INCLUDE ${CMAKE_BINARY_DIR}/include)
|
||||
link_directories(${CMAKE_BINARY_DIR}/sleef/lib)
|
||||
else()
|
||||
- add_library(sleef SHARED IMPORTED)
|
||||
+ add_library(sleef UNKNOWN IMPORTED)
|
||||
find_library(SLEEF_LIBRARY sleef)
|
||||
if(NOT SLEEF_LIBRARY)
|
||||
message(FATAL_ERROR "Cannot find sleef")
|
||||
@@ -426,7 +426,7 @@ if(NOT MSVC AND NOT EMSCRIPTEN AND NOT INTERN_BUILD_MOBILE)
|
||||
message("Found sleef: ${SLEEF_LIBRARY}")
|
||||
set_target_properties(sleef PROPERTIES IMPORTED_LOCATION "${SLEEF_LIBRARY}")
|
||||
endif()
|
||||
- list(APPEND ATen_CPU_DEPENDENCY_LIBS sleef)
|
||||
+ list(APPEND ATen_CPU_DEPENDENCY_LIBS ${SLEEF_LIBRARY})
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG ${OLD_CMAKE_C_FLAGS_DEBUG})
|
||||
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
|
@ -1,100 +0,0 @@
|
||||
diff --git a/torch/csrc/jit/tensorexpr/bounds_overlap.h b/torch/csrc/jit/tensorexpr/bounds_overlap.h
|
||||
index c78884d..baf44bb 100644
|
||||
--- a/torch/csrc/jit/tensorexpr/bounds_overlap.h
|
||||
+++ b/torch/csrc/jit/tensorexpr/bounds_overlap.h
|
||||
@@ -65,6 +65,10 @@ enum OverlapKind { ContainedOrEqual, Contains, PartialOverlap, NoOverlap };
|
||||
// operator
|
||||
// NOT_DETERMINED: Some elements satify the given comparison operator and
|
||||
// some elements not
|
||||
+#if defined(_WIN32)
|
||||
+#undef TRUE
|
||||
+#undef FALSE
|
||||
+#endif
|
||||
enum CmpEvalResult { TRUE, FALSE, NOT_DETERMINED };
|
||||
|
||||
// Returns the kind of overlap between Bound A and Bound A in a single
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 3390f9b..578d0bd 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -1425,7 +1425,7 @@ target_include_directories(torch_cpu SYSTEM PRIVATE "${Caffe2_DEPENDENCY_INCLUDE
|
||||
torch_set_target_props(torch_cpu)
|
||||
|
||||
|
||||
-target_compile_options(torch_cpu PRIVATE "-DCAFFE2_BUILD_MAIN_LIB")
|
||||
+target_compile_definitions(torch_cpu PRIVATE CAFFE2_BUILD_MAIN_LIB)
|
||||
if(BUILD_SPLIT_CUDA)
|
||||
target_compile_options(torch_cuda_cu PRIVATE "-DTORCH_CUDA_CU_BUILD_MAIN_LIB")
|
||||
target_compile_options(torch_cuda_cpp PRIVATE "-DTORCH_CUDA_CPP_BUILD_MAIN_LIB")
|
||||
@@ -1525,12 +1525,12 @@ if(MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
#
|
||||
# NB: This must be target_compile_definitions, not target_compile_options,
|
||||
# as the latter is not respected by nvcc
|
||||
- target_compile_definitions(torch_cpu PUBLIC "AT_CORE_STATIC_WINDOWS=1")
|
||||
+ target_compile_definitions(torch_cpu PUBLIC AT_CORE_STATIC_WINDOWS=1)
|
||||
endif()
|
||||
if(MSVC AND BUILD_SHARED_LIBS)
|
||||
# ONNX is linked statically and needs to be exported from this library
|
||||
# to be used externally. Make sure that references match the export.
|
||||
- target_compile_options(torch_cpu PRIVATE "-DONNX_BUILD_MAIN_LIB")
|
||||
+ target_compile_definitions(torch_cpu PRIVATE ONNX_BUILD_MAIN_LIB)
|
||||
endif()
|
||||
|
||||
caffe2_interface_library(torch_cpu torch_cpu_library)
|
||||
diff --git a/aten/src/ATen/Parallel.h b/aten/src/ATen/Parallel.h
|
||||
index 0b494d9..06b5d88 100644
|
||||
--- a/aten/src/ATen/Parallel.h
|
||||
+++ b/aten/src/ATen/Parallel.h
|
||||
@@ -28,13 +28,7 @@ TORCH_API bool in_parallel_region();
|
||||
namespace internal {
|
||||
|
||||
// Initialise num_threads lazily at first parallel call
|
||||
-inline TORCH_API void lazy_init_num_threads() {
|
||||
- thread_local bool init = false;
|
||||
- if (C10_UNLIKELY(!init)) {
|
||||
- at::init_num_threads();
|
||||
- init = true;
|
||||
- }
|
||||
-}
|
||||
+TORCH_API void lazy_init_num_threads();
|
||||
|
||||
TORCH_API void set_thread_num(int);
|
||||
|
||||
diff --git a/aten/src/ATen/ParallelCommon.cpp b/aten/src/ATen/ParallelCommon.cpp
|
||||
index 068c9d3..b869fde 100644
|
||||
--- a/aten/src/ATen/ParallelCommon.cpp
|
||||
+++ b/aten/src/ATen/ParallelCommon.cpp
|
||||
@@ -17,6 +17,17 @@
|
||||
|
||||
namespace at {
|
||||
|
||||
+namespace internal {
|
||||
+/// @see https://github.com/pytorch/pytorch/issues/87957
|
||||
+void lazy_init_num_threads() {
|
||||
+ thread_local bool init = false;
|
||||
+ if (C10_UNLIKELY(!init)) {
|
||||
+ at::init_num_threads();
|
||||
+ init = true;
|
||||
+ }
|
||||
+}
|
||||
+} // namespace internal
|
||||
+
|
||||
namespace {
|
||||
|
||||
const char* get_env_var(
|
||||
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt
|
||||
index 3b390ec..7cfa2b0 100644
|
||||
--- a/c10/CMakeLists.txt
|
||||
+++ b/c10/CMakeLists.txt
|
||||
@@ -45,7 +45,10 @@ if(HAVE_SOVERSION)
|
||||
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION})
|
||||
endif()
|
||||
# If building shared library, set dllimport/dllexport proper.
|
||||
-target_compile_options(c10 PRIVATE "-DC10_BUILD_MAIN_LIB")
|
||||
+target_compile_definitions(c10 PRIVATE C10_BUILD_MAIN_LIB)
|
||||
+if(WIN32)
|
||||
+ target_compile_definitions(c10 PRIVATE NOMINMAX)
|
||||
+endif()
|
||||
# Enable hidden visibility if compiler supports it.
|
||||
if(${COMPILER_SUPPORTS_HIDDEN_VISIBILITY})
|
||||
target_compile_options(c10 PRIVATE "-fvisibility=hidden")
|
@ -1,12 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8e46275..b505ec5 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -788,7 +788,6 @@ if(NOT MSVC)
|
||||
# Details at http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1459
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wall")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wextra")
|
||||
- string(APPEND CMAKE_CXX_FLAGS " -Werror=return-type")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-missing-field-initializers")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-type-limits")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-array-bounds")
|
44
ports/libtorch/fxdiv.patch
Normal file
44
ports/libtorch/fxdiv.patch
Normal file
@ -0,0 +1,44 @@
|
||||
diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
index d18523352..1f53945cf 100644
|
||||
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
@@ -389,12 +389,12 @@ if(NOT TARGET fxdiv AND NOT USE_SYSTEM_FXDIV)
|
||||
"${FXDIV_SOURCE_DIR}"
|
||||
"${CONFU_DEPENDENCIES_BINARY_DIR}/fxdiv")
|
||||
elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV)
|
||||
- find_file(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
|
||||
+ find_path(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
|
||||
if(NOT FXDIV_HDR)
|
||||
message(FATAL_ERROR "Cannot find fxdiv")
|
||||
endif()
|
||||
- add_library(fxdiv STATIC "${FXDIV_HDR}")
|
||||
- set_property(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
|
||||
+ add_library(fxdiv INTERFACE IMPORTED)
|
||||
+ target_include_directories(fxdiv INTERFACE "${FXDIV_HDR}")
|
||||
endif()
|
||||
target_link_libraries(pytorch_qnnpack PRIVATE fxdiv)
|
||||
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index f7a595e1b..fb315c435 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -108,11 +108,18 @@ endif()
|
||||
# addressed yet.
|
||||
|
||||
if(NOT MSVC AND USE_XNNPACK)
|
||||
- if(NOT TARGET fxdiv)
|
||||
+ if(NOT TARGET fxdiv AND NOT USE_SYSTEM_FXDIV)
|
||||
set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
|
||||
set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
add_subdirectory(
|
||||
"${FXDIV_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/FXdiv")
|
||||
+ elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV)
|
||||
+ find_path(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
|
||||
+ if(NOT FXDIV_HDR)
|
||||
+ message(FATAL_ERROR "Cannot find fxdiv")
|
||||
+ endif()
|
||||
+ add_library(fxdiv INTERFACE IMPORTED)
|
||||
+ target_include_directories(fxdiv INTERFACE "${FXDIV_HDR}")
|
||||
endif()
|
||||
endif()
|
34
ports/libtorch/kineto.patch
Normal file
34
ports/libtorch/kineto.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff --git a/libkineto/CMakeLists.txt b/libkineto/CMakeLists.txt
|
||||
index 7d36ffb9d4..8f97998114 100644
|
||||
--- a/libkineto/CMakeLists.txt
|
||||
+++ b/libkineto/CMakeLists.txt
|
||||
@@ -111,27 +111,8 @@ endif()
|
||||
target_compile_options(kineto_base PRIVATE "${KINETO_COMPILE_OPTIONS}")
|
||||
target_compile_options(kineto_api PRIVATE "${KINETO_COMPILE_OPTIONS}")
|
||||
|
||||
-if(NOT TARGET fmt)
|
||||
- if(NOT FMT_SOURCE_DIR)
|
||||
- set(FMT_SOURCE_DIR "${LIBKINETO_THIRDPARTY_DIR}/fmt"
|
||||
- CACHE STRING "fmt source directory from submodules")
|
||||
- endif()
|
||||
-
|
||||
- # Build FMT.
|
||||
- # FMT and some other libraries use BUILD_SHARED_LIBS to control
|
||||
- # the library type.
|
||||
- # Save and restore the value after configuring FMT
|
||||
- set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||
- set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
|
||||
- set(FMT_LIBRARY_TYPE static CACHE STRING "Set lib type to static")
|
||||
- add_subdirectory("${FMT_SOURCE_DIR}" "${LIBKINETO_BINARY_DIR}/fmt")
|
||||
- set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
- set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE)
|
||||
-endif()
|
||||
-
|
||||
-set(FMT_INCLUDE_DIR "${FMT_SOURCE_DIR}/include")
|
||||
-message(STATUS "Kineto: FMT_SOURCE_DIR = ${FMT_SOURCE_DIR}")
|
||||
-message(STATUS "Kineto: FMT_INCLUDE_DIR = ${FMT_INCLUDE_DIR}")
|
||||
+find_package(fmt REQUIRED)
|
||||
+
|
||||
if (NOT CUPTI_INCLUDE_DIR)
|
||||
set(CUPTI_INCLUDE_DIR "${CUDA_SOURCE_DIR}/extras/CUPTI/include")
|
||||
endif()
|
@ -1,57 +0,0 @@
|
||||
diff --git a/aten/src/ATen/core/dynamic_type.h b/aten/src/ATen/core/dynamic_type.h
|
||||
index a84644ddde0..b1b6b2c9ecc 100644
|
||||
--- a/aten/src/ATen/core/dynamic_type.h
|
||||
+++ b/aten/src/ATen/core/dynamic_type.h
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
+#include <cstdint>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
diff --git a/c10/util/BFloat16.h b/c10/util/BFloat16.h
|
||||
index 1ada02bba1c..f6f9fc65e0e 100644
|
||||
--- a/c10/util/BFloat16.h
|
||||
+++ b/c10/util/BFloat16.h
|
||||
@@ -3,6 +3,7 @@
|
||||
// Defines the bloat16 type (brain floating-point). This representation uses
|
||||
// 1 bit for the sign, 8 bits for the exponent and 7 bits for the mantissa.
|
||||
|
||||
+#include <cstdint>
|
||||
#include <c10/macros/Macros.h>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
diff --git a/torch/csrc/jit/passes/quantization/quantization_type.h b/torch/csrc/jit/passes/quantization/quantization_type.h
|
||||
index ea5ca10b15a..c704f9c3037 100644
|
||||
--- a/torch/csrc/jit/passes/quantization/quantization_type.h
|
||||
+++ b/torch/csrc/jit/passes/quantization/quantization_type.h
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <ostream>
|
||||
+#include <cstdint>
|
||||
|
||||
namespace torch {
|
||||
namespace jit {
|
||||
diff --git a/torch/csrc/jit/runtime/logging.cpp b/torch/csrc/jit/runtime/logging.cpp
|
||||
index 66712990368..b326f587bc8 100644
|
||||
--- a/torch/csrc/jit/runtime/logging.cpp
|
||||
+++ b/torch/csrc/jit/runtime/logging.cpp
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <torch/csrc/jit/runtime/logging.h>
|
||||
|
||||
#include <atomic>
|
||||
+#include <stdexcept>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
diff --git a/torch/csrc/lazy/core/multi_wait.cpp b/torch/csrc/lazy/core/multi_wait.cpp
|
||||
index 6b9933518e0..db0742b32a3 100644
|
||||
--- a/torch/csrc/lazy/core/multi_wait.cpp
|
||||
+++ b/torch/csrc/lazy/core/multi_wait.cpp
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <torch/csrc/lazy/core/multi_wait.h>
|
||||
|
||||
+#include <stdexcept>
|
||||
#include <chrono>
|
||||
#include <exception>
|
||||
|
351
ports/libtorch/more-fixes.patch
Normal file
351
ports/libtorch/more-fixes.patch
Normal file
@ -0,0 +1,351 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7b8bc7cb6e..fa6da328b8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -383,7 +383,7 @@ if(WIN32)
|
||||
NAMES uv libuv
|
||||
HINTS $ENV{CONDA_PREFIX}\\Library $ENV{PREFIX}\\Library
|
||||
PATH_SUFFIXES lib
|
||||
- NO_DEFAULT_PATH)
|
||||
+ )
|
||||
if(NOT libuv_tmp_LIBRARY)
|
||||
set(USE_DISTRIBUTED OFF)
|
||||
set(USE_GLOO OFF)
|
||||
@@ -1151,10 +1151,6 @@ if(BUILD_SHARED_LIBS)
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules_CUDA_fix
|
||||
DESTINATION share/cmake/Caffe2/
|
||||
COMPONENT dev)
|
||||
- install(FILES
|
||||
- ${PROJECT_SOURCE_DIR}/cmake/Modules/FindCUDAToolkit.cmake
|
||||
- DESTINATION share/cmake/Caffe2/
|
||||
- COMPONENT dev)
|
||||
install(FILES
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/FindCUSPARSELT.cmake
|
||||
DESTINATION share/cmake/Caffe2/
|
||||
diff --git a/aten/src/ATen/native/vulkan/api/Allocator.h b/aten/src/ATen/native/vulkan/api/Allocator.h
|
||||
index d0c8bdf9ec..50df97ae09 100644
|
||||
--- a/aten/src/ATen/native/vulkan/api/Allocator.h
|
||||
+++ b/aten/src/ATen/native/vulkan/api/Allocator.h
|
||||
@@ -47,7 +47,7 @@
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#endif /* __clang__ */
|
||||
|
||||
-#include <include/vk_mem_alloc.h>
|
||||
+#include <vk_mem_alloc.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
diff --git a/aten/src/ATen/native/vulkan/ops/Clamp.cpp b/aten/src/ATen/native/vulkan/ops/Clamp.cpp
|
||||
index dc22b987ef..f91fbf6788 100644
|
||||
--- a/aten/src/ATen/native/vulkan/ops/Clamp.cpp
|
||||
+++ b/aten/src/ATen/native/vulkan/ops/Clamp.cpp
|
||||
@@ -1,3 +1,6 @@
|
||||
+#define _USE_MATH_DEFINES
|
||||
+#include <cmath>
|
||||
+
|
||||
#include <ATen/native/vulkan/ops/Common.h>
|
||||
#include <torch/library.h>
|
||||
|
||||
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt
|
||||
index ad407e18cb..bbca41bab2 100644
|
||||
--- a/c10/CMakeLists.txt
|
||||
+++ b/c10/CMakeLists.txt
|
||||
@@ -139,7 +139,11 @@ endif()
|
||||
# Note: for now, we will put all export path into one single Caffe2Targets group
|
||||
# to deal with the cmake deployment need. Inside the Caffe2Targets set, the
|
||||
# individual libraries like libc10.so and libcaffe2.so are still self-contained.
|
||||
-install(TARGETS c10 EXPORT Caffe2Targets DESTINATION lib)
|
||||
+install(TARGETS c10 EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ )
|
||||
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 74d0d55719..cf349c2fa8 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -632,7 +632,11 @@ if(USE_CUDA)
|
||||
|
||||
target_link_libraries(caffe2_nvrtc ${CUDA_NVRTC} ${CUDA_CUDA_LIB} ${CUDA_NVRTC_LIB} ${DELAY_LOAD_FLAGS})
|
||||
target_include_directories(caffe2_nvrtc PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||
- install(TARGETS caffe2_nvrtc DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS caffe2_nvrtc
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ )
|
||||
if(USE_NCCL)
|
||||
list(APPEND Caffe2_GPU_SRCS
|
||||
${TORCH_SRC_DIR}/csrc/cuda/nccl.cpp)
|
||||
@@ -694,7 +698,11 @@ if(USE_ROCM)
|
||||
add_library(caffe2_nvrtc SHARED ${ATen_NVRTC_STUB_SRCS})
|
||||
target_link_libraries(caffe2_nvrtc ${PYTORCH_HIP_HCC_LIBRARIES} ${ROCM_HIPRTC_LIB})
|
||||
target_compile_definitions(caffe2_nvrtc PRIVATE USE_ROCM __HIP_PLATFORM_HCC__)
|
||||
- install(TARGETS caffe2_nvrtc DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS caffe2_nvrtc
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ )
|
||||
endif()
|
||||
|
||||
if(NOT NO_API AND NOT BUILD_LITE_INTERPRETER)
|
||||
@@ -1013,7 +1021,11 @@ elseif(USE_CUDA)
|
||||
CUDA::culibos ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../aten/src/ATen/native/cuda/LinearAlgebraStubs.cpp PROPERTIES COMPILE_FLAGS "-DBUILD_LAZY_CUDA_LINALG")
|
||||
- install(TARGETS torch_cuda_linalg DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS torch_cuda_linalg
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ )
|
||||
endif()
|
||||
|
||||
if(USE_PRECOMPILED_HEADERS)
|
||||
@@ -1475,14 +1487,26 @@ endif()
|
||||
|
||||
caffe2_interface_library(torch torch_library)
|
||||
|
||||
-install(TARGETS torch_cpu torch_cpu_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+install(TARGETS torch_cpu torch_cpu_library EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
|
||||
if(USE_CUDA)
|
||||
- install(TARGETS torch_cuda torch_cuda_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS torch_cuda torch_cuda_library EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
elseif(USE_ROCM)
|
||||
- install(TARGETS torch_hip torch_hip_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS torch_hip torch_hip_library EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
endif()
|
||||
-install(TARGETS torch torch_library EXPORT Caffe2Targets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+install(TARGETS torch torch_library EXPORT Caffe2Targets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
|
||||
target_link_libraries(torch PUBLIC torch_cpu_library)
|
||||
|
||||
@@ -1499,11 +1523,11 @@ endif()
|
||||
|
||||
# Install PDB files for MSVC builds
|
||||
if(MSVC AND BUILD_SHARED_LIBS)
|
||||
- install(FILES $<TARGET_PDB_FILE:torch_cpu> DESTINATION "${TORCH_INSTALL_LIB_DIR}" OPTIONAL)
|
||||
+ install(FILES $<TARGET_PDB_FILE:torch_cpu> DESTINATION "${TORCH_INSTALL_BIN_DIR}" OPTIONAL)
|
||||
if(USE_CUDA)
|
||||
- install(FILES $<TARGET_PDB_FILE:torch_cuda> DESTINATION "${TORCH_INSTALL_LIB_DIR}" OPTIONAL)
|
||||
+ install(FILES $<TARGET_PDB_FILE:torch_cuda> DESTINATION "${TORCH_INSTALL_BIN_DIR}" OPTIONAL)
|
||||
elseif(USE_ROCM)
|
||||
- install(FILES $<TARGET_PDB_FILE:torch_hip> DESTINATION "${TORCH_INSTALL_LIB_DIR}" OPTIONAL)
|
||||
+ install(FILES $<TARGET_PDB_FILE:torch_hip> DESTINATION "${TORCH_INSTALL_BIN_DIR}" OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1577,7 +1601,10 @@ if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(torch_global_deps TBB::tbb)
|
||||
endif()
|
||||
|
||||
- install(TARGETS torch_global_deps DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+ install(TARGETS torch_global_deps
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
endif()
|
||||
|
||||
# ---[ Caffe2 HIP sources.
|
||||
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
|
||||
index cd27c728ff..2c5c5b95d8 100644
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -1130,7 +1130,7 @@ if(BUILD_PYTHON)
|
||||
# Observers are required in the python build
|
||||
caffe2_update_option(USE_OBSERVERS ON)
|
||||
else()
|
||||
- message(WARNING "Python dependencies not met. Not compiling with python. Suppress this warning with -DBUILD_PYTHON=OFF")
|
||||
+ message(FATAL_ERROR "Python dependencies not met. Not compiling with python. Suppress this warning with -DBUILD_PYTHON=OFF")
|
||||
caffe2_update_option(BUILD_PYTHON OFF)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1234,7 +1234,7 @@ endif()
|
||||
# ---[ LLVM
|
||||
if(USE_LLVM)
|
||||
message(STATUS "Looking for LLVM in ${USE_LLVM}")
|
||||
- find_package(LLVM PATHS ${USE_LLVM} NO_DEFAULT_PATH)
|
||||
+ find_package(LLVM)
|
||||
|
||||
if(LLVM_FOUND)
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
@@ -1248,6 +1248,8 @@ endif(USE_LLVM)
|
||||
# ---[ cuDNN
|
||||
if(USE_CUDNN)
|
||||
find_package(CUDNN REQUIRED)
|
||||
+ set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include)
|
||||
+ target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR})
|
||||
target_include_directories(torch::cudnn INTERFACE "${CUDNN_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/Modules/FindCUSPARSELT.cmake b/cmake/Modules/FindCUSPARSELT.cmake
|
||||
index 8727f44a90..1e41281b1b 100644
|
||||
--- a/cmake/Modules/FindCUSPARSELT.cmake
|
||||
+++ b/cmake/Modules/FindCUSPARSELT.cmake
|
||||
@@ -24,13 +24,13 @@ list(APPEND CMAKE_PREFIX_PATH ${CUSPARSELT_ROOT})
|
||||
set(CUSPARSELT_INCLUDE_DIR $ENV{CUSPARSELT_INCLUDE_DIR} CACHE PATH "Folder containing NVIDIA cuSPARSELt header files")
|
||||
|
||||
find_path(CUSPARSELT_INCLUDE_PATH cusparseLt.h
|
||||
- HINTS ${CUSPARSELT_INCLUDE_DIR}
|
||||
+ HINTS ${CUSPARSELT_INCLUDE_DIR} ENV CUDA_PATH
|
||||
PATH_SUFFIXES cuda/include cuda include)
|
||||
|
||||
set(CUSPARSELT_LIBRARY $ENV{CUSPARSELT_LIBRARY} CACHE PATH "Path to the cusparselt library file (e.g., libcusparseLt.so)")
|
||||
|
||||
-find_library(CUSPARSELT_LIBRARY_PATH libcusparseLt.so
|
||||
- PATHS ${CUSPARSELT_LIBRARY}
|
||||
+find_library(CUSPARSELT_LIBRARY_PATH cusparseLt
|
||||
+ PATHS ${CUSPARSELT_LIBRARY} ENV CUDA_PATH
|
||||
PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)
|
||||
|
||||
find_package_handle_standard_args(CUSPARSELT DEFAULT_MSG CUSPARSELT_LIBRARY_PATH CUSPARSELT_INCLUDE_PATH)
|
||||
diff --git a/cmake/Modules/FindMAGMA.cmake b/cmake/Modules/FindMAGMA.cmake
|
||||
index d2bff53d9b..3af9012503 100644
|
||||
--- a/cmake/Modules/FindMAGMA.cmake
|
||||
+++ b/cmake/Modules/FindMAGMA.cmake
|
||||
@@ -30,18 +30,13 @@ FIND_PATH(MAGMA_INCLUDE_DIR magma.h
|
||||
HINTS $ENV{MAGMA_HOME} /usr/local/magma
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
-IF (MAGMA_LIBRARIES)
|
||||
- SET(MAGMA_FOUND TRUE)
|
||||
-ELSE (MAGMA_LIBRARIES)
|
||||
- SET(MAGMA_FOUND FALSE)
|
||||
-ENDIF (MAGMA_LIBRARIES)
|
||||
-
|
||||
-add_library(torch::magma INTERFACE IMPORTED)
|
||||
-set_property(TARGET torch::magma
|
||||
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}")
|
||||
-set_property(TARGET torch::magma
|
||||
- PROPERTY INTERFACE_LINK_LIBRARIES "${MAGMA_LIBRARIES}")
|
||||
-
|
||||
+if(NOT TARGET torch::magma)
|
||||
+ add_library(torch::magma INTERFACE IMPORTED)
|
||||
+ set_property(TARGET torch::magma
|
||||
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}")
|
||||
+ set_property(TARGET torch::magma
|
||||
+ PROPERTY INTERFACE_LINK_LIBRARIES "${MAGMA_LIBRARIES}")
|
||||
+endif()
|
||||
# Check for Magma V2
|
||||
include(CheckPrototypeDefinition)
|
||||
check_prototype_definition(magma_get_sgeqrf_nb
|
||||
@@ -53,3 +48,5 @@ if(MAGMA_V2)
|
||||
set_property(TARGET torch::magma
|
||||
PROPERTY INTERFACE_COMPILE_DEFINITIONS "MAGMA_V2")
|
||||
endif(MAGMA_V2)
|
||||
+
|
||||
+find_package_handle_standard_args(MAGMA REQUIRED_VARS MAGMA_INCLUDE_DIR MAGMA_LIBRARIES)
|
||||
\ No newline at end of file
|
||||
diff --git a/test/cpp/jit/CMakeLists.txt b/test/cpp/jit/CMakeLists.txt
|
||||
index 2376f1bc43..a8ae4367fd 100644
|
||||
--- a/test/cpp/jit/CMakeLists.txt
|
||||
+++ b/test/cpp/jit/CMakeLists.txt
|
||||
@@ -124,7 +124,7 @@ endif()
|
||||
set(JIT_TEST_DEPENDENCIES torch gtest jitbackend_test backend_with_compiler)
|
||||
|
||||
if(MSVC)
|
||||
- list(APPEND JIT_TEST_DEPENDENCIES onnx_library)
|
||||
+ list(APPEND JIT_TEST_DEPENDENCIES onnx)
|
||||
endif(MSVC)
|
||||
|
||||
target_link_libraries(test_jit PRIVATE ${JIT_TEST_DEPENDENCIES})
|
||||
diff --git a/third_party/nvfuser/CMakeLists.txt b/third_party/nvfuser/CMakeLists.txt
|
||||
index b148418af0..7b96083893 100644
|
||||
--- a/third_party/nvfuser/CMakeLists.txt
|
||||
+++ b/third_party/nvfuser/CMakeLists.txt
|
||||
@@ -158,7 +158,10 @@ endif()
|
||||
target_include_directories(${NVFUSER_CODEGEN}
|
||||
PUBLIC $<BUILD_INTERFACE:${NVFUSER_SRCS_DIR}>)
|
||||
set_property(TARGET ${NVFUSER_CODEGEN} PROPERTY CXX_STANDARD 17)
|
||||
-install(TARGETS ${NVFUSER_CODEGEN} EXPORT NvfuserTargets DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+install(TARGETS ${NVFUSER_CODEGEN} EXPORT NvfuserTargets
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
# installing nvfuser python tests
|
||||
install(DIRECTORY "${NVFUSER_ROOT}/python_tests/"
|
||||
DESTINATION "${TORCH_ROOT}/test/_nvfuser"
|
||||
diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt
|
||||
index 62ee4c12a9..f75073cf3c 100644
|
||||
--- a/torch/CMakeLists.txt
|
||||
+++ b/torch/CMakeLists.txt
|
||||
@@ -107,7 +107,7 @@ set(TORCH_PYTHON_LINK_FLAGS "")
|
||||
|
||||
if(MSVC)
|
||||
string(APPEND TORCH_PYTHON_LINK_FLAGS " /NODEFAULTLIB:LIBCMT.LIB")
|
||||
- list(APPEND TORCH_PYTHON_LINK_LIBRARIES ${PYTHON_LIBRARIES} onnx_library)
|
||||
+ list(APPEND TORCH_PYTHON_LINK_LIBRARIES ${PYTHON_LIBRARIES} onnx)
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
string(APPEND TORCH_PYTHON_LINK_FLAGS " /DEBUG:FULL")
|
||||
endif()
|
||||
@@ -374,7 +374,10 @@ if(NOT TORCH_PYTHON_LINK_FLAGS STREQUAL "")
|
||||
set_target_properties(torch_python PROPERTIES LINK_FLAGS ${TORCH_PYTHON_LINK_FLAGS})
|
||||
endif()
|
||||
|
||||
-install(TARGETS torch_python DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
+install(TARGETS torch_python
|
||||
+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}"
|
||||
+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}"
|
||||
+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}")
|
||||
|
||||
# Generate torch/version.py from the appropriate CMake cache variables.
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
diff --git a/torch/csrc/cuda/shared/nvtx.cpp b/torch/csrc/cuda/shared/nvtx.cpp
|
||||
index 4fb72c5f79..1abe1b76d6 100644
|
||||
--- a/torch/csrc/cuda/shared/nvtx.cpp
|
||||
+++ b/torch/csrc/cuda/shared/nvtx.cpp
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifdef _WIN32
|
||||
#include <wchar.h> // _wgetenv for nvtx
|
||||
#endif
|
||||
-#include <nvToolsExt.h>
|
||||
+#include <nvtx3/nvToolsExt.h>
|
||||
#include <torch/csrc/utils/pybind.h>
|
||||
|
||||
namespace torch::cuda::shared {
|
||||
diff --git a/torch/csrc/jit/tensorexpr/llvm_codegen.h b/torch/csrc/jit/tensorexpr/llvm_codegen.h
|
||||
index 7ab506fa8f..2ee3b68b6b 100644
|
||||
--- a/torch/csrc/jit/tensorexpr/llvm_codegen.h
|
||||
+++ b/torch/csrc/jit/tensorexpr/llvm_codegen.h
|
||||
@@ -41,9 +41,9 @@ class TORCH_API LLVMCodeGen : public CodeGen {
|
||||
// users can continue to call this kernel using `call` and `call_raw`.
|
||||
void cleanup_memory();
|
||||
|
||||
- TORCH_API void call(const std::vector<CallArg>& args) override;
|
||||
- TORCH_API void call_raw(const std::vector<void*>& args) override;
|
||||
- TORCH_API void call_with_numel(void** args, int64_t numel) override;
|
||||
+ void call(const std::vector<CallArg>& args) override;
|
||||
+ void call_raw(const std::vector<void*>& args) override;
|
||||
+ void call_with_numel(void** args, int64_t numel) override;
|
||||
|
||||
at::Tensor empty_strided(
|
||||
c10::IntArrayRef size,
|
||||
diff --git a/torch/csrc/profiler/stubs/cuda.cpp b/torch/csrc/profiler/stubs/cuda.cpp
|
||||
index dec87576f3..3bb368a4df 100644
|
||||
--- a/torch/csrc/profiler/stubs/cuda.cpp
|
||||
+++ b/torch/csrc/profiler/stubs/cuda.cpp
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <sstream>
|
||||
|
||||
-#include <nvToolsExt.h>
|
||||
+#include <nvtx3/nvToolsExt.h>
|
||||
|
||||
#include <c10/cuda/CUDAGuard.h>
|
||||
#include <c10/util/irange.h>
|
@ -4,28 +4,67 @@ vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO pytorch/pytorch
|
||||
REF "v${VERSION}"
|
||||
SHA512 afeb551904ebd9b5901ae623a98eadbb3045115247cedf8006a940742cfad04e5ce24cfaf363336a9ed88d7ce6a4ac53dbb6a5c690aef6efdf20477c3a22c7ca
|
||||
SHA512 a8961d78ad785b13c959a0612563a60e0de17a7c8bb9822ddea9a24072796354d07e81c47b6cc8761b21a6448845b088cf80e1661d9e889b0ed5474d3dc76756
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
missing_include.patch
|
||||
pytorch-pr-85958.patch # https://github.com/pytorch/pytorch/pull/85958
|
||||
fix-cmake.patch
|
||||
fix-fbgemm-include.patch
|
||||
fix-c10-glog.patch
|
||||
use-flatbuffers2.patch # check with codegen-flatc-mobile_bytecode
|
||||
fix-windows.patch # https://github.com/pytorch/pytorch/issues/87957
|
||||
fix_werror.patch
|
||||
cmake-fixes.patch
|
||||
more-fixes.patch
|
||||
fix-build.patch
|
||||
clang-cl.patch
|
||||
cuda-adjustments.patch
|
||||
fix-api-export.patch
|
||||
fix-onnx-case.patch
|
||||
fxdiv.patch
|
||||
protoc.patch
|
||||
fix-sleef.patch
|
||||
fix-glog.patch
|
||||
fix-msvc-ICE.patch
|
||||
)
|
||||
file(REMOVE_RECURSE "${SOURCE_PATH}/caffe2/core/macros.h") # We must use generated header files
|
||||
|
||||
# Editing ${SOURCE_PATH}/cmake/Dependencies.cmake makes HORRIBLE readability...
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-dependencies.cmake" DESTINATION "${SOURCE_PATH}/cmake")
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH src_kineto
|
||||
REPO pytorch/kineto
|
||||
REF 49e854d805d916b2031e337763928d2f8d2e1fbf
|
||||
SHA512 ae63d48dc5b8ac30c38c2ace60f16834c7e9275fa342dc9f109d4fbc87b7bd674664f6413c36d0c1ab5a7da786030a4108d83daa4502b2f30239283ea3acdb16
|
||||
HEAD_REF main
|
||||
PATCHES
|
||||
kineto.patch
|
||||
)
|
||||
file(COPY "${src_kineto}/" DESTINATION "${SOURCE_PATH}/third_party/kineto")
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH src_cudnn
|
||||
REPO NVIDIA/cudnn-frontend # new port ?
|
||||
REF 12f35fa2be5994c1106367cac2fba21457b064f4
|
||||
SHA512 a7e4bf58f82ca0b767df35da1b3588e2639ea2ef22ed0c47e989fb4cde5a28b0605b228b42fcaefbdf721bfbb91f2a9e7d41352ff522bd80b63db6d27e44ec20
|
||||
HEAD_REF main
|
||||
)
|
||||
file(COPY "${src_cudnn}/" DESTINATION "${SOURCE_PATH}/third_party/cudnn_frontend")
|
||||
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH src_cutlass
|
||||
REPO NVIDIA/cutlass # new port ?
|
||||
REF 6f47420213f757831fae65c686aa471749fa8d60
|
||||
SHA512 f3b3c43fbd7942f96407669405385c9a99274290e99f86cab5bb8657664bf1951e4da27f3069500a4825c427adeec883e05e81302b58390df3a3adb8c08e31ed
|
||||
HEAD_REF main
|
||||
)
|
||||
file(COPY "${src_cutlass}/" DESTINATION "${SOURCE_PATH}/third_party/cutlass")
|
||||
|
||||
file(REMOVE
|
||||
"${SOURCE_PATH}/cmake/Modules/FindBLAS.cmake"
|
||||
"${SOURCE_PATH}/cmake/Modules/FindLAPACK.cmake"
|
||||
"${SOURCE_PATH}/cmake/Modules/FindCUDA.cmake"
|
||||
"${SOURCE_PATH}/cmake/Modules/FindCUDAToolkit.cmake"
|
||||
"${SOURCE_PATH}/cmake/Modules/Findpybind11.cmake"
|
||||
)
|
||||
|
||||
find_program(FLATC NAMES flatc PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools/flatbuffers" REQUIRED NO_DEFAULT_PATH NO_CMAKE_PATH)
|
||||
message(STATUS "Using flatc: ${FLATC}")
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${FLATC} --cpp --gen-object-api --gen-mutable mobile_bytecode.fbs
|
||||
COMMAND ${FLATC} --cpp --no-prefix --scoped-enums --gen-mutable mobile_bytecode.fbs
|
||||
LOGNAME codegen-flatc-mobile_bytecode
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}/torch/csrc/jit/serialization"
|
||||
)
|
||||
@ -38,6 +77,7 @@ x_vcpkg_get_python_packages(
|
||||
PACKAGES typing-extensions pyyaml numpy
|
||||
OUT_PYTHON_VAR PYTHON3
|
||||
)
|
||||
#set(PYTHON3 "${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
||||
message(STATUS "Using Python3: ${PYTHON3}")
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
@ -48,10 +88,11 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
fftw3 AT_FFTW_ENABLED
|
||||
fbgemm USE_FBGEMM
|
||||
opencv USE_OPENCV
|
||||
tbb USE_TBB
|
||||
tbb AT_PARALLEL_NATIVE_TBB
|
||||
openmp USE_OPENMP
|
||||
openmp AT_PARALLEL_OPENMP
|
||||
# These are alternatives !
|
||||
# tbb USE_TBB
|
||||
# tbb AT_PARALLEL_NATIVE_TBB # AT_PARALLEL_ are alternatives
|
||||
# openmp USE_OPENMP
|
||||
# openmp AT_PARALLEL_OPENMP # AT_PARALLEL_ are alternatives
|
||||
leveldb USE_LEVELDB
|
||||
opencl USE_OPENCL
|
||||
cuda USE_CUDA
|
||||
@ -61,20 +102,22 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
cuda USE_NVRTC
|
||||
cuda AT_CUDA_ENABLED
|
||||
cuda AT_CUDNN_ENABLED
|
||||
cuda USE_MAGMA
|
||||
vulkan USE_VULKAN
|
||||
vulkan USE_VULKAN_WRAPPER
|
||||
vulkan USE_VULKAN_SHADERC_RUNTIME
|
||||
#vulkan USE_VULKAN_SHADERC_RUNTIME
|
||||
vulkan USE_VULKAN_RELAXED_PRECISION
|
||||
rocm USE_ROCM # This is an alternative to cuda not a feature! (Not in vcpkg.json!) -> disabled
|
||||
llvm USE_LLVM
|
||||
mpi USE_MPI
|
||||
nnpack USE_NNPACK # todo: check use of `DISABLE_NNPACK_AND_FAMILY`
|
||||
nnpack AT_NNPACK_ENABLED
|
||||
xnnpack USE_XNNPACK
|
||||
xnnpack USE_SYSTEM_XNNPACK
|
||||
qnnpack USE_QNNPACK # todo: check use of `USE_PYTORCH_QNNPACK`
|
||||
# No feature in vcpkg yet so disabled. -> Requires numpy build by vcpkg itself
|
||||
python BUILD_PYTHON
|
||||
python USE_NUMPY
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
list(APPEND FEATURE_OPTIONS -DUSE_NATIVE_ARCH=ON)
|
||||
endif()
|
||||
if("dist" IN_LIST FEATURES)
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
|
||||
list(APPEND FEATURE_OPTIONS -DUSE_TENSORPIPE=ON)
|
||||
@ -85,20 +128,6 @@ if("dist" IN_LIST FEATURES)
|
||||
list(APPEND FEATURE_OPTIONS -DUSE_GLOO=${VCPKG_TARGET_IS_LINUX})
|
||||
endif()
|
||||
|
||||
# BLAS: MKL, OpenBLAS, or Accelerate
|
||||
# The feature will be disabled if "generic" BLAS is not found
|
||||
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
|
||||
list(APPEND BLAS_OPTIONS -DBLAS=Accelerate -DUSE_BLAS=ON)
|
||||
elseif(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(APPEND BLAS_OPTIONS -DBLAS=OpenBLAS -DUSE_BLAS=ON)
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
list(APPEND BLAS_OPTIONS -DBLAS=generic -DUSE_BLAS=ON)
|
||||
endif()
|
||||
|
||||
if("tbb" IN_LIST FEATURES)
|
||||
list(APPEND FEATURE_OPTIONS -DMKLDNN_CPU_RUNTIME=TBB)
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS)
|
||||
list(APPEND FEATURE_OPTIONS -DINTERN_BUILD_MOBILE=ON)
|
||||
else()
|
||||
@ -115,51 +144,76 @@ vcpkg_cmake_configure(
|
||||
-DProtobuf_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}
|
||||
-DCAFFE2_CUSTOM_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}
|
||||
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON3}
|
||||
-DPython3_EXECUTABLE:FILEPATH=${PYTHON3}
|
||||
#-DPython3_EXECUTABLE:FILEPATH=${PYTHON3}
|
||||
-DCAFFE2_STATIC_LINK_CUDA=ON
|
||||
-DCAFFE2_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME}
|
||||
-DBUILD_CUSTOM_PROTOBUF=OFF
|
||||
-DUSE_LITE_PROTO=OFF
|
||||
-DBUILD_TEST=OFF
|
||||
-DATEN_NO_TEST=ON
|
||||
-DUSE_SYSTEM_LIBS=ON
|
||||
-DBUILD_PYTHON=OFF
|
||||
-DUSE_NUMPY=OFF
|
||||
-DUSE_METAL=OFF
|
||||
-DUSE_PYTORCH_METAL=OFF
|
||||
-DUSE_PYTORCH_METAL_EXPORT=OFF
|
||||
-DUSE_GFLAGS=ON
|
||||
-DUSE_GLOG=ON
|
||||
-DUSE_LMDB=ON
|
||||
-DUSE_ROCKSDB=OFF
|
||||
-DUSE_OBSERVERS=OFF
|
||||
-DUSE_ITT=OFF
|
||||
-DUSE_ROCKSDB=ON
|
||||
-DUSE_OBSERVERS=OFF
|
||||
-DUSE_PYTORCH_QNNPACK=OFF
|
||||
-DUSE_KINETO=OFF
|
||||
-DUSE_ROCM=OFF
|
||||
-DUSE_DEPLOY=OFF
|
||||
-DUSE_FFTW=OFF
|
||||
-DUSE_NUMA=OFF
|
||||
-DUSE_MPI=${VCPKG_TARGET_IS_LINUX}
|
||||
-DUSE_SYSTEM_ONNX=ON
|
||||
-DUSE_SYSTEM_FP16=ON
|
||||
-DUSE_SYSTEM_EIGEN_INSTALL=ON
|
||||
-DUSE_SYSTEM_CPUINFO=ON
|
||||
-DUSE_SYSTEM_PTHREADPOOL=ON
|
||||
-DUSE_SYSTEM_PYBIND11=ON
|
||||
-DUSE_SYSTEM_ZSTD=ON
|
||||
-DUSE_SYSTEM_XNNPACK=ON
|
||||
-DUSE_SYSTEM_GLOO=ON
|
||||
-DUSE_SYSTEM_NCCL=ON
|
||||
-DUSE_SYSTEM_LIBS=ON
|
||||
-DUSE_SYSTEM_FXDIV=ON
|
||||
-DUSE_SYSTEM_SLEEF=ON
|
||||
-DBUILD_JNI=${VCPKG_TARGET_IS_ANDROID}
|
||||
-DUSE_NNAPI=${VCPKG_TARGET_IS_ANDROID}
|
||||
${BLAS_OPTIONS}
|
||||
# BLAS=MKL not supported in this port
|
||||
-DUSE_MKLDNN=OFF
|
||||
-DUSE_MKLDNN_CBLAS=OFF
|
||||
-DCAFFE2_USE_MKL=OFF
|
||||
-DCAFFE2_USE_MKLDNN=OFF
|
||||
-DAT_MKL_ENABLED=OFF
|
||||
#-DCAFFE2_USE_MKL=ON
|
||||
#-DAT_MKL_ENABLED=ON
|
||||
-DAT_MKLDNN_ENABLED=OFF
|
||||
-DUSE_OPENCL=ON
|
||||
-DUSE_NUMPY=ON
|
||||
-DUSE_KINETO=OFF #
|
||||
OPTIONS_RELEASE
|
||||
-DPYTHON_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/python311.lib
|
||||
OPTIONS_DEBUG
|
||||
-DPYTHON_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/python311_d.lib
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
USE_NUMA
|
||||
USE_SYSTEM_BIND11
|
||||
USE_VULKAN_WRAPPER
|
||||
MKLDNN_CPU_RUNTIME
|
||||
PYTHON_LIBRARY
|
||||
)
|
||||
vcpkg_cmake_build(TARGET __aten_op_header_gen LOGFILE_BASE build-header_gen) # explicit codegen is required
|
||||
vcpkg_cmake_build(TARGET torch_cpu LOGFILE_BASE build-torch_cpu)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME caffe2 CONFIG_PATH "share/cmake/Caffe2" DO_NOT_DELETE_PARENT_CONFIG_PATH)
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME torch CONFIG_PATH "share/cmake/Torch")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/torch/TorchConfig.cmake" "/../../../" "/../../")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/caffe2/Caffe2Config.cmake" "/../../../" "/../../")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/caffe2/Caffe2Config.cmake"
|
||||
"set(Caffe2_MAIN_LIBS torch_library)"
|
||||
"set(Caffe2_MAIN_LIBS torch_library)\nfind_dependency(Eigen3)")
|
||||
|
||||
|
||||
|
||||
# Traverse the folder and remove "some" empty folders
|
||||
function(cleanup_once folder)
|
||||
if(NOT IS_DIRECTORY "${folder}")
|
||||
@ -186,16 +240,37 @@ function(cleanup_repeat folder repeat)
|
||||
return()
|
||||
endif()
|
||||
while(repeat GREATER_EQUAL 1)
|
||||
math(EXPR repeat "${repeat} - 1" OUTPUT_FORMAT DECIMAL)
|
||||
math(EXPR repeat "${repeat} - 1" OUTPUT_FORMAT DECIMAL)
|
||||
cleanup_once("${folder}")
|
||||
endwhile()
|
||||
endfunction()
|
||||
|
||||
cleanup_repeat("${CURRENT_PACKAGES_DIR}/include" 5)
|
||||
cleanup_repeat("${CURRENT_PACKAGES_DIR}/lib/site-packages" 13)
|
||||
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
"${CURRENT_PACKAGES_DIR}/share/cmake/ATen"
|
||||
)
|
||||
cleanup_repeat("${CURRENT_PACKAGES_DIR}/include" 5)
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
|
||||
# Cannot build python bindings yet
|
||||
#if("python" IN_LIST FEATURES)
|
||||
# set(ENV{USE_SYSTEM_LIBS} 1)
|
||||
# vcpkg_replace_string("${SOURCE_PATH}/setup.py" "@TARGET_TRIPLET@" "${TARGET_TRIPLET}-rel")
|
||||
# vcpkg_replace_string("${SOURCE_PATH}/tools/setup_helpers/env.py" "@TARGET_TRIPLET@" "${TARGET_TRIPLET}-rel")
|
||||
# vcpkg_replace_string("${SOURCE_PATH}/torch/utils/cpp_extension.py" "@TARGET_TRIPLET@" "${TARGET_TRIPLET}-rel")
|
||||
# vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)
|
||||
#endif()
|
||||
|
||||
set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled) # torch_global_deps.dll is empty.c and just for linking deps
|
||||
|
||||
set(config "${CURRENT_PACKAGES_DIR}/share/torch/TorchConfig.cmake")
|
||||
file(READ "${config}" contents)
|
||||
string(REGEX REPLACE "set\\\(NVTOOLEXT_HOME[^)]+" "set(NVTOOLEXT_HOME \"\$ENV{CUDA_PATH}\"" contents "${contents}")
|
||||
#string(REGEX REPLACE "set\\\(NVTOOLEXT_HOME[^)]+" "set(NVTOOLEXT_HOME \"\${CMAKE_CURRENT_LIST_DIR}/../../tools/cuda/\"" contents "${contents}")
|
||||
string(REGEX REPLACE "\\\${NVTOOLEXT_HOME}/lib/x64/nvToolsExt64_1.lib" "" contents "${contents}")
|
||||
file(WRITE "${config}" "${contents}")
|
||||
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/torch/csrc/autograd/custom_function.h" "struct TORCH_API Function" "struct Function")
|
||||
|
13
ports/libtorch/protoc.patch
Normal file
13
ports/libtorch/protoc.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index fa6da328b..80bbfc6bb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -686,7 +686,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
# The below means we are cross compiling for arm64 or x86_64 on MacOSX
|
||||
-if(NOT IOS AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64|arm64)$")
|
||||
+if(0)
|
||||
set(CROSS_COMPILING_MACOSX TRUE)
|
||||
# We need to compile a universal protoc to not fail protobuf build
|
||||
# We set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY (vs executable) to succeed the cmake compiler check for cross-compiling
|
@ -1,276 +0,0 @@
|
||||
diff --git a/torch/csrc/jit/mobile/flatbuffer_loader.cpp b/torch/csrc/jit/mobile/flatbuffer_loader.cpp
|
||||
index 0e126ff..4e6048e 100644
|
||||
--- a/torch/csrc/jit/mobile/flatbuffer_loader.cpp
|
||||
+++ b/torch/csrc/jit/mobile/flatbuffer_loader.cpp
|
||||
@@ -123,29 +123,29 @@ FlatbufferLoader::FlatbufferLoader()
|
||||
: mcu_(std::make_shared<mobile::CompilationUnit>()),
|
||||
cu_(std::make_shared<CompilationUnit>()),
|
||||
ivalue_parsers_{nullptr} {
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::NONE, &parseBasic);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::Int, &parseBasic);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::Bool, &parseBasic);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::Double, &parseBasic);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_NONE, &parseBasic);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_Int, &parseBasic);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_Bool, &parseBasic);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_Double, &parseBasic);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::ComplexDouble, &parseBasic);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_ComplexDouble, &parseBasic);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::TensorMetadata, &parseTensor);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::String, &parseBasic);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::List, &parseList);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_TensorMetadata, &parseTensor);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_String, &parseBasic);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_List, &parseList);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::IntList, &parseIntList);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_IntList, &parseIntList);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::DoubleList, &parseDoubleList);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_DoubleList, &parseDoubleList);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::BoolList, &parseBoolList);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::Tuple, &parseTuple);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::Dict, &parseDict);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_BoolList, &parseBoolList);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_Tuple, &parseTuple);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_Dict, &parseDict);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::Object, &parseObject);
|
||||
- registerIValueParser(mobile::serialization::IValueUnion::Device, &parseBasic);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_Object, &parseObject);
|
||||
+ registerIValueParser(mobile::serialization::IValueUnion::IValueUnion_Device, &parseBasic);
|
||||
registerIValueParser(
|
||||
- mobile::serialization::IValueUnion::EnumValue, &parseEnum);
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_EnumValue, &parseEnum);
|
||||
internal_registerTypeResolver(&resolveType);
|
||||
}
|
||||
|
||||
@@ -334,21 +334,21 @@ IValue parseBasic(
|
||||
FlatbufferLoader&,
|
||||
const mobile::serialization::IValue& ivalue) {
|
||||
switch (ivalue.val_type()) {
|
||||
- case mobile::serialization::IValueUnion::NONE:
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_NONE:
|
||||
return {};
|
||||
- case mobile::serialization::IValueUnion::Int:
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_Int:
|
||||
return ivalue.val_as_Int()->int_val();
|
||||
- case mobile::serialization::IValueUnion::Bool:
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_Bool:
|
||||
return ivalue.val_as_Bool()->bool_val();
|
||||
- case mobile::serialization::IValueUnion::Double:
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_Double:
|
||||
return ivalue.val_as_Double()->double_val();
|
||||
- case mobile::serialization::IValueUnion::ComplexDouble: {
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_ComplexDouble: {
|
||||
const auto* comp = ivalue.val_as_ComplexDouble();
|
||||
return c10::complex<double>(comp->real(), comp->imag());
|
||||
}
|
||||
- case mobile::serialization::IValueUnion::String:
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_String:
|
||||
return ivalue.val_as_String()->data()->str();
|
||||
- case mobile::serialization::IValueUnion::Device: {
|
||||
+ case mobile::serialization::IValueUnion::IValueUnion_Device: {
|
||||
return c10::Device(ivalue.val_as_Device()->str()->str());
|
||||
}
|
||||
default:
|
||||
@@ -504,7 +504,7 @@ ClassTypePtr FlatbufferLoader::getOrCreateClassTypeForObject(
|
||||
TORCH_CHECK(object->type_index() < all_ivalues_.size());
|
||||
all_types_[object->type_index()] = cls;
|
||||
|
||||
- if (obj_type->type() == mobile::serialization::TypeType::CLASS_WITH_FIELD) {
|
||||
+ if (obj_type->type() == mobile::serialization::TypeType::TypeType_CLASS_WITH_FIELD) {
|
||||
for (uint32_t i = 0; i < object->attrs()->size(); i++) {
|
||||
IValue val = getIValue(object->attrs()->Get(i));
|
||||
// Need to use concrete object's field's type to set type of field.
|
||||
@@ -529,7 +529,7 @@ IValue parseObject(
|
||||
auto cls = loader.getOrCreateClassTypeForObject(object);
|
||||
Stack stack;
|
||||
switch (obj_type->type()) {
|
||||
- case mobile::serialization::TypeType::CLASS_WITH_FIELD: {
|
||||
+ case mobile::serialization::TypeType::TypeType_CLASS_WITH_FIELD: {
|
||||
auto obj = c10::ivalue::Object::create(
|
||||
at::StrongTypePtr(loader.cu_, cls), object->attrs()->size());
|
||||
for (uint32_t i = 0; i < object->attrs()->size(); i++) {
|
||||
@@ -538,7 +538,7 @@ IValue parseObject(
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
- case mobile::serialization::TypeType::CLASS_WITH_SETSTATE: {
|
||||
+ case mobile::serialization::TypeType::TypeType_CLASS_WITH_SETSTATE: {
|
||||
IValue input = loader.getIValue(object->state());
|
||||
mobile::Function* setstate = loader.getFunction(object->setstate_func());
|
||||
auto obj =
|
||||
@@ -548,7 +548,7 @@ IValue parseObject(
|
||||
setstate->run(stack);
|
||||
return obj;
|
||||
}
|
||||
- case mobile::serialization::TypeType::CUSTOM_CLASS: {
|
||||
+ case mobile::serialization::TypeType::TypeType_CUSTOM_CLASS: {
|
||||
auto custom_class_type =
|
||||
torch::jit::getCustomClass(cls->name()->qualifiedName());
|
||||
IValue input = loader.getIValue(object->state());
|
||||
diff --git a/torch/csrc/jit/mobile/flatbuffer_loader.h b/torch/csrc/jit/mobile/flatbuffer_loader.h
|
||||
index 7e88326..dc95202 100644
|
||||
--- a/torch/csrc/jit/mobile/flatbuffer_loader.h
|
||||
+++ b/torch/csrc/jit/mobile/flatbuffer_loader.h
|
||||
@@ -151,7 +151,7 @@ class TORCH_API FlatbufferLoader {
|
||||
std::vector<IValue> all_ivalues_;
|
||||
std::array<
|
||||
IValueParser,
|
||||
- static_cast<uint8_t>(mobile::serialization::IValueUnion::MAX) + 1>
|
||||
+ static_cast<uint8_t>(mobile::serialization::IValueUnion::IValueUnion_MAX) + 1>
|
||||
ivalue_parsers_;
|
||||
TypeResolver type_resolver_ = nullptr;
|
||||
mobile::serialization::Module* module_ = nullptr;
|
||||
diff --git a/torch/csrc/jit/serialization/flatbuffer_serializer.cpp b/torch/csrc/jit/serialization/flatbuffer_serializer.cpp
|
||||
index 066a78c..a9e19bb 100644
|
||||
--- a/torch/csrc/jit/serialization/flatbuffer_serializer.cpp
|
||||
+++ b/torch/csrc/jit/serialization/flatbuffer_serializer.cpp
|
||||
@@ -336,7 +336,7 @@ flatbuffers::DetachedBuffer FlatbufferSerializer::serializeModule(
|
||||
mcu_ = &module.compilation_unit();
|
||||
|
||||
// first element is None.
|
||||
- insertIValue(CreateIValue(fbb, mobile::serialization::IValueUnion::NONE, 0));
|
||||
+ insertIValue(CreateIValue(fbb, mobile::serialization::IValueUnion::IValueUnion_NONE, 0));
|
||||
|
||||
auto methods = module.get_methods();
|
||||
std::vector<uint32_t> functions_index;
|
||||
@@ -459,7 +459,7 @@ flatbuffers::Offset<mobile::serialization::Dict> FlatbufferSerializer::dictToFB(
|
||||
flatbuffers::Offset<mobile::serialization::ObjectType> FlatbufferSerializer::
|
||||
classTypeToFB(FlatBufferBuilder& fbb, ClassTypePtr class_ptr) {
|
||||
mobile::serialization::TypeType typetype =
|
||||
- mobile::serialization::TypeType::UNSET;
|
||||
+ mobile::serialization::TypeType::TypeType_UNSET;
|
||||
|
||||
flatbuffers::Offset<
|
||||
flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>>
|
||||
@@ -469,11 +469,11 @@ flatbuffers::Offset<mobile::serialization::ObjectType> FlatbufferSerializer::
|
||||
const mobile::Function* setstate = mcu_->find_function(setstate_name);
|
||||
const mobile::Function* getstate = mcu_->find_function(getstate_name);
|
||||
if (setstate != nullptr && getstate != nullptr) {
|
||||
- typetype = mobile::serialization::TypeType::CLASS_WITH_SETSTATE;
|
||||
+ typetype = mobile::serialization::TypeType::TypeType_CLASS_WITH_SETSTATE;
|
||||
} else if (
|
||||
class_ptr->findMethod("__setstate__") &&
|
||||
class_ptr->findMethod("__getstate__")) {
|
||||
- typetype = mobile::serialization::TypeType::CUSTOM_CLASS;
|
||||
+ typetype = mobile::serialization::TypeType::TypeType_CUSTOM_CLASS;
|
||||
} else {
|
||||
size_t num_attr = class_ptr->numAttributes();
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> names;
|
||||
@@ -482,7 +482,7 @@ flatbuffers::Offset<mobile::serialization::ObjectType> FlatbufferSerializer::
|
||||
names.push_back(fbb.CreateSharedString(class_ptr->getAttributeName(i)));
|
||||
}
|
||||
names_offset = fbb.CreateVector(names);
|
||||
- typetype = mobile::serialization::TypeType::CLASS_WITH_FIELD;
|
||||
+ typetype = mobile::serialization::TypeType::TypeType_CLASS_WITH_FIELD;
|
||||
}
|
||||
|
||||
auto name_offset = fbb.CreateString(class_ptr->name()->qualifiedName());
|
||||
@@ -500,7 +500,7 @@ uint32_t FlatbufferSerializer::storeFunctionAndGetIndex(
|
||||
|
||||
auto offset = CreateIValue(
|
||||
fbb,
|
||||
- mobile::serialization::IValueUnion::Function,
|
||||
+ mobile::serialization::IValueUnion::IValueUnion_Function,
|
||||
functionToFB(fbb, qn, function).Union());
|
||||
|
||||
uint32_t index = insertIValue(offset);
|
||||
@@ -662,68 +662,68 @@ flatbuffers::Offset<mobile::serialization::IValue> FlatbufferSerializer::
|
||||
iValueToFB(flatbuffers::FlatBufferBuilder& fbb, const IValue& ivalue) {
|
||||
using mobile::serialization::IValueUnion;
|
||||
|
||||
- IValueUnion ivalue_type = IValueUnion::NONE;
|
||||
+ IValueUnion ivalue_type = IValueUnion::IValueUnion_NONE;
|
||||
flatbuffers::Offset<void> offset = 0;
|
||||
|
||||
if (ivalue.isTensor()) {
|
||||
- ivalue_type = IValueUnion::TensorMetadata;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_TensorMetadata;
|
||||
offset = tensorToFB(fbb, ivalue).Union();
|
||||
} else if (ivalue.isTuple()) {
|
||||
- ivalue_type = IValueUnion::Tuple;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Tuple;
|
||||
offset = tupleToFB(fbb, ivalue).Union();
|
||||
} else if (ivalue.isDouble()) {
|
||||
- ivalue_type = IValueUnion::Double;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Double;
|
||||
offset = fbb.CreateStruct(mobile::serialization::Double(ivalue.toDouble()))
|
||||
.Union();
|
||||
} else if (ivalue.isComplexDouble()) {
|
||||
auto comp = ivalue.toComplexDouble();
|
||||
- ivalue_type = IValueUnion::ComplexDouble;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_ComplexDouble;
|
||||
offset = fbb.CreateStruct(mobile::serialization::ComplexDouble(
|
||||
comp.real(), comp.imag()))
|
||||
.Union();
|
||||
} else if (ivalue.isInt()) {
|
||||
- ivalue_type = IValueUnion::Int;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Int;
|
||||
offset =
|
||||
fbb.CreateStruct(mobile::serialization::Int(ivalue.toInt())).Union();
|
||||
} else if (ivalue.isBool()) {
|
||||
- ivalue_type = IValueUnion::Bool;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Bool;
|
||||
offset =
|
||||
fbb.CreateStruct(mobile::serialization::Bool(ivalue.toBool())).Union();
|
||||
} else if (ivalue.isString()) {
|
||||
- ivalue_type = IValueUnion::String;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_String;
|
||||
offset = mobile::serialization::CreateString(
|
||||
fbb, fbb.CreateSharedString(ivalue.toString()->string()))
|
||||
.Union();
|
||||
} else if (ivalue.isGenericDict()) {
|
||||
- ivalue_type = IValueUnion::Dict;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Dict;
|
||||
offset = dictToFB(fbb, ivalue).Union();
|
||||
} else if (ivalue.isNone()) {
|
||||
- ivalue_type = IValueUnion::NONE;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_NONE;
|
||||
offset = 0;
|
||||
} else if (ivalue.isIntList()) {
|
||||
- ivalue_type = IValueUnion::IntList;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_IntList;
|
||||
offset = mobile::serialization::CreateIntList(
|
||||
fbb, fbb.CreateVector(ivalue.toIntVector()))
|
||||
.Union();
|
||||
} else if (ivalue.isDoubleList()) {
|
||||
- ivalue_type = IValueUnion::DoubleList;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_DoubleList;
|
||||
offset = mobile::serialization::CreateDoubleList(
|
||||
fbb, fbb.CreateVector(ivalue.toDoubleVector()))
|
||||
.Union();
|
||||
} else if (ivalue.isBoolList()) {
|
||||
- ivalue_type = IValueUnion::BoolList;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_BoolList;
|
||||
auto boollist = ivalue.toBoolList();
|
||||
std::vector<uint8_t> bool_vec(boollist.begin(), boollist.end());
|
||||
offset =
|
||||
mobile::serialization::CreateBoolListDirect(fbb, &bool_vec).Union();
|
||||
} else if (ivalue.isList()) {
|
||||
- ivalue_type = IValueUnion::List;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_List;
|
||||
offset = listToFB(fbb, ivalue).Union();
|
||||
} else if (ivalue.isObject()) {
|
||||
- ivalue_type = IValueUnion::Object;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Object;
|
||||
offset = objectToFB(fbb, ivalue).Union();
|
||||
} else if (ivalue.isDevice()) {
|
||||
- ivalue_type = IValueUnion::Device;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_Device;
|
||||
offset = mobile::serialization::CreateDevice(
|
||||
fbb, fbb.CreateSharedString(ivalue.toDevice().str()))
|
||||
.Union();
|
||||
@@ -732,7 +732,7 @@ flatbuffers::Offset<mobile::serialization::IValue> FlatbufferSerializer::
|
||||
const auto& qualified_class_name =
|
||||
enum_holder->type()->qualifiedClassName();
|
||||
uint32_t ival_pos = storeIValueAndGetIndex(fbb, enum_holder->value());
|
||||
- ivalue_type = IValueUnion::EnumValue;
|
||||
+ ivalue_type = IValueUnion::IValueUnion_EnumValue;
|
||||
offset = mobile::serialization::CreateEnumValue(
|
||||
fbb,
|
||||
fbb.CreateSharedString(qualified_class_name.qualifiedName()),
|
@ -1,263 +0,0 @@
|
||||
# caffe2/core/macros.h.in
|
||||
set(CAFFE2_USE_GOOGLE_GLOG 1)
|
||||
set(CAFFE2_USE_LITE_PROTO 0)
|
||||
# set(CAFFE2_FORCE_FALLBACK_CUDA_MPI 0)
|
||||
|
||||
# aten/src/ATen/Config.h.in
|
||||
set(AT_POCKETFFT_ENABLED 0)
|
||||
set(AT_MKL_ENABLED 0)
|
||||
set(AT_FFTW_ENABLED 0)
|
||||
set(AT_PARALLEL_NATIVE 1)
|
||||
if(USE_OPENMP OR USE_TBB)
|
||||
set(AT_PARALLEL_NATIVE 0)
|
||||
endif()
|
||||
|
||||
find_program(Python3_EXECUTABLE NAMES python3 python REQUIRED)
|
||||
find_program(PYTHON_EXECUTABLE NAMES python3 python REQUIRED)
|
||||
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
if(BUILD_PYTHON)
|
||||
find_package(Python3 REQUIRED COMPONENTS Development NumPy)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Python3::Python Python3::NumPy)
|
||||
find_package(pybind11 CONFIG REQUIRED)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS pybind11::pybind11)
|
||||
endif()
|
||||
|
||||
#Caffe2 depends on FP16 library for half-precision conversions
|
||||
find_path(FP16_INCLUDE_DIRS "fp16.h" REQUIRED)
|
||||
# PSIMD is required by FP16
|
||||
find_path(PSIMD_INCLUDE_DIRS "psimd.h" REQUIRED)
|
||||
if(USE_NNPACK OR USE_QNNPACK OR USE_PYTORCH_QNNPACK OR USE_XNNPACK)
|
||||
find_path(FXDIV_INCLUDE_DIRS "fxdiv.h" REQUIRED)
|
||||
endif()
|
||||
|
||||
find_library(FOXI_LOADER_LIBPATH NAMES foxi_loader REQUIRED)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${FOXI_LOADER_LIBPATH})
|
||||
|
||||
find_package(Threads REQUIRED) # Threads::Threads
|
||||
find_package(gemmlowp CONFIG REQUIRED) # gemmlowp::gemmlowp
|
||||
find_package(gflags CONFIG REQUIRED) # gflags::gflags
|
||||
find_package(glog CONFIG REQUIRED) # glog::glog
|
||||
find_package(cpuinfo CONFIG REQUIRED) # cpuinfo::clog cpuinfo::cpuinfo
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS gemmlowp::gemmlowp gflags::gflags glog::glog cpuinfo::clog cpuinfo::cpuinfo)
|
||||
|
||||
# Only add a dependency on pthreadpool if we are on a mobile build or are building any of the libraries in the {Q/X}NNPACK family.
|
||||
if(INTERN_BUILD_MOBILE OR USE_NNPACK OR USE_QNNPACK OR USE_PYTORCH_QNNPACK OR USE_XNNPACK)
|
||||
find_package(unofficial-pthreadpool CONFIG REQUIRED) # unofficial::pthreadpool
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS unofficial::pthreadpool)
|
||||
set(USE_PTHREADPOOL 1)
|
||||
set(USE_INTERNAL_PTHREADPOOL_IMPL 0)
|
||||
add_compile_definitions(USE_PTHREADPOOL)
|
||||
endif()
|
||||
|
||||
link_directories(
|
||||
$<$<CONFIG:Debug>:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib>
|
||||
$<$<CONFIG:Release>:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib>
|
||||
)
|
||||
|
||||
find_package(fmt CONFIG REQUIRED) # fmt::fmt-header-only
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
|
||||
|
||||
find_package(Eigen3 CONFIG REQUIRED) # Eigen3::Eigen
|
||||
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Eigen3::Eigen)
|
||||
set(CAFFE2_USE_EIGEN_FOR_BLAS 1) # see caff2/core/macros.h.in
|
||||
|
||||
if(BLAS STREQUAL "Accelerate")
|
||||
set(WITH_BLAS "accelerate")
|
||||
find_package(BLAS REQUIRED) # cmake/Modules/FindBLAS.cmake
|
||||
find_package(LAPACK REQUIRED) # cmake/Modules/FindLAPACK.cmake
|
||||
set(USE_LAPACK 1)
|
||||
list(APPEND Caffe2_PRIVATE_DEPENDENCY_LIBS ${LAPACK_LIBRARIES})
|
||||
|
||||
elseif(BLAS STREQUAL "Open")
|
||||
set(WITH_BLAS "open")
|
||||
find_package(BLAS)
|
||||
if(BLAS_FOUND)
|
||||
set(USE_BLAS 1)
|
||||
list(APPEND Caffe2_PRIVATE_DEPENDENCY_LIBS ${BLAS_LIBRARIES})
|
||||
else()
|
||||
set(USE_BLAS 0) # if we couldn't find the BLAS, disable the feature
|
||||
endif()
|
||||
set(USE_LAPACK 0)
|
||||
|
||||
elseif(BLAS STREQUAL "MKL")
|
||||
if(USE_TBB)
|
||||
set(MKL_THREADING "TBB")
|
||||
else()
|
||||
set(MKL_THREADING "SEQ")
|
||||
endif()
|
||||
find_package(MKL REQUIRED)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/public/mkl.cmake)
|
||||
include_directories(AFTER SYSTEM ${MKL_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS caffe2::mkl)
|
||||
set(WITH_BLAS "mkl")
|
||||
find_package(BLAS REQUIRED) # cmake/Modules/FindBLAS.cmake
|
||||
|
||||
else()
|
||||
set(USE_BLAS 0)
|
||||
set(WITH_BLAS "generic")
|
||||
find_package(BLAS)
|
||||
if(BLAS_FOUND)
|
||||
set(USE_BLAS 1)
|
||||
list(APPEND Caffe2_PRIVATE_DEPENDENCY_LIBS ${BLAS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(USE_MKLDNN)
|
||||
find_package(MKLDNN REQUIRED) # BLAS::BLAS
|
||||
include(cmake/public/mkldnn.cmake)
|
||||
include_directories(AFTER SYSTEM ${MKLDNN_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS caffe2::mkldnn)
|
||||
endif()
|
||||
|
||||
if(USE_TBB)
|
||||
find_package(TBB CONFIG REQUIRED) # TBB::tbb
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS TBB::tbb)
|
||||
endif()
|
||||
|
||||
if(USE_NNPACK)
|
||||
find_library(NNPACK_LIB NAMES nnpack REQUIRED)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${NNPACK_LIB})
|
||||
string(APPEND CMAKE_CXX_FLAGS " -DUSE_NNPACK")
|
||||
endif()
|
||||
|
||||
if(USE_FBGEMM)
|
||||
find_package(asmjit CONFIG REQUIRED) # asmjit::asmjit (required by fbgemm)
|
||||
find_package(fbgemmLibrary CONFIG REQUIRED) # fbgemm
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS asmjit::asmjit fbgemm)
|
||||
if(USE_CUDA)
|
||||
# todo: fbgemm-gpu
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_LMDB)
|
||||
find_package(LMDB) # from cmake/Modules/FindLMDB.cmake
|
||||
if(LMDB_FOUND)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${LMDB_LIBRARIES})
|
||||
else()
|
||||
find_package(lmdb CONFIG REQUIRED) # lmdb
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS lmdb)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_LEVELDB)
|
||||
find_package(Snappy CONFIG REQUIRED) # Snappy::snappy
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Snappy::snappy)
|
||||
find_package(LevelDB) # from cmake/Modules/FindLevelDB.cmake
|
||||
if(LevelDB_FOUND)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${LevelDB_LIBRARIES})
|
||||
else()
|
||||
find_package(leveldb CONFIG REQUIRED) # leveldb::leveldb
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS leveldb::leveldb)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_QNNPACK)
|
||||
find_library(QNNPACK_LIB NAME qnnpack REQUIRED)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${QNNPACK_LIB})
|
||||
endif()
|
||||
|
||||
if(USE_XNNPACK)
|
||||
find_library(XNNPACK_LIBRARY NAMES xnnpack XNNPACK REQUIRED) # xnnpack
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${XNNPACK_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(USE_ZSTD)
|
||||
find_package(zstd CONFIG REQUIRED) # zstd::libzstd_static
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
|
||||
endif()
|
||||
|
||||
if(USE_SYSTEM_ONNX)
|
||||
find_package(ONNX CONFIG REQUIRED) # onnx onnx_proto onnxifi_loader
|
||||
find_package(ONNXOptimizer CONFIG REQUIRED) # onnx_optimizer
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS onnx onnx_proto onnx_optimizer)
|
||||
if(ONNX_ML)
|
||||
add_compile_definitions(ONNX_ML=1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_CUDA)
|
||||
set(CMAKE_CUDA_STANDARD 14)
|
||||
find_package(CUDA 10.1 REQUIRED) # https://cmake.org/cmake/help/latest/module/FindCUDA.html
|
||||
find_package(CUDNN 8.0 REQUIRED) # CuDNN::CuDNN
|
||||
cuda_select_nvcc_arch_flags(ARCH_FLAGS 6.0 6.2 7.5)
|
||||
list(APPEND CUDA_NVCC_FLAGS
|
||||
${ARCH_FLAGS} # check TORCH_NVCC_FLAGS in this project
|
||||
-D__CUDA_NO_HALF_OPERATORS__ # see https://github.com/torch/cutorch/issues/797
|
||||
)
|
||||
set(CAFFE2_USE_CUDA 1)
|
||||
set(CAFFE2_USE_CUDNN 1)
|
||||
set(CAFFE2_USE_NVRTC 0)
|
||||
set(CAFFE2_USE_TENSORRT 0)
|
||||
include(cmake/public/cuda.cmake)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS
|
||||
CuDNN::CuDNN
|
||||
)
|
||||
list(APPEND Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS
|
||||
caffe2::cufft caffe2::curand caffe2::cublas
|
||||
caffe2::cudnn-public
|
||||
# caffe2::cuda caffe2::nvrtc # for CAFFE2_USE_NVRTC
|
||||
# caffe2::tensorrt # for CAFFE2_USE_TENSORRT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_NUMA) # Linux package 'libnuma-dev'
|
||||
find_package(Numa REQUIRED)
|
||||
include_directories(SYSTEM ${Numa_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${Numa_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(USE_GLOO)
|
||||
find_package(Gloo CONFIG REQUIRED)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS gloo)
|
||||
endif()
|
||||
|
||||
if(USE_VULKAN)
|
||||
find_package(Vulkan REQUIRED)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Vulkan::Vulkan)
|
||||
endif()
|
||||
|
||||
if(USE_TENSORPIPE)
|
||||
find_package(libuv CONFIG REQUIRED)
|
||||
find_package(Tensorpipe CONFIG REQUIRED) # tensorpipe
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS uv_a tensorpipe)
|
||||
endif()
|
||||
|
||||
if(USE_MPI)
|
||||
find_package(MPI REQUIRED) # APT package: libopenmpi-dev
|
||||
if(NOT MPI_CXX_FOUND)
|
||||
message(FATAL_ERROR "Failed to find MPI_CXX")
|
||||
endif()
|
||||
include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${MPI_CXX_LIBRARIES})
|
||||
list(APPEND CMAKE_EXE_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS})
|
||||
|
||||
find_program(OMPI_INFO NAMES ompi_info HINTS ${MPI_CXX_LIBRARIES}/../bin)
|
||||
if(OMPI_INFO)
|
||||
execute_process(COMMAND ${OMPI_INFO} OUTPUT_VARIABLE _output)
|
||||
if(_output MATCHES "smcuda")
|
||||
message(STATUS "Found OpenMPI with CUDA support built.")
|
||||
else()
|
||||
message(WARNING "OpenMPI found, but it is not built with CUDA support.")
|
||||
set(CAFFE2_FORCE_FALLBACK_CUDA_MPI 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_OPENCV)
|
||||
find_package(OpenCV CONFIG REQUIRED COMPONENTS core highgui imgproc imgcodecs videoio video)
|
||||
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${OpenCV_LIBS})
|
||||
if(MSVC AND USE_CUDA)
|
||||
list(APPEND Caffe2_CUDA_DEPENDENCY_LIBS ${OpenCV_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_OPENCL)
|
||||
find_package(OpenCL REQUIRED)
|
||||
include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS})
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../caffe2/contrib/opencl)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS OpenCL::OpenCL)
|
||||
endif()
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "libtorch",
|
||||
"version": "1.12.1",
|
||||
"port-version": 5,
|
||||
"version": "2.1.2",
|
||||
"description": "Tensors and Dynamic neural networks in Python with strong GPU acceleration",
|
||||
"homepage": "https://pytorch.org/",
|
||||
"license": null,
|
||||
"supports": "(windows & !static) | osx | linux",
|
||||
"dependencies": [
|
||||
"blas",
|
||||
"cpuinfo",
|
||||
"eigen3",
|
||||
"flatbuffers",
|
||||
@ -16,26 +16,24 @@
|
||||
},
|
||||
"fmt",
|
||||
"foxi",
|
||||
"foxi",
|
||||
"fp16",
|
||||
"gemmlowp",
|
||||
"gflags",
|
||||
"glog",
|
||||
"lapack",
|
||||
"lmdb",
|
||||
{
|
||||
"name": "mpi",
|
||||
"platform": "linux"
|
||||
},
|
||||
"mimalloc",
|
||||
"onnx",
|
||||
"onnx-optimizer",
|
||||
{
|
||||
"name": "openblas",
|
||||
"platform": "windows"
|
||||
},
|
||||
"opencl",
|
||||
"pocketfft",
|
||||
"protobuf",
|
||||
{
|
||||
"name": "protobuf",
|
||||
"host": true
|
||||
},
|
||||
"pthreadpool",
|
||||
"sleef",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
@ -51,9 +49,24 @@
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"xnnpack"
|
||||
{
|
||||
"name": "cuda",
|
||||
"platform": "windows & !x86"
|
||||
},
|
||||
"fftw3",
|
||||
"opencv",
|
||||
"xnnpack",
|
||||
"zstd"
|
||||
],
|
||||
"features": {
|
||||
"cuda": {
|
||||
"description": "Build with CUDA GPU backend",
|
||||
"dependencies": [
|
||||
"cuda",
|
||||
"cudnn",
|
||||
"magma"
|
||||
]
|
||||
},
|
||||
"dist": {
|
||||
"description": "Use distributed with MPI, Gloo, libuv, TensorPipe",
|
||||
"dependencies": [
|
||||
@ -62,12 +75,16 @@
|
||||
"platform": "linux"
|
||||
},
|
||||
{
|
||||
"name": "libuv",
|
||||
"platform": "windows | osx"
|
||||
"name": "libtorch",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"mpi"
|
||||
],
|
||||
"platform": "linux"
|
||||
},
|
||||
{
|
||||
"name": "openmpi",
|
||||
"platform": "linux | osx"
|
||||
"name": "libuv",
|
||||
"platform": "windows | osx"
|
||||
},
|
||||
{
|
||||
"name": "tensorpipe",
|
||||
@ -75,6 +92,12 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"fftw3": {
|
||||
"description": "Build with fftw3",
|
||||
"dependencies": [
|
||||
"fftw3"
|
||||
]
|
||||
},
|
||||
"leveldb": {
|
||||
"description": "Build with LevelDB",
|
||||
"dependencies": [
|
||||
@ -82,6 +105,18 @@
|
||||
"snappy"
|
||||
]
|
||||
},
|
||||
"llvm": {
|
||||
"description": "Build with LLVM",
|
||||
"dependencies": [
|
||||
"llvm"
|
||||
]
|
||||
},
|
||||
"mpi": {
|
||||
"description": "Build with MPI",
|
||||
"dependencies": [
|
||||
"mpi"
|
||||
]
|
||||
},
|
||||
"nnpack": {
|
||||
"description": "Build with NNPack",
|
||||
"supports": "linux | osx",
|
||||
@ -95,22 +130,21 @@
|
||||
"opencv"
|
||||
]
|
||||
},
|
||||
"tbb": {
|
||||
"description": "Build with Intel TBB",
|
||||
"dependencies": [
|
||||
"tbb"
|
||||
]
|
||||
},
|
||||
"vulkan": {
|
||||
"description": "Build with Vulkan GPU backend",
|
||||
"supports": "!windows",
|
||||
"dependencies": [
|
||||
"vulkan"
|
||||
"vulkan",
|
||||
"vulkan-loader",
|
||||
"vulkan-memory-allocator"
|
||||
]
|
||||
},
|
||||
"xnnpack": {
|
||||
"description": "Build with XNNPack",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "fxdiv",
|
||||
"platform": "!windows"
|
||||
},
|
||||
"xnnpack"
|
||||
]
|
||||
},
|
||||
|
94
ports/xnnpack/fix-build.patch
Normal file
94
ports/xnnpack/fix-build.patch
Normal file
@ -0,0 +1,94 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 95df99eae0..7e969cfbb8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -704,7 +704,7 @@ IF(MSVC)
|
||||
TARGET_COMPILE_DEFINITIONS(operator-utils PRIVATE "restrict=")
|
||||
TARGET_COMPILE_DEFINITIONS(XNNPACK PRIVATE "restrict=")
|
||||
ENDIF()
|
||||
-
|
||||
+ if(0)
|
||||
TARGET_COMPILE_OPTIONS(microkernels-all PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
|
||||
TARGET_COMPILE_OPTIONS(microkernels-prod PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
|
||||
TARGET_COMPILE_OPTIONS(hardware-config PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
|
||||
@@ -723,6 +723,7 @@ IF(MSVC)
|
||||
TARGET_COMPILE_OPTIONS(operators PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
|
||||
TARGET_COMPILE_OPTIONS(XNNPACK PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
|
||||
ENDIF()
|
||||
+ endif()
|
||||
ELSE()
|
||||
TARGET_COMPILE_OPTIONS(microkernels-all PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
|
||||
TARGET_COMPILE_OPTIONS(microkernels-prod PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
|
||||
@@ -797,8 +798,8 @@ IF(NOT TARGET clog)
|
||||
# We build static version of clog but a dynamic library may indirectly depend on it
|
||||
SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
ELSE()
|
||||
- ADD_LIBRARY(clog STATIC IMPORTED)
|
||||
- FIND_LIBRARY(CLOG_LIBRARY clog)
|
||||
+ ADD_LIBRARY(clog UNKNOWN IMPORTED)
|
||||
+ FIND_LIBRARY(CLOG_LIBRARY NAMES clog REQUIRED)
|
||||
IF(NOT CLOG_LIBRARY)
|
||||
MESSAGE(FATAL_ERROR "Cannot find clog")
|
||||
ENDIF()
|
||||
@@ -817,8 +818,8 @@ IF(NOT TARGET cpuinfo)
|
||||
"${CPUINFO_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/cpuinfo")
|
||||
ELSE()
|
||||
- ADD_LIBRARY(cpuinfo SHARED IMPORTED)
|
||||
- FIND_LIBRARY(CPUINFO_LIBRARY cpuinfo)
|
||||
+ ADD_LIBRARY(cpuinfo UNKNOWN IMPORTED)
|
||||
+ FIND_LIBRARY(CPUINFO_LIBRARY NAMES cpuinfo REQUIRED)
|
||||
IF(NOT CPUINFO_LIBRARY)
|
||||
MESSAGE(FATAL_ERROR "Cannot find cpuinfo")
|
||||
ENDIF()
|
||||
@@ -841,13 +842,15 @@ IF(NOT TARGET pthreadpool)
|
||||
"${PTHREADPOOL_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/pthreadpool")
|
||||
ELSE()
|
||||
- ADD_LIBRARY(pthreadpool SHARED IMPORTED)
|
||||
- FIND_LIBRARY(PTHREADPOOL_LIBRARY pthreadpool)
|
||||
+ ADD_LIBRARY(pthreadpool UNKNOWN IMPORTED)
|
||||
+ FIND_LIBRARY(PTHREADPOOL_LIBRARY NAMES pthreadpool REQUIRED)
|
||||
+ find_path(PTHREADPOOL_INCLUDE NAMES pthreadpool.h REQUIRED PATH_SUFFIXES include)
|
||||
+ target_include_directories(pthreadpool INTERFACE "${PTHREADPOOL_INCLUDE}")
|
||||
IF(NOT PTHREADPOOL_LIBRARY)
|
||||
MESSAGE(FATAL_ERROR "Cannot find pthreadpool")
|
||||
ENDIF()
|
||||
SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}")
|
||||
- SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_IMPLIB "${PTHREADPOOL_LIBRARY}")
|
||||
+ #SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_IMPLIB "${PTHREADPOOL_LIBRARY}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE pthreadpool)
|
||||
@@ -881,12 +884,12 @@ IF(NOT TARGET fxdiv)
|
||||
"${FXDIV_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/FXdiv")
|
||||
ELSE()
|
||||
- FIND_FILE(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
|
||||
+ FIND_PATH(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
|
||||
IF(NOT FXDIV_HDR)
|
||||
MESSAGE(FATAL_ERROR "Cannot find fxdiv")
|
||||
ENDIF()
|
||||
- ADD_LIBRARY(fxdiv STATIC "${FXDIV_HDR}")
|
||||
- SET_PROPERTY(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
|
||||
+ ADD_LIBRARY(fxdiv INTERFACE IMPORTED)
|
||||
+ target_include_directories(fxdiv INTERFACE "${FXDIV_HDR}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE fxdiv)
|
||||
@@ -905,12 +908,12 @@ IF(NOT TARGET fp16)
|
||||
"${FP16_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/FP16")
|
||||
ELSE()
|
||||
- FIND_FILE(FP16_HDR fp16.h PATH_SUFFIXES include)
|
||||
+ FIND_PATH(FP16_HDR fp16.h PATH_SUFFIXES include REQUIRED)
|
||||
IF(NOT FP16_HDR)
|
||||
MESSAGE(FATAL_ERROR "Cannot find fp16")
|
||||
ENDIF()
|
||||
- ADD_LIBRARY(fp16 STATIC "${FP16_HDR}")
|
||||
- SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C)
|
||||
+ ADD_LIBRARY(fp16 INTERFACE IMPORTED)
|
||||
+ target_include_directories(fp16 INTERFACE "${FP16_HDR}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE fp16)
|
@ -5,12 +5,11 @@ endif()
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO google/XNNPACK
|
||||
REF ae108ef49aa5623b896fc93d4298c49d1750d9ba # 2022-02-17
|
||||
SHA512 597354c8c5b786ba24a8c9759409fee7b090ec497547919da4c5786a571b5ef237d1da204b7fd553217089792acb5e40ea1e6d26e3a638aa32df1e63c14d1c91
|
||||
REF 51a987591a6fc9f0fc0707077f53d763ac132cbf # 2022-12-22
|
||||
SHA512 1742ad4de3aa1a67cd5a3cbf15d82afc2cc8569a2abac92542f748a440ef37fef4e9d9c302b7b2813e3176934b637c761c1c0956d20ab1ba28b280d9b121d91b
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
use-packages.patch
|
||||
use-c-cpp-11.patch
|
||||
fix-build.patch
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
@ -25,7 +24,6 @@ vcpkg_cmake_configure(
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_cmake_config_fixup()
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
|
@ -1,14 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c924b45..72ffd64 100755
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -12,6 +12,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.12 FATAL_ERROR)
|
||||
# ---[ Project and semantic versioning.
|
||||
PROJECT(XNNPACK C CXX ASM)
|
||||
|
||||
+set(CMAKE_CXX_STANDARD 11)
|
||||
+set(CMAKE_C_STANDARD 11)
|
||||
+
|
||||
# ---[ Options.
|
||||
SET(XNNPACK_LIBRARY_TYPE "default" CACHE STRING "Type of library (shared, static, or default) to build")
|
||||
SET_PROPERTY(CACHE XNNPACK_LIBRARY_TYPE PROPERTY STRINGS default static shared)
|
@ -1,116 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2ca06ee..b0d8873 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -6526,7 +6526,7 @@ ELSE()
|
||||
SET_PROPERTY(SOURCE ${COLD_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS "$<$<NOT:$<CONFIG:Debug>>: -Os >")
|
||||
ENDIF()
|
||||
|
||||
-TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC include)
|
||||
+TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
TARGET_INCLUDE_DIRECTORIES(XNNPACK PRIVATE src)
|
||||
TARGET_INCLUDE_DIRECTORIES(all_microkernels PRIVATE include src)
|
||||
TARGET_INCLUDE_DIRECTORIES(packing PRIVATE include src)
|
||||
@@ -6547,7 +6547,7 @@ IF(LIBM)
|
||||
ENDIF()
|
||||
|
||||
# ---[ Configure clog
|
||||
-IF(NOT TARGET clog)
|
||||
+IF(FALSE)
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(CLOG_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(CLOG_RUNTIME_TYPE "${CPUINFO_RUNTIME_TYPE}" CACHE STRING "")
|
||||
@@ -6565,11 +6565,9 @@ IF(NOT TARGET clog)
|
||||
SET_PROPERTY(TARGET clog PROPERTY IMPORTED_LOCATION "${CLOG_LIBRARY}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE clog)
|
||||
-TARGET_LINK_LIBRARIES(jit PRIVATE clog)
|
||||
|
||||
# ---[ Configure cpuinfo
|
||||
-IF(NOT TARGET cpuinfo)
|
||||
+IF(false)
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
|
||||
SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
|
||||
@@ -6587,10 +6585,12 @@ IF(NOT TARGET cpuinfo)
|
||||
SET_PROPERTY(TARGET cpuinfo PROPERTY IMPORTED_LOCATION "${CPUINFO_LIBRARY}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE cpuinfo)
|
||||
+find_package(cpuinfo CONFIG REQUIRED)
|
||||
+TARGET_LINK_LIBRARIES(XNNPACK PRIVATE cpuinfo::clog cpuinfo::cpuinfo)
|
||||
+TARGET_LINK_LIBRARIES(jit PRIVATE cpuinfo::clog)
|
||||
|
||||
# ---[ Configure pthreadpool
|
||||
-IF(NOT TARGET pthreadpool)
|
||||
+IF(FALSE)
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -6607,14 +6607,15 @@ IF(NOT TARGET pthreadpool)
|
||||
SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PUBLIC pthreadpool)
|
||||
-TARGET_LINK_LIBRARIES(all_microkernels PRIVATE pthreadpool)
|
||||
-TARGET_LINK_LIBRARIES(indirection PRIVATE pthreadpool)
|
||||
-TARGET_LINK_LIBRARIES(jit PRIVATE pthreadpool)
|
||||
-TARGET_LINK_LIBRARIES(packing PRIVATE pthreadpool)
|
||||
+find_package(unofficial-pthreadpool CONFIG REQUIRED)
|
||||
+target_link_libraries(XNNPACK PUBLIC unofficial::pthreadpool)
|
||||
+target_link_libraries(all_microkernels PRIVATE unofficial::pthreadpool)
|
||||
+target_link_libraries(indirection PRIVATE unofficial::pthreadpool)
|
||||
+target_link_libraries(jit PRIVATE unofficial::pthreadpool)
|
||||
+target_link_libraries(packing PRIVATE unofficial::pthreadpool)
|
||||
|
||||
# ---[ Configure FXdiv
|
||||
-IF(NOT TARGET fxdiv)
|
||||
+IF(FALSE)
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -6630,12 +6631,13 @@ IF(NOT TARGET fxdiv)
|
||||
SET_PROPERTY(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fxdiv)
|
||||
-TARGET_LINK_LIBRARIES(all_microkernels PRIVATE fxdiv)
|
||||
-TARGET_LINK_LIBRARIES(indirection PRIVATE fxdiv)
|
||||
+find_path(FXDIV_INCLUDE_DIRS "fxdiv.h" REQUIRED)
|
||||
+target_include_directories(XNNPACK PRIVATE ${FXDIV_INCLUDE_DIRS})
|
||||
+target_include_directories(all_microkernels PRIVATE ${FXDIV_INCLUDE_DIRS})
|
||||
+target_include_directories(indirection PRIVATE ${FXDIV_INCLUDE_DIRS})
|
||||
|
||||
# ---[ Configure FP16
|
||||
-IF(NOT TARGET fp16)
|
||||
+IF(FALSE)
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(FP16_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(FP16_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -6651,15 +6653,21 @@ IF(NOT TARGET fp16)
|
||||
SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fp16)
|
||||
-TARGET_LINK_LIBRARIES(all_microkernels PRIVATE fp16)
|
||||
-TARGET_LINK_LIBRARIES(packing PRIVATE fp16)
|
||||
-TARGET_LINK_LIBRARIES(indirection PRIVATE fp16)
|
||||
+find_path(FP16_INCLUDE_DIRS "fp16.h" REQUIRED)
|
||||
+target_include_directories(XNNPACK PRIVATE ${FP16_INCLUDE_DIRS})
|
||||
+target_include_directories(all_microkernels PRIVATE ${FP16_INCLUDE_DIRS})
|
||||
+target_include_directories(packing PRIVATE ${FP16_INCLUDE_DIRS})
|
||||
+target_include_directories(indirection PRIVATE ${FP16_INCLUDE_DIRS})
|
||||
|
||||
INSTALL(TARGETS XNNPACK
|
||||
+ EXPORT xnnpack-config
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
+install(EXPORT xnnpack-config
|
||||
+ NAMESPACE unofficial::
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xnnpack)
|
||||
|
||||
# ---[ XNNPACK unit tests
|
||||
IF(XNNPACK_BUILD_TESTS)
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "xnnpack",
|
||||
"version-date": "2022-02-17",
|
||||
"version-date": "2022-12-22",
|
||||
"description": "High-efficiency floating-point neural network inference operators for mobile, server, and Web",
|
||||
"homepage": "https://github.com/google/XNNPACK",
|
||||
"license": "BSD-3-Clause",
|
||||
"supports": "!(arm & windows) & !uwp",
|
||||
"supports": "!(arm & windows) & !uwp & !arm32",
|
||||
"dependencies": [
|
||||
"cpuinfo",
|
||||
"fp16",
|
||||
@ -13,10 +13,6 @@
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -627,10 +627,6 @@ libtcod:arm64-android=fail
|
||||
libtcod:x64-android=fail
|
||||
libtomcrypt:arm64-windows=fail
|
||||
libtomcrypt:arm64-uwp=fail
|
||||
# D:\b\libtorch\src\v1.12.1-e1cb316ec6.clean\aten\src\ATen/cpu/vec/vec_base.h(134): fatal error C1001: Internal compiler error.
|
||||
# (compiler file 'D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\toinil.c', line 910)
|
||||
libtorch:x64-windows=fail
|
||||
libtorch:x64-osx=fail
|
||||
libusb-win32:arm64-uwp=fail
|
||||
libusb-win32:x64-uwp=fail
|
||||
#Skip detection to avoid upstream remove older releases
|
||||
|
@ -4949,8 +4949,8 @@
|
||||
"port-version": 0
|
||||
},
|
||||
"libtorch": {
|
||||
"baseline": "1.12.1",
|
||||
"port-version": 5
|
||||
"baseline": "2.1.2",
|
||||
"port-version": 0
|
||||
},
|
||||
"libtorrent": {
|
||||
"baseline": "2.0.9",
|
||||
@ -9333,7 +9333,7 @@
|
||||
"port-version": 2
|
||||
},
|
||||
"xnnpack": {
|
||||
"baseline": "2022-02-17",
|
||||
"baseline": "2022-12-22",
|
||||
"port-version": 0
|
||||
},
|
||||
"xorg-macros": {
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "418db4a2514c9530b67097fca0ce7cafde5a2a15",
|
||||
"version": "2.1.2",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "20a2f323fb33dab29315fd18217e263ade2a9bd6",
|
||||
"version": "1.12.1",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "7a84132ceac551e5ba3da8117fdc23f4f1571fd2",
|
||||
"version-date": "2022-12-22",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "439631254e564280e520c848b6b16e259c79b422",
|
||||
"version-date": "2022-02-17",
|
||||
|
Loading…
Reference in New Issue
Block a user