Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtorch: new recipe #24759

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions recipes/libtorch/all/conan-official-libtorch-vars.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ATenConfig.cmake variables
set(ATEN_FOUND 1)

# Caffe2Config.cmake variables
set(Caffe2_MAIN_LIBS torch)
set(CAFFE2_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS})

# TorchConfig.cmake variables
set(TORCH_FOUND TRUE)
set(TORCH_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS})
set(TORCH_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES})
set(TORCH_CXX_FLAGS)
59 changes: 59 additions & 0 deletions recipes/libtorch/all/conan_deps.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# A wrapper for https://github.com/pytorch/pytorch/blob/v2.4.0/cmake/Dependencies.cmake

# Moved initialization of these vars here so they can be overridden
set(ATen_CPU_DEPENDENCY_LIBS)
set(ATen_XPU_DEPENDENCY_LIBS)
set(ATen_CUDA_DEPENDENCY_LIBS)
set(ATen_HIP_DEPENDENCY_LIBS)
set(ATen_PUBLIC_CUDA_DEPENDENCY_LIBS)
set(ATen_PUBLIC_HIP_DEPENDENCY_LIBS)
set(Caffe2_DEPENDENCY_LIBS)
set(Caffe2_CUDA_DEPENDENCY_LIBS)

find_package(cpuinfo REQUIRED CONFIG)
find_package(fp16 REQUIRED CONFIG)
find_package(fmt REQUIRED CONFIG)
find_package(httplib REQUIRED CONFIG)

list(APPEND Caffe2_DEPENDENCY_LIBS
cpuinfo
fp16::fp16
fmt::fmt
)
add_library(fp16 ALIAS fp16::fp16)

if(CONAN_LIBTORCH_USE_PTHREADPOOL)
find_package(pthreadpool REQUIRED CONFIG)
list(APPEND Caffe2_DEPENDENCY_LIBS pthreadpool::pthreadpool)
add_library(pthreadpool ALIAS pthreadpool::pthreadpool)
endif()

if(CONAN_LIBTORCH_USE_FLATBUFFERS)
find_package(flatbuffers REQUIRED CONFIG)
list(APPEND Caffe2_DEPENDENCY_LIBS flatbuffers::flatbuffers)
endif()

if(CONAN_LIBTORCH_USE_SLEEF)
find_package(sleef REQUIRED CONFIG)
list(APPEND ATen_CPU_DEPENDENCY_LIBS sleef::sleef)
endif()

if(USE_XNNPACK)
find_package(xnnpack REQUIRED CONFIG)
list(APPEND Caffe2_DEPENDENCY_LIBS xnnpack::xnnpack)
add_library(XNNPACK INTERFACE)
endif()

if(USE_FBGEMM)
find_package(fbgemmLibrary REQUIRED CONFIG)
list(APPEND Caffe2_DEPENDENCY_LIBS fbgemm)
endif()

if(USE_PYTORCH_QNNPACK)
find_package(fxdiv REQUIRED CONFIG)
find_package(psimd REQUIRED CONFIG)
endif()

if(USE_MIMALLOC)
find_package(mimalloc REQUIRED CONFIG)
endif()
25 changes: 25 additions & 0 deletions recipes/libtorch/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sources:
"2.4.0":
url: "https://github.com/pytorch/pytorch/releases/download/v2.4.0/pytorch-v2.4.0.tar.gz"
sha256: "a890d4342149adbc6c8b116a9afe437fe347527a9ecc0650086cdec82ecdcfb7"
patches:
"2.4.0":
- patch_file: "patches/2.4.0/0001-use-conan-dependencies.patch"
patch_description: "Use Conan dependencies"
patch_type: "conan"
- patch_file: "patches/2.4.0/0002-fix-a-minor-glog-incompatibility.patch"
patch_description: "Fix a small incompatibility with newer glog"
patch_type: "portability"
- patch_file: "patches/2.4.0/0003-fix-cmake-logic-bug.patch"
patch_description: "Fix a CMake logic bug when kineto is disabled"
patch_type: "portability"
- patch_file: "patches/2.4.0/0004-add-a-missing-include.patch"
patch_description: "Add a missing <iostream> include"
patch_type: "bugfix"
- patch_file: "patches/2.4.0/0005-kineto-unvendor-fmt.patch"
patch_description: "Unvendor fmt in vendored kineto"
base_path: "third_party/kineto"
patch_type: "conan"
- patch_file: "patches/2.4.0/0006-dont-build-protoc-on-apple.patch"
patch_description: "Don't build custom protoc on Apple OS-s"
patch_type: "conan"
Loading
Loading