mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 02:41:47 +08:00
[libtorch] create a new port (#17199)
* [onnx] feature: foxi
* https://github.com/houseroad/foxi
* install the project's copyright (MIT)
* pytorch requires `foxi_loader`
The CMake target will be renamed to `onnxifi_*` for convenience.
* [onnx] force onnx/onnx_proto static in Windows
Checked the protject's CI logs. It turned out onnx/onnx_proto are ALWAYS static.
Specify it in CMakeLists.txt because vcpkg configures `BUILD_SHARED_LIBS=ON`
If the triplet requires it.
There are no `ONNXIFI_ENABLE_EXT=ON` case.
Removed the misused build options in portfile.
Add port feature `protobuf-lite` which is in build option.
* [onnx] support windows static triplets
* remove SHARED for `onnxifi_wrapper` and `onnxifi_dummy`
* [onnx] fix wrong LICENSE install
* [onnx] remove feature 'foxi'
* also remove redundant part in patch files
* [libtorch] rework patch files
* [libtorch] config fixup ATen, Torch
* use `link_libraries` to vcpkg installed folder
* future work may use library names without `find_library`
* update versions JSON to use `version-semver`
* [libtorch] make shared only
* Caffe2 is exported when BUILD_SHARED_LIBS
* [libtorch] remove headers after install
* [libtorch] rewrite patches and feature options
* checked osx / linux build
* [libtorch] use eigen3 always
* Caffe2 eigen_utils.h requires it
* [libtorch] error if BLAS feature collision
* [libtorch] remove !static
* [libtorch] replace vcpkg_find_acquire_program
* let's see python3 from find_program supports
* Dependency python3
* [libtorch] migrate works from luncliff/vcpkg-registry
* Update target version and dependencies
* Removed unsupported features
* [libtorch] misc fix, update version, baseline
* fix merge confict for 'onnx'
* [libtorch] install pip packages
* typing-extensions, pyyaml
* [libtorch] turn off Metal options
* [onnx] revert 'onnx' changes
* [libtorch] refine patches
* [libtorch] link with foxi_loader
* removed wrong onnx related source changes
* [libtorch] update git-tree
* [libtorch] reduce patch size
* [libtorch] find numa and activate USE_NUMA
* Update ports/libtorch/portfile.cmake
Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
* Update ports/libtorch/portfile.cmake
Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
* Update ports/libtorch/portfile.cmake
Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
* [libtorch] fix mistype and update version JSON
* Add double quotes
* version
* Fix support expression
* version
* [libtorch] update cpuinfo usage
* https://github.com/microsoft/vcpkg/pull/23944
* update version
* [tensorpipe] fix linux install
* find_package(Tensorpipe) may fail because of case mismatch
* [tensorpipe] update versions JSON
* [libtorch] fix feature failures
* [libtorch] remove CUDA feature
* [libtorch] giveup 'fbgemm' feature
* [libtorch] use mpi, openmpi in Linux
* [libtorch] fix glog link error
* [tensorpipe] bump port version
* see https://github.com/microsoft/vcpkg/pull/23569
* [libtorch] fix patch list
* [libtorch] use official libuv config
* see https://github.com/microsoft/vcpkg/pull/24745
* Update ports/libtorch/portfile.cmake
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
* Update ports/libtorch/portfile.cmake
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
* update versions JSON
* revert unnecessary 'nnpack' changes
* Update ports/libtorch/portfile.cmake
Co-authored-by: Adam Johnson <AdamJohnso@gmail.com>
* [libtorch] use vcpkg-get-python-packages
* [libtorch] provide path of python3
* Update ports/libtorch/portfile.cmake
Co-authored-by: Billy O'Neal <bion@microsoft.com>
* Fix version database.
* [libtorch] use openmpi in linux/osx
* [libtorch] update to v1.12.1
* [libtorch] find_program(python3, python)
* [libtorch] provide PYTHON_EXECUTABLE directly
* [xnnpack] update to 2022-02-17
* [xnnpack] use C11, C++11
* [libtorch] more patches, DISABLE_PARALLEL_CONFIGURE
* [libtorch] allow static torch_cpu build
* Revert "[libtorch] allow static torch_cpu build"
This reverts commit 5fd4ef0bbe
.
* [libtorch] find_package(BLAS)
* [libtorch] simplify Python3, NumPy option use
* [libtorch] fix install in Windows
* [libtorch] exclude torch_global_deps in Windows
* [libtorch] platform of nnpack feature
* [libtorch] fix MPI option in Windows
* [libtorch] fixing LNK1161
* [libtorch] fix some mistypes
* [libtorch] define NOMINMAX for c10
* [libtorch] disable vulkan feature in Windows
* ci.baseline.txt: allow libtorch failure
* fails with Visual Studio 2022 17.4.2
* requires 17.4.3+
* Enable testing port on Windows
* [caffe2] redirect to libtorch
* update baseline
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
Co-authored-by: Billy Robert O'Neal <bion@microsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Adam Johnson <AdamJohnso@gmail.com>
Co-authored-by: Victor Romero <romerosanchezv@gmail.com>
This commit is contained in:
parent
c1b963c083
commit
d8c61f7fbf
@ -1,31 +0,0 @@
|
||||
diff --git a/caffe2/core/logging.cc b/caffe2/core/logging.cc
|
||||
index 1379f3a..d1289db 100644
|
||||
--- a/caffe2/core/logging.cc
|
||||
+++ b/caffe2/core/logging.cc
|
||||
@@ -120,17 +120,6 @@ using fLB::FLAGS_logtostderr;
|
||||
CAFFE2_DEFINE_int(caffe2_log_level, google::GLOG_ERROR,
|
||||
"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 caffe2 {
|
||||
bool InitCaffeLogging(int* argc, char** argv) {
|
||||
if (*argc == 0) return true;
|
||||
@@ -138,7 +127,7 @@ bool InitCaffeLogging(int* argc, char** argv) {
|
||||
// IsGoogleLoggingInitialized is not exported from the glog DLL
|
||||
// so we can't call it. If our program calls InitGoogleLogging twice glog will
|
||||
// abort it.
|
||||
- if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized())
|
||||
+ if (!::google::IsGoogleLoggingInitialized())
|
||||
#endif
|
||||
{
|
||||
::google::InitGoogleLogging(argv[0]);
|
@ -1,26 +0,0 @@
|
||||
diff --git a/caffe2/utils/proto_utils.cc b/caffe2/utils/proto_utils.cc
|
||||
index ab2d756..2c36ec4 100644
|
||||
--- a/caffe2/utils/proto_utils.cc
|
||||
+++ b/caffe2/utils/proto_utils.cc
|
||||
@@ -102,10 +102,9 @@ bool ReadProtoFromBinaryFile(const char* filename, MessageLite* proto) {
|
||||
::google::protobuf::io::CopyingInputStreamAdaptor stream(
|
||||
new IfstreamInputStream(filename));
|
||||
stream.SetOwnsCopyingStream(true);
|
||||
- // Total bytes hard limit / warning limit are set to 1GB and 512MB
|
||||
- // respectively.
|
||||
+ // Total bytes hard limit is set to 1GB.
|
||||
::google::protobuf::io::CodedInputStream coded_stream(&stream);
|
||||
- coded_stream.SetTotalBytesLimit(1024LL << 20, 512LL << 20);
|
||||
+ coded_stream.SetTotalBytesLimit(1024LL << 20);
|
||||
return proto->ParseFromCodedStream(&coded_stream);
|
||||
}
|
||||
|
||||
@@ -155,7 +154,7 @@ bool ReadProtoFromBinaryFile(const char* filename, MessageLite* proto) {
|
||||
std::unique_ptr<CodedInputStream> coded_input(
|
||||
new CodedInputStream(raw_input.get()));
|
||||
// A hack to manually allow using very large protocol buffers.
|
||||
- coded_input->SetTotalBytesLimit(1073741824, 536870912);
|
||||
+ coded_input->SetTotalBytesLimit(1073741824);
|
||||
bool success = proto->ParseFromCodedStream(coded_input.get());
|
||||
coded_input.reset();
|
||||
raw_input.reset();
|
@ -1,13 +0,0 @@
|
||||
diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake
|
||||
index e082298..25186e4 100644
|
||||
--- a/cmake/Utils.cmake
|
||||
+++ b/cmake/Utils.cmake
|
||||
@@ -386,7 +386,7 @@ function(caffe_add_whole_archive_flag lib output_var)
|
||||
set(${output_var} -Wl,-force_load,$<TARGET_FILE:${lib}> PARENT_SCOPE)
|
||||
elseif(MSVC)
|
||||
# In MSVC, we will add whole archive in default.
|
||||
- set(${output_var} -WHOLEARCHIVE:$<TARGET_FILE:${lib}> PARENT_SCOPE)
|
||||
+ set(${output_var} -WHOLEARCHIVE:"$<TARGET_FILE:${lib}>" PARENT_SCOPE)
|
||||
else()
|
||||
# Assume everything else is like gcc
|
||||
set(${output_var} -Wl,--whole-archive ${lib} -Wl,--no-whole-archive PARENT_SCOPE)
|
@ -1,396 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8054d98..35934f5 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -56,6 +56,14 @@ option(USE_ROCKSDB "Use RocksDB" ON)
|
||||
option(USE_SNPE "Use Qualcomm's SNPE library" OFF)
|
||||
option(USE_THREADS "Use Threads" ON)
|
||||
option(USE_ZMQ "Use ZMQ" OFF)
|
||||
+if(MSVC)
|
||||
+ if(BUILD_BUILD_SHARED_LIBS)
|
||||
+ set(USE_STATIC_RUNTIME_DEFAULT OFF)
|
||||
+ else()
|
||||
+ set(USE_STATIC_RUNTIME_DEFAULT ON)
|
||||
+ endif()
|
||||
+ option(USE_STATIC_RUNTIME "Link to the static runtime (/MT) instead of dynamic (/MD)" ${USE_STATIC_RUNTIME_DEFAULT})
|
||||
+endif()
|
||||
|
||||
# External projects
|
||||
include(ExternalProject)
|
||||
@@ -99,7 +107,7 @@ else()
|
||||
foreach(flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
- if (NOT ${BUILD_SHARED_LIBS})
|
||||
+ if (USE_STATIC_RUNTIME)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MD")
|
||||
diff --git a/caffe2/core/logging.cc b/caffe2/core/logging.cc
|
||||
index 1b4468e..1379f3a 100644
|
||||
--- a/caffe2/core/logging.cc
|
||||
+++ b/caffe2/core/logging.cc
|
||||
@@ -117,7 +117,7 @@ using fLB::FLAGS_logtostderr;
|
||||
|
||||
#endif // CAFFE2_USE_GFLAGS
|
||||
|
||||
-CAFFE2_DEFINE_int(caffe2_log_level, google::ERROR,
|
||||
+CAFFE2_DEFINE_int(caffe2_log_level, google::GLOG_ERROR,
|
||||
"The minimum log level that caffe2 will output.");
|
||||
|
||||
// Google glog's api does not have an external function that allows one to check
|
||||
@@ -134,15 +134,23 @@ bool IsGoogleLoggingInitialized();
|
||||
namespace caffe2 {
|
||||
bool InitCaffeLogging(int* argc, char** argv) {
|
||||
if (*argc == 0) return true;
|
||||
- if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized()) {
|
||||
+#if !(defined(_MSC_VER) && defined(GLOG_IS_A_DLL))
|
||||
+ // IsGoogleLoggingInitialized is not exported from the glog DLL
|
||||
+ // so we can't call it. If our program calls InitGoogleLogging twice glog will
|
||||
+ // abort it.
|
||||
+ if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized())
|
||||
+#endif
|
||||
+ {
|
||||
::google::InitGoogleLogging(argv[0]);
|
||||
+#if !defined(_MSC_VER)
|
||||
::google::InstallFailureSignalHandler();
|
||||
+#endif
|
||||
}
|
||||
// If caffe2_log_level is set and is lower than the min log level by glog,
|
||||
// we will transfer the caffe2_log_level setting to glog to override that.
|
||||
FLAGS_minloglevel = std::min(FLAGS_caffe2_log_level, FLAGS_minloglevel);
|
||||
// If caffe2_log_level is explicitly set, let's also turn on logtostderr.
|
||||
- if (FLAGS_caffe2_log_level < google::ERROR) {
|
||||
+ if (FLAGS_caffe2_log_level < google::GLOG_ERROR) {
|
||||
FLAGS_logtostderr = 1;
|
||||
}
|
||||
// Also, transfer the caffe2_log_level verbose setting to glog.
|
||||
@@ -154,7 +162,7 @@ bool InitCaffeLogging(int* argc, char** argv) {
|
||||
|
||||
void ShowLogInfoToStderr() {
|
||||
FLAGS_logtostderr = 1;
|
||||
- FLAGS_minloglevel = std::min(FLAGS_minloglevel, google::INFO);
|
||||
+ FLAGS_minloglevel = std::min(FLAGS_minloglevel, google::GLOG_INFO);
|
||||
}
|
||||
} // namespace caffe2
|
||||
|
||||
diff --git a/caffe2/core/logging_is_google_glog.h b/caffe2/core/logging_is_google_glog.h
|
||||
index 7dd2b4f..2df4435 100644
|
||||
--- a/caffe2/core/logging_is_google_glog.h
|
||||
+++ b/caffe2/core/logging_is_google_glog.h
|
||||
@@ -8,7 +8,7 @@
|
||||
// it. Some mobile platforms do not like stl_logging, so we add an
|
||||
// overload in that case as well.
|
||||
|
||||
-#if !defined(__CUDACC__) && !defined(CAFFE2_USE_MINIMAL_GOOGLE_GLOG)
|
||||
+#if !defined(__CUDARCH__) && !defined(CAFFE2_USE_MINIMAL_GOOGLE_GLOG)
|
||||
#include <glog/stl_logging.h>
|
||||
#else // !defined(__CUDACC__) && !!defined(CAFFE2_USE_MINIMAL_GOOGLE_GLOG)
|
||||
|
||||
diff --git a/caffe2/image/image_input_op.h b/caffe2/image/image_input_op.h
|
||||
index 9604e98..7d90014 100644
|
||||
--- a/caffe2/image/image_input_op.h
|
||||
+++ b/caffe2/image/image_input_op.h
|
||||
@@ -214,13 +214,13 @@ ImageInputOp<Context>::ImageInputOp(
|
||||
|
||||
// hard-coded PCA eigenvectors and eigenvalues, based on RBG channel order
|
||||
color_lighting_eigvecs_.push_back(
|
||||
- std::vector<float>{-144.7125, 183.396, 102.2295});
|
||||
+ std::vector<float>{-144.7125f, 183.396f, 102.2295f});
|
||||
color_lighting_eigvecs_.push_back(
|
||||
- std::vector<float>{-148.104, -1.1475, -207.57});
|
||||
+ std::vector<float>{-148.104f, -1.1475f, -207.57f});
|
||||
color_lighting_eigvecs_.push_back(
|
||||
- std::vector<float>{-148.818, -177.174, 107.1765});
|
||||
+ std::vector<float>{-148.818f, -177.174f, 107.1765f});
|
||||
|
||||
- color_lighting_eigvals_ = std::vector<float>{0.2175, 0.0188, 0.0045};
|
||||
+ color_lighting_eigvals_ = std::vector<float>{0.2175f, 0.0188f, 0.0045f};
|
||||
|
||||
CAFFE_ENFORCE_GT(batch_size_, 0, "Batch size should be nonnegative.");
|
||||
if (use_caffe_datum_) {
|
||||
diff --git a/caffe2/operators/batch_matmul_op.cc b/caffe2/operators/batch_matmul_op.cc
|
||||
index c2e578d..28cf030 100644
|
||||
--- a/caffe2/operators/batch_matmul_op.cc
|
||||
+++ b/caffe2/operators/batch_matmul_op.cc
|
||||
@@ -34,7 +34,7 @@ size (C x K x N) where C is the batch size and i ranges from 0 to C-1.
|
||||
b_dim1 = in[1].dims(2);
|
||||
}
|
||||
return vector<TensorShape> {
|
||||
- CreateTensorShape(vector<int> {
|
||||
+ CreateTensorShape(vector<TIndex> {
|
||||
in[0].dims(0), a_dim0, b_dim1},
|
||||
in[0].data_type())
|
||||
};
|
||||
diff --git a/caffe2/operators/layer_norm_op.cu b/caffe2/operators/layer_norm_op.cu
|
||||
index df13fc3..68bbc97 100644
|
||||
--- a/caffe2/operators/layer_norm_op.cu
|
||||
+++ b/caffe2/operators/layer_norm_op.cu
|
||||
@@ -252,8 +252,8 @@ bool LayerNormGradientOp<CUDAContext>::DoRunWithType<float>() {
|
||||
auto* ginput = Output(0);
|
||||
|
||||
const auto canonical_axis = norm_inputs.canonical_axis_index(axis_);
|
||||
- const int left = norm_inputs.size_to_dim(canonical_axis);
|
||||
- const int right = norm_inputs.size_from_dim(canonical_axis);
|
||||
+ const TIndex left = norm_inputs.size_to_dim(canonical_axis);
|
||||
+ const TIndex right = norm_inputs.size_from_dim(canonical_axis);
|
||||
|
||||
ginput->ResizeLike(norm_inputs);
|
||||
std::vector<TIndex> stats_dims(
|
||||
@@ -261,7 +261,7 @@ bool LayerNormGradientOp<CUDAContext>::DoRunWithType<float>() {
|
||||
stats_dims.push_back(1);
|
||||
dmean_.Resize(stats_dims);
|
||||
dstdev_.Resize(stats_dims);
|
||||
- gscratch_.Resize(std::vector<size_t>{left, right});
|
||||
+ gscratch_.Resize(std::vector<TIndex>{left, right});
|
||||
|
||||
std::vector<int> segs(left + 1);
|
||||
std::iota(segs.begin(), segs.end(), 0);
|
||||
@@ -291,7 +291,7 @@ bool LayerNormGradientOp<CUDAContext>::DoRunWithType<float>() {
|
||||
dout.data<float>(),
|
||||
gscratch_.mutable_data<float>());
|
||||
|
||||
- dstdev_.Resize(vector<size_t>{left, 1});
|
||||
+ dstdev_.Resize(vector<TIndex>{left, 1});
|
||||
// dstdev = reduce(temp1)
|
||||
allocScratchAndReduce(
|
||||
gscratch_.data<float>(),
|
||||
diff --git a/caffe2/operators/lengths_top_k_op.cc b/caffe2/operators/lengths_top_k_op.cc
|
||||
index c871d53..bad741a 100644
|
||||
--- a/caffe2/operators/lengths_top_k_op.cc
|
||||
+++ b/caffe2/operators/lengths_top_k_op.cc
|
||||
@@ -14,7 +14,7 @@ bool LengthsTopKOp<T, Context>::RunOnDevice() {
|
||||
|
||||
output_topk_values->Resize(N * k_);
|
||||
output_topk_indices->Resize(N * k_);
|
||||
- std::vector<int> output_dims = std::vector<int>({N, k_});
|
||||
+ std::vector<TIndex> output_dims = std::vector<TIndex>({N, k_});
|
||||
output_topk_values->Reshape(output_dims);
|
||||
output_topk_indices->Reshape(output_dims);
|
||||
T* output_topk_values_data = output_topk_values->template mutable_data<T>();
|
||||
diff --git a/caffe2/operators/pool_op_cudnn.cu b/caffe2/operators/pool_op_cudnn.cu
|
||||
index a380d8d..b0cd326 100644
|
||||
--- a/caffe2/operators/pool_op_cudnn.cu
|
||||
+++ b/caffe2/operators/pool_op_cudnn.cu
|
||||
@@ -467,6 +467,15 @@ class CuDNNPoolGradientOp : public ConvPoolOpBase<CUDAContext> {
|
||||
cudnnPoolingDescriptor_t pooling_desc_;
|
||||
cudnnPoolingMode_t mode_;
|
||||
|
||||
+// MSVC defines IN and OUT in minwindef.h
|
||||
+#ifdef IN
|
||||
+#undef IN
|
||||
+#endif
|
||||
+
|
||||
+#ifdef OUT
|
||||
+#undef OUT
|
||||
+#endif
|
||||
+
|
||||
// Input: X, Y, dY
|
||||
// Output: dX
|
||||
INPUT_TAGS(IN, OUT, OUT_GRAD);
|
||||
diff --git a/caffe2/operators/recurrent_op_cudnn.cc b/caffe2/operators/recurrent_op_cudnn.cc
|
||||
index 7777813..58bc8c3 100644
|
||||
--- a/caffe2/operators/recurrent_op_cudnn.cc
|
||||
+++ b/caffe2/operators/recurrent_op_cudnn.cc
|
||||
@@ -115,10 +115,11 @@ void RecurrentBaseOp<T>::initialize(
|
||||
|
||||
// RNN setup
|
||||
{
|
||||
- CUDNN_ENFORCE(cudnnSetRNNDescriptor(
|
||||
+// Do not use #if condition inside CUDNN_ENFORCE
|
||||
+// to avoid macro expansion errors.
|
||||
#if CUDNN_MAJOR >= 7
|
||||
+CUDNN_ENFORCE(cudnnSetRNNDescriptor(
|
||||
cudnn_wrapper_.inline_cudnn_handle(),
|
||||
-#endif
|
||||
rnnDesc_,
|
||||
hiddenSize,
|
||||
numLayers,
|
||||
@@ -126,10 +127,19 @@ void RecurrentBaseOp<T>::initialize(
|
||||
rnnInput,
|
||||
rnnDirection,
|
||||
rnnMode,
|
||||
-#if CUDNN_MAJOR >= 7
|
||||
CUDNN_RNN_ALGO_STANDARD, // TODO: verify correctness / efficiency.
|
||||
-#endif
|
||||
cudnnTypeWrapper<T>::type));
|
||||
+#else
|
||||
+ CUDNN_ENFORCE(cudnnSetRNNDescriptor(
|
||||
+ rnnDesc_,
|
||||
+ hiddenSize,
|
||||
+ numLayers,
|
||||
+ dropoutDesc_,
|
||||
+ rnnInput,
|
||||
+ rnnDirection,
|
||||
+ rnnMode,
|
||||
+ cudnnTypeWrapper<T>::type));
|
||||
+#endif // CUDNN_MAJOR >= 7
|
||||
}
|
||||
// X setup
|
||||
{
|
||||
diff --git a/caffe2/utils/CMakeLists.txt b/caffe2/utils/CMakeLists.txt
|
||||
index f90af5a..919a638 100644
|
||||
--- a/caffe2/utils/CMakeLists.txt
|
||||
+++ b/caffe2/utils/CMakeLists.txt
|
||||
@@ -27,6 +27,10 @@ exclude(Caffe2_CPU_SRCS "${Caffe2_CPU_SRCS}" ${Caffe2_GPU_SRCS})
|
||||
# will directly link nnpack pthreadpool.
|
||||
file(GLOB_RECURSE tmp pthreadpool*)
|
||||
exclude(Caffe2_CPU_SRCS "${Caffe2_CPU_SRCS}" ${tmp})
|
||||
+if(MSVC)
|
||||
+ file(GLOB_RECURSE tmp *ThreadPool.cc)
|
||||
+ exclude(Caffe2_CPU_SRCS "${Caffe2_CPU_SRCS}" ${tmp})
|
||||
+endif()
|
||||
|
||||
# ---[ GPU test files
|
||||
file(GLOB_RECURSE tmp *_gpu_test.cc)
|
||||
diff --git a/caffe2/utils/GpuBitonicSort.cuh b/caffe2/utils/GpuBitonicSort.cuh
|
||||
index f52bb50..a199bcb 100644
|
||||
--- a/caffe2/utils/GpuBitonicSort.cuh
|
||||
+++ b/caffe2/utils/GpuBitonicSort.cuh
|
||||
@@ -39,9 +39,11 @@ __device__ inline void bitonicSort(K* keys,
|
||||
// Assume the sort is taking place in shared memory
|
||||
// static_assert(Power2SortSize * (sizeof(K) + sizeof(V)) < 32768,
|
||||
// "sort data too large (>32768 bytes)");
|
||||
- static_assert(math::integerIsPowerOf2(Power2SortSize),
|
||||
+ static_assert(math::integerIsPowerOf2(
|
||||
+ std::integral_constant<int, Power2SortSize>::value),
|
||||
"sort size must be power of 2");
|
||||
- static_assert(math::integerIsPowerOf2(ThreadsPerBlock),
|
||||
+ static_assert(math::integerIsPowerOf2(
|
||||
+ std::integral_constant<int, ThreadsPerBlock>::value),
|
||||
"threads in block must be power of 2");
|
||||
|
||||
// If what we are sorting is too small, then not all threads
|
||||
@@ -107,7 +109,8 @@ __device__ inline void warpBitonicSort(K* keys,
|
||||
// Smaller sorts should use a warp shuffle sort
|
||||
static_assert(Power2SortSize > kWarpSize,
|
||||
"sort not large enough");
|
||||
- static_assert(math::integerIsPowerOf2(Power2SortSize),
|
||||
+ static_assert(math::integerIsPowerOf2(
|
||||
+ std::integral_constant<int, Power2SortSize>::value),
|
||||
"sort size must be power of 2");
|
||||
static_assert(Power2SortSize <= kMaxBitonicSortSize,
|
||||
"sort size <= 4096 only supported");
|
||||
diff --git a/caffe2/utils/math.h b/caffe2/utils/math.h
|
||||
index 6c352dc..a1eda9d 100644
|
||||
--- a/caffe2/utils/math.h
|
||||
+++ b/caffe2/utils/math.h
|
||||
@@ -426,18 +426,10 @@ constexpr T roundUp(T a, T b) {
|
||||
return divUp<T>(a, b) * b;
|
||||
}
|
||||
|
||||
-// Returns true if the given integer type is a power-of-2 (positive only)
|
||||
-// Note(jiayq): windows reported an error per
|
||||
-// https://github.com/caffe2/caffe2/issues/997
|
||||
-// and as a result will make it a macro.
|
||||
-#ifdef _MSC_VER
|
||||
-#define integerIsPowerOf2(v) ((v) && !((v) & ((v) - 1)))
|
||||
-#else // _MSC_VER
|
||||
template <typename T>
|
||||
constexpr bool integerIsPowerOf2(T v) {
|
||||
return (v && !(v & (v - 1)));
|
||||
}
|
||||
-#endif // _MSC_VER
|
||||
|
||||
// Returns log2(n) for a positive integer type
|
||||
template <typename T>
|
||||
diff --git a/cmake/Cuda.cmake b/cmake/Cuda.cmake
|
||||
index df70e2f..ca1b123 100644
|
||||
--- a/cmake/Cuda.cmake
|
||||
+++ b/cmake/Cuda.cmake
|
||||
@@ -37,6 +37,10 @@ function(caffe2_detect_installed_gpus out_variable)
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(__nvcc_res EQUAL 0)
|
||||
+ # nvcc outputs text containing line breaks when building with MSVC.
|
||||
+ # The line below prevents CMake from inserting a variable with line
|
||||
+ # breaks in the cache
|
||||
+ string(REGEX MATCH "([1-9].[0-9])" __nvcc_out "${__nvcc_out}")
|
||||
string(REPLACE "2.1" "2.1(2.0)" __nvcc_out "${__nvcc_out}")
|
||||
set(CUDA_gpu_detect_output ${__nvcc_out} CACHE INTERNAL "Returned GPU architetures from caffe_detect_gpus tool" FORCE)
|
||||
endif()
|
||||
@@ -249,7 +253,7 @@ endif()
|
||||
# Debug and Release symbol support
|
||||
if (MSVC)
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||
- if (${BUILD_SHARED_LIBS})
|
||||
+ if (NOT USE_STATIC_RUNTIME)
|
||||
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -MD")
|
||||
else()
|
||||
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -MT")
|
||||
@@ -259,7 +263,7 @@ if (MSVC)
|
||||
"Caffe2 currently does not support the combination of MSVC, Cuda "
|
||||
"and Debug mode. Either set USE_CUDA=OFF or set the build type "
|
||||
"to Release")
|
||||
- if (${BUILD_SHARED_LIBS})
|
||||
+ if (NOT USE_STATIC_RUNTIME)
|
||||
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -MDd")
|
||||
else()
|
||||
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -MTd")
|
||||
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
|
||||
index afb6b68..bdad8b6 100644
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -182,6 +182,15 @@ if(USE_OPENCV)
|
||||
message(WARNING "Not compiling with OpenCV. Suppress this warning with -DUSE_OPENCV=OFF")
|
||||
set(USE_OPENCV OFF)
|
||||
endif()
|
||||
+ if(USE_OPENCV AND VCPKG_TARGET_TRIPLET MATCHES static)
|
||||
+ find_package(LibLZMA QUIET)
|
||||
+ if(LIBLZMA_FOUND)
|
||||
+ list(APPEND Caffe2_DEPENDENCY_LIBS ${LIBLZMA_LIBRARIES})
|
||||
+ else()
|
||||
+ message(WARNING "Not compiling with OpenCV. Could not find liblzma. Suppress this warning with -DUSE_OPENCV=OFF")
|
||||
+ set(USE_OPENCV OFF)
|
||||
+ endif()
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
# ---[ FFMPEG
|
||||
diff --git a/cmake/Modules/FindGlog.cmake b/cmake/Modules/FindGlog.cmake
|
||||
index 1167532..9780ba5 100644
|
||||
--- a/cmake/Modules/FindGlog.cmake
|
||||
+++ b/cmake/Modules/FindGlog.cmake
|
||||
@@ -27,6 +27,10 @@ if(MSVC)
|
||||
endif()
|
||||
if(TARGET ${GLOG_LIBRARY})
|
||||
get_target_property(GLOG_INCLUDE_DIR ${GLOG_LIBRARY} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
+ get_target_property(GLOG_TYPE ${GLOG_LIBRARY} TYPE)
|
||||
+ if("${GLOG_TYPE}" STREQUAL "SHARED_LIBRARY")
|
||||
+ add_definitions(-DGLOG_IS_A_DLL=1)
|
||||
+ endif()
|
||||
endif()
|
||||
else()
|
||||
find_library(GLOG_LIBRARY glog
|
||||
diff --git a/cmake/ProtoBuf.cmake b/cmake/ProtoBuf.cmake
|
||||
index 89975c8..e37d6da 100644
|
||||
--- a/cmake/ProtoBuf.cmake
|
||||
+++ b/cmake/ProtoBuf.cmake
|
||||
@@ -13,6 +13,9 @@ function(custom_protobuf_find)
|
||||
# so we turn it off here.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" PARENT_SCOPE)
|
||||
endif()
|
||||
+ if(MSVC)
|
||||
+ set(protobuf_MSVC_STATIC_RUNTIME ${USE_STATIC_RUNTIME})
|
||||
+ endif()
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/protobuf/cmake)
|
||||
caffe2_include_directories(${PROJECT_SOURCE_DIR}/third_party/protobuf/src)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS libprotobuf)
|
||||
diff --git a/cmake/Summary.cmake b/cmake/Summary.cmake
|
||||
index b7423a6..2996484 100644
|
||||
--- a/cmake/Summary.cmake
|
||||
+++ b/cmake/Summary.cmake
|
||||
@@ -19,6 +19,13 @@ function (Caffe2_print_configuration_summary)
|
||||
message(STATUS " System : ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS " C++ compiler : ${CMAKE_CXX_COMPILER}")
|
||||
message(STATUS " C++ compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
+ if(MSVC)
|
||||
+ if(USE_STATIC_RUNTIME)
|
||||
+ message(STATUS " Runtime : static (/MT)")
|
||||
+ else()
|
||||
+ message(STATUS " Runtime : dynamic (/MD)")
|
||||
+ endif()
|
||||
+ endif()
|
||||
message(STATUS " Protobuf compiler : ${PROTOBUF_PROTOC_EXECUTABLE}")
|
||||
message(STATUS " CXX flags : ${CMAKE_CXX_FLAGS}")
|
||||
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
|
@ -1,18 +0,0 @@
|
||||
diff --git a/caffe2/core/logging_is_google_glog.h b/caffe2/core/logging_is_google_glog.h
|
||||
index 2df4435..408bb4a 100644
|
||||
--- a/caffe2/core/logging_is_google_glog.h
|
||||
+++ b/caffe2/core/logging_is_google_glog.h
|
||||
@@ -30,5 +30,13 @@ INSTANTIATE_FOR_CONTAINER(std::set)
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
+#ifdef IN
|
||||
+#undef IN
|
||||
+#endif
|
||||
+
|
||||
+#ifdef OUT
|
||||
+#undef OUT
|
||||
+#endif
|
||||
+
|
||||
|
||||
#endif // CAFFE2_CORE_LOGGING_IS_GOOGLE_GLOG_H_
|
@ -1,102 +1,2 @@
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO caffe2/caffe2
|
||||
REF eab13a2d5c807bf5d49efd4584787b639a981b79
|
||||
SHA512 505a8540b0c28329c4e2ce443ac8e198c1ee613eb6b932927ee9d04c8afdc95081f3c4581408b7097d567840427b31f6d7626ea80f27e56532f2f2e6acd87023
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
msvc-fixes.patch
|
||||
fix-space.patch
|
||||
fix-protobuf-deprecated.patch
|
||||
no-inout-macros.patch
|
||||
fix-isgloginitialized.patch
|
||||
)
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
set(USE_STATIC_RUNTIME ON)
|
||||
else()
|
||||
set(USE_STATIC_RUNTIME OFF)
|
||||
endif()
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(EXECUTABLE_SUFFIX ".exe")
|
||||
else()
|
||||
set(EXECUTABLE_SUFFIX "")
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
# Set to ON to use python
|
||||
-DBUILD_PYTHON=OFF
|
||||
-DUSE_STATIC_RUNTIME=${USE_STATIC_RUNTIME}
|
||||
-DUSE_GFLAGS=ON
|
||||
-DUSE_GLOG=ON
|
||||
# Cannot use OpenCV without USE_CUDA=ON right now
|
||||
-DUSE_OPENCV=OFF
|
||||
-DUSE_THREADS=ON
|
||||
# Uncomment to use MKL
|
||||
# -DBLAS=MKL
|
||||
-DUSE_CUDA=OFF
|
||||
-DUSE_FFMPEG=OFF
|
||||
-DUSE_GLOO=OFF
|
||||
-DUSE_LEVELDB=OFF
|
||||
-DUSE_LITE_PROTO=OFF
|
||||
-DUSE_METAL=OFF
|
||||
-DUSE_MOBILE_OPENGL=OFF
|
||||
-DUSE_MPI=OFF
|
||||
-DUSE_NCCL=OFF
|
||||
-DUSE_NERVANA_GPU=OFF
|
||||
-DUSE_NNPACK=OFF
|
||||
-DUSE_OBSERVERS=OFF
|
||||
-DUSE_OPENMP=ON
|
||||
-DUSE_REDIS=OFF
|
||||
-DUSE_ROCKSDB=OFF
|
||||
-DUSE_SNPE=OFF
|
||||
-DUSE_ZMQ=OFF
|
||||
-DBUILD_TEST=OFF
|
||||
-DPROTOBUF_PROTOC_EXECUTABLE:FILEPATH=${CURRENT_INSTALLED_DIR}/tools/protobuf/protoc${EXECUTABLE_SUFFIX}
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
# Remove folders from install
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/caffe")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/caffe2")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/caffe")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/caffe2")
|
||||
|
||||
# Remove empty directories from include (should probably fix or
|
||||
# patch caffe2 install script)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/test")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/python")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/experiments/python")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/contrib/opengl")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/contrib/nnpack")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/contrib/libopencl-stub")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/contrib/docker-ubuntu-14.04")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/caffe2/binaries")
|
||||
|
||||
# Move bin to tools
|
||||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools")
|
||||
file(GLOB BINARIES "${CURRENT_PACKAGES_DIR}/bin/*${EXECUTABLE_SUFFIX}")
|
||||
foreach(binary IN LISTS BINARIES)
|
||||
get_filename_component(binary_name ${binary} NAME)
|
||||
file(RENAME ${binary} "${CURRENT_PACKAGES_DIR}/tools/${binary_name}")
|
||||
endforeach()
|
||||
|
||||
# Remove bin directory
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
endif()
|
||||
|
||||
# Remove headers and tools from debug build
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
# install license
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
message(WARNING "The 'caffe2' port is deprecated, using 'libtorch' instead")
|
||||
|
@ -1,20 +1,14 @@
|
||||
{
|
||||
"name": "caffe2",
|
||||
"version": "0.8.1",
|
||||
"port-version": 7,
|
||||
"port-version": 8,
|
||||
"description": "Caffe2 is a lightweight, modular, and scalable deep learning framework.",
|
||||
"homepage": "https://github.com/caffe2/caffe2",
|
||||
"license": "Apache-2.0",
|
||||
"supports": "!x86",
|
||||
"dependencies": [
|
||||
"eigen3",
|
||||
"gflags",
|
||||
"glog",
|
||||
"lmdb",
|
||||
"protobuf",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
"name": "libtorch",
|
||||
"default-features": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
61
ports/libtorch/fix-c10-glog.patch
Normal file
61
ports/libtorch/fix-c10-glog.patch
Normal file
@ -0,0 +1,61 @@
|
||||
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
|
142
ports/libtorch/fix-cmake.patch
Normal file
142
ports/libtorch/fix-cmake.patch
Normal file
@ -0,0 +1,142 @@
|
||||
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
|
32
ports/libtorch/fix-fbgemm-include.patch
Normal file
32
ports/libtorch/fix-fbgemm-include.patch
Normal file
@ -0,0 +1,32 @@
|
||||
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() {
|
100
ports/libtorch/fix-windows.patch
Normal file
100
ports/libtorch/fix-windows.patch
Normal file
@ -0,0 +1,100 @@
|
||||
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")
|
183
ports/libtorch/portfile.cmake
Normal file
183
ports/libtorch/portfile.cmake
Normal file
@ -0,0 +1,183 @@
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO pytorch/pytorch
|
||||
REF v1.12.1
|
||||
SHA512 afeb551904ebd9b5901ae623a98eadbb3045115247cedf8006a940742cfad04e5ce24cfaf363336a9ed88d7ce6a4ac53dbb6a5c690aef6efdf20477c3a22c7ca
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
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
|
||||
)
|
||||
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")
|
||||
|
||||
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
|
||||
LOGNAME codegen-flatc-mobile_bytecode
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}/torch/csrc/jit/serialization"
|
||||
)
|
||||
|
||||
find_program(PROTOC NAMES protoc PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf" REQUIRED NO_DEFAULT_PATH NO_CMAKE_PATH)
|
||||
message(STATUS "Using protoc: ${PROTOC}")
|
||||
|
||||
x_vcpkg_get_python_packages(
|
||||
PYTHON_VERSION 3
|
||||
PACKAGES typing-extensions pyyaml numpy
|
||||
OUT_PYTHON_VAR PYTHON3
|
||||
)
|
||||
message(STATUS "Using Python3: ${PYTHON3}")
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
dist USE_DISTRIBUTED # MPI, Gloo, TensorPipe
|
||||
zstd USE_ZSTD
|
||||
fftw3 USE_FFTW
|
||||
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
|
||||
leveldb USE_LEVELDB
|
||||
opencl USE_OPENCL
|
||||
cuda USE_CUDA
|
||||
cuda USE_CUDNN
|
||||
cuda USE_NCCL
|
||||
cuda USE_SYSTEM_NCCL
|
||||
cuda USE_NVRTC
|
||||
cuda AT_CUDA_ENABLED
|
||||
cuda AT_CUDNN_ENABLED
|
||||
vulkan USE_VULKAN
|
||||
vulkan USE_VULKAN_WRAPPER
|
||||
vulkan USE_VULKAN_SHADERC_RUNTIME
|
||||
vulkan USE_VULKAN_RELAXED_PRECISION
|
||||
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`
|
||||
)
|
||||
|
||||
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)
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_OSX)
|
||||
list(APPEND FEATURE_OPTIONS -DUSE_LIBUV=ON)
|
||||
endif()
|
||||
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()
|
||||
list(APPEND FEATURE_OPTIONS -DINTERN_BUILD_MOBILE=OFF)
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
DISABLE_PARALLEL_CONFIGURE
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
-DProtobuf_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}
|
||||
-DCAFFE2_CUSTOM_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}
|
||||
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON3}
|
||||
-DPython3_EXECUTABLE:FILEPATH=${PYTHON3}
|
||||
-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_PYTORCH_QNNPACK=OFF
|
||||
-DUSE_KINETO=OFF
|
||||
-DUSE_ROCM=OFF
|
||||
-DUSE_DEPLOY=OFF
|
||||
-DUSE_FFTW=OFF
|
||||
-DUSE_NUMA=OFF
|
||||
-DUSE_MPI=${VCPKG_TARGET_IS_LINUX}
|
||||
-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
|
||||
-DAT_MKLDNN_ENABLED=OFF
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
USE_NUMA
|
||||
USE_SYSTEM_BIND11
|
||||
USE_VULKAN_WRAPPER
|
||||
MKLDNN_CPU_RUNTIME
|
||||
)
|
||||
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()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
"${CURRENT_PACKAGES_DIR}/share"
|
||||
"${CURRENT_PACKAGES_DIR}/include/c10/test/core/impl"
|
||||
"${CURRENT_PACKAGES_DIR}/include/c10/hip"
|
||||
"${CURRENT_PACKAGES_DIR}/include/c10/benchmark"
|
||||
"${CURRENT_PACKAGES_DIR}/include/c10/test"
|
||||
"${CURRENT_PACKAGES_DIR}/include/c10/cuda"
|
||||
"${CURRENT_PACKAGES_DIR}/include/c10d/quantization"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/ideep/operators/quantization"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/python"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/share/contrib/depthwise"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/share/contrib/nnpack"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/mobile"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/experiments/python"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/test"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/utils/hip"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/opt/nql/tests"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/contrib"
|
||||
"${CURRENT_PACKAGES_DIR}/include/caffe2/core/nomnigraph/Representations"
|
||||
"${CURRENT_PACKAGES_DIR}/include/torch/csrc"
|
||||
)
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright")
|
15
ports/libtorch/pytorch-pr-85958.patch
Normal file
15
ports/libtorch/pytorch-pr-85958.patch
Normal file
@ -0,0 +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
|
||||
+++ b/aten/src/ATen/cpu/vec/vec_base.h
|
||||
@@ -132,8 +132,9 @@ struct Vectorized {
|
||||
// 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() {
|
||||
- return VECTOR_WIDTH / sizeof(T);
|
||||
+ return VECTOR_WIDTH / size_T;
|
||||
}
|
||||
Vectorized() : values{static_cast<T>(0)} {}
|
||||
Vectorized(T val) {
|
276
ports/libtorch/use-flatbuffers2.patch
Normal file
276
ports/libtorch/use-flatbuffers2.patch
Normal file
@ -0,0 +1,276 @@
|
||||
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()),
|
257
ports/libtorch/vcpkg-dependencies.cmake
Normal file
257
ports/libtorch/vcpkg-dependencies.cmake
Normal file
@ -0,0 +1,257 @@
|
||||
# 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()
|
||||
|
||||
find_path(FP16_INCLUDE_DIRS "fp16.h" REQUIRED)
|
||||
find_path(PSIMD_INCLUDE_DIRS "psimd.h" REQUIRED)
|
||||
find_path(FXDIV_INCLUDE_DIRS "fxdiv.h" REQUIRED)
|
||||
|
||||
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
|
||||
find_package(unofficial-pthreadpool CONFIG REQUIRED) # unofficial::pthreadpool
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS
|
||||
gemmlowp::gemmlowp gflags::gflags glog::glog
|
||||
cpuinfo::clog cpuinfo::cpuinfo unofficial::pthreadpool
|
||||
)
|
||||
link_directories(
|
||||
$<$<CONFIG:Debug>:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib>
|
||||
$<$<CONFIG:Release>:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib>
|
||||
)
|
||||
|
||||
set(USE_PTHREADPOOL 1)
|
||||
set(USE_INTERNAL_PTHREADPOOL_IMPL 0)
|
||||
add_compile_definitions(USE_PTHREADPOOL)
|
||||
|
||||
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 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()
|
122
ports/libtorch/vcpkg.json
Normal file
122
ports/libtorch/vcpkg.json
Normal file
@ -0,0 +1,122 @@
|
||||
{
|
||||
"name": "libtorch",
|
||||
"version": "1.12.1",
|
||||
"description": "Tensors and Dynamic neural networks in Python with strong GPU acceleration",
|
||||
"homepage": "https://pytorch.org/",
|
||||
"license": null,
|
||||
"supports": "(windows & !static) | osx | linux",
|
||||
"dependencies": [
|
||||
"cpuinfo",
|
||||
"eigen3",
|
||||
"flatbuffers",
|
||||
{
|
||||
"name": "flatbuffers",
|
||||
"host": true
|
||||
},
|
||||
"fmt",
|
||||
"foxi",
|
||||
"gemmlowp",
|
||||
"gflags",
|
||||
"glog",
|
||||
"lmdb",
|
||||
{
|
||||
"name": "mpi",
|
||||
"platform": "linux"
|
||||
},
|
||||
"onnx",
|
||||
"onnx-optimizer",
|
||||
{
|
||||
"name": "openblas",
|
||||
"platform": "windows"
|
||||
},
|
||||
"protobuf",
|
||||
{
|
||||
"name": "protobuf",
|
||||
"host": true
|
||||
},
|
||||
"sleef",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-get-python-packages",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"xnnpack"
|
||||
],
|
||||
"features": {
|
||||
"dist": {
|
||||
"description": "Use distributed with MPI, Gloo, libuv, TensorPipe",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "gloo",
|
||||
"platform": "linux"
|
||||
},
|
||||
{
|
||||
"name": "libuv",
|
||||
"platform": "windows | osx"
|
||||
},
|
||||
{
|
||||
"name": "openmpi",
|
||||
"platform": "linux | osx"
|
||||
},
|
||||
{
|
||||
"name": "tensorpipe",
|
||||
"platform": "linux | osx"
|
||||
}
|
||||
]
|
||||
},
|
||||
"leveldb": {
|
||||
"description": "Build with LevelDB",
|
||||
"dependencies": [
|
||||
"leveldb",
|
||||
"snappy"
|
||||
]
|
||||
},
|
||||
"nnpack": {
|
||||
"description": "Build with NNPack",
|
||||
"supports": "linux | osx",
|
||||
"dependencies": [
|
||||
"nnpack"
|
||||
]
|
||||
},
|
||||
"opencv": {
|
||||
"description": "Build with OpenCV 3.x",
|
||||
"dependencies": [
|
||||
"opencv"
|
||||
]
|
||||
},
|
||||
"tbb": {
|
||||
"description": "Build with Intel TBB",
|
||||
"dependencies": [
|
||||
"tbb"
|
||||
]
|
||||
},
|
||||
"vulkan": {
|
||||
"description": "Build with Vulkan GPU backend",
|
||||
"supports": "!windows",
|
||||
"dependencies": [
|
||||
"vulkan"
|
||||
]
|
||||
},
|
||||
"xnnpack": {
|
||||
"description": "Build with XNNPack",
|
||||
"dependencies": [
|
||||
"xnnpack"
|
||||
]
|
||||
},
|
||||
"zstd": {
|
||||
"description": "Build with ZSTD",
|
||||
"dependencies": [
|
||||
"zstd"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -45,7 +45,7 @@ vcpkg_cmake_configure(
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/Tensorpipe")
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/Tensorpipe" PACKAGE_NAME "Tensorpipe")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tensorpipe",
|
||||
"version-date": "2022-03-16",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"description": "A tensor-aware point-to-point communication primitive for machine learning",
|
||||
"homepage": "https://github.com/pytorch/tensorpipe",
|
||||
"license": "BSD-3-Clause",
|
||||
|
@ -5,15 +5,16 @@ endif()
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO google/XNNPACK
|
||||
REF 5223fd1922d9d965ddb07865d1d13293069fab65 # 2021-05-17
|
||||
SHA512 5c1eb9171a046c683d5a96ae70b6dab36c415c981e8f29857d16ad67afa22681f0fe6f7623527200fd954403d50b036bb2892ba44e397d639860b9ec4873e7c6
|
||||
REF ae108ef49aa5623b896fc93d4298c49d1750d9ba # 2022-02-17
|
||||
SHA512 597354c8c5b786ba24a8c9759409fee7b090ec497547919da4c5786a571b5ef237d1da204b7fd553217089792acb5e40ea1e6d26e3a638aa32df1e63c14d1c91
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
use-packages.patch
|
||||
use-c-cpp-11.patch
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DXNNPACK_USE_SYSTEM_LIBS=ON
|
||||
-DXNNPACK_ENABLE_ASSEMBLY=ON
|
||||
@ -26,8 +27,8 @@ 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
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin
|
||||
${CURRENT_PACKAGES_DIR}/debug/share
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/bin"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
)
|
||||
|
14
ports/xnnpack/use-c-cpp-11.patch
Normal file
14
ports/xnnpack/use-c-cpp-11.patch
Normal file
@ -0,0 +1,14 @@
|
||||
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,17 +1,17 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b69ce50c..1e8938b7 100755
|
||||
index 2ca06ee..b0d8873 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -3042,7 +3032,7 @@ ELSE()
|
||||
ENDIF()
|
||||
@@ -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)
|
||||
IF(WIN32)
|
||||
# Target Windows 7+ API
|
||||
@@ -3057,7 +3047,7 @@ IF(LIBM)
|
||||
TARGET_INCLUDE_DIRECTORIES(all_microkernels PRIVATE include src)
|
||||
TARGET_INCLUDE_DIRECTORIES(packing PRIVATE include src)
|
||||
@@ -6547,7 +6547,7 @@ IF(LIBM)
|
||||
ENDIF()
|
||||
|
||||
# ---[ Configure clog
|
||||
@ -20,25 +20,27 @@ index b69ce50c..1e8938b7 100755
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(CLOG_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(CLOG_RUNTIME_TYPE "${CPUINFO_RUNTIME_TYPE}" CACHE STRING "")
|
||||
@@ -3075,10 +3065,9 @@ IF(NOT TARGET clog)
|
||||
@@ -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(false)
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
|
||||
SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
|
||||
@@ -3096,10 +3085,11 @@ IF(NOT TARGET cpuinfo)
|
||||
@@ -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 PUBLIC cpuinfo::clog cpuinfo::cpuinfo)
|
||||
+TARGET_LINK_LIBRARIES(XNNPACK PRIVATE cpuinfo::clog cpuinfo::cpuinfo)
|
||||
+TARGET_LINK_LIBRARIES(jit PRIVATE cpuinfo::clog)
|
||||
|
||||
# ---[ Configure pthreadpool
|
||||
-IF(NOT TARGET pthreadpool)
|
||||
@ -46,8 +48,21 @@ index b69ce50c..1e8938b7 100755
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -3119,7 +3109,7 @@ ENDIF()
|
||||
TARGET_LINK_LIBRARIES(XNNPACK PUBLIC pthreadpool)
|
||||
@@ -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)
|
||||
@ -55,13 +70,17 @@ index b69ce50c..1e8938b7 100755
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -3135,10 +3125,11 @@ IF(NOT TARGET fxdiv)
|
||||
@@ -6630,12 +6631,13 @@ IF(NOT TARGET fxdiv)
|
||||
SET_PROPERTY(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fxdiv)
|
||||
+find_path(FXDIV_INCLUDE_DIRS "fxdiv.h")
|
||||
-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)
|
||||
@ -69,13 +88,19 @@ index b69ce50c..1e8938b7 100755
|
||||
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
|
||||
SET(FP16_BUILD_TESTS OFF CACHE BOOL "")
|
||||
SET(FP16_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -3154,12 +3145,17 @@ IF(NOT TARGET fp16)
|
||||
@@ -6651,15 +6653,21 @@ IF(NOT TARGET fp16)
|
||||
SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fp16)
|
||||
+find_path(FP16_INCLUDE_DIRS "fp16.h")
|
||||
-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
|
||||
@ -83,7 +108,8 @@ index b69ce50c..1e8938b7 100755
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
+install(EXPORT xnnpack-config NAMESPACE unofficial::
|
||||
+install(EXPORT xnnpack-config
|
||||
+ NAMESPACE unofficial::
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xnnpack)
|
||||
|
||||
# ---[ XNNPACK unit tests
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "xnnpack",
|
||||
"version-date": "2021-05-17",
|
||||
"port-version": 2,
|
||||
"version-date": "2022-02-17",
|
||||
"description": "High-efficiency floating-point neural network inference operators for mobile, server, and Web",
|
||||
"homepage": "https://github.com/google/XNNPACK",
|
||||
"license": "BSD-3-Clause",
|
||||
|
@ -1286,7 +1286,7 @@
|
||||
},
|
||||
"caffe2": {
|
||||
"baseline": "0.8.1",
|
||||
"port-version": 7
|
||||
"port-version": 8
|
||||
},
|
||||
"cairo": {
|
||||
"baseline": "1.17.6",
|
||||
@ -4384,6 +4384,10 @@
|
||||
"baseline": "1.2.0",
|
||||
"port-version": 2
|
||||
},
|
||||
"libtorch": {
|
||||
"baseline": "1.12.1",
|
||||
"port-version": 0
|
||||
},
|
||||
"libtorrent": {
|
||||
"baseline": "2.0.8",
|
||||
"port-version": 0
|
||||
@ -7510,7 +7514,7 @@
|
||||
},
|
||||
"tensorpipe": {
|
||||
"baseline": "2022-03-16",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"termcolor": {
|
||||
"baseline": "2.1.0",
|
||||
@ -8301,8 +8305,8 @@
|
||||
"port-version": 0
|
||||
},
|
||||
"xnnpack": {
|
||||
"baseline": "2021-05-17",
|
||||
"port-version": 2
|
||||
"baseline": "2022-02-17",
|
||||
"port-version": 0
|
||||
},
|
||||
"xorg-macros": {
|
||||
"baseline": "1.19.3",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "6e991b0e1b3cfcc46ba3dca541a9c7055a015102",
|
||||
"version": "0.8.1",
|
||||
"port-version": 8
|
||||
},
|
||||
{
|
||||
"git-tree": "83f1ccbf682aad8aacd3d74e8880becad6eb8d91",
|
||||
"version": "0.8.1",
|
||||
|
9
versions/l-/libtorch.json
Normal file
9
versions/l-/libtorch.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "c9504da41dc33e2294aeda9e3c215c505f1627d0",
|
||||
"version": "1.12.1",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "eed8e7f9952716b9aa7fcde453fad358b6b7bd2f",
|
||||
"version-date": "2022-03-16",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "4b982c4ade4582a5728384f2871610b107fe1b9f",
|
||||
"version-date": "2022-03-16",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "439631254e564280e520c848b6b16e259c79b422",
|
||||
"version-date": "2022-02-17",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "dba10dfefac481caee9f94c49fc60878c5bb57a1",
|
||||
"version-date": "2021-05-17",
|
||||
|
Loading…
Reference in New Issue
Block a user