mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
sci-libs/caffe2: add 2.6.0
Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
DIST caffe2-patches-20240809.tar.gz 15242 BLAKE2B 77503c61487e7d85cca5afcab9a6e638f9833a70861845638cf1b62bc492d7b6650e6db81d53ebb2f39c6313509250d339f725f04d03ec6dd23dd0cf70843d8c SHA512 74b3b0b6671b655ecac93f7436c4ed7cb0157a83aafbf6afcc0811e11cef341cd8f638db1a111bcbb01e1a6dd4daf3a36b96d7a8ce90f04c2fa091bd6e3a142b
|
||||
DIST pytorch-2.4.1.tar.gz 115029469 BLAKE2B c2909ff27d527bc57cba56b780d3b8cd07a043ab045caa6c6b27857a16f9ad10aaab2116b26226b1e46ee08ffb44007965d914464418e4ae14ca48c3f3f383bb SHA512 7e9b4485e242eaf0d648765c6621d73d95e7107b766646a098175436d1ab2e2b864badd0757a3bab6b7c318233f2120bad9ac07b39bb9e357897919580c87631
|
||||
DIST pytorch-2.5.1.tar.gz 116091366 BLAKE2B 7838b17562b94ffc7d798031348689db607dd5eae2a3c35be365972e2b52a2c1b12067068d5aca5ab00cf0977d9c2c3c9ae5337d69534c864c732e6256cbeef6 SHA512 a913a466324a65fa3d79c5e9ad4d605fc7976f0134fda2f81aaa3cea29d56926604999b8a238759646d211e63b47bbb446cdffa86ca8defd8159f11e30301289
|
||||
DIST pytorch-2.6.0.tar.gz 119594438 BLAKE2B 3152eb341cf42295e147e59625beb9c06608aa4b78f9618c1c0024b10c1c767715d07fe8c4be52d029ac47f808cd0d5e65c9530ec90d951a64b993083b4067ad SHA512 a70da80ff09d226085e18228132cf6bb236ad8cc47eed52375d0d2a615f09dd33849da947270b5670c184eab60cb8e2adf11d801babfbda7aa621400501d07b0
|
||||
|
||||
326
sci-libs/caffe2/caffe2-2.6.0.ebuild
Normal file
326
sci-libs/caffe2/caffe2-2.6.0.ebuild
Normal file
@@ -0,0 +1,326 @@
|
||||
# Copyright 2022-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..13} )
|
||||
ROCM_VERSION=6.1
|
||||
inherit python-single-r1 cmake cuda flag-o-matic prefix rocm toolchain-funcs
|
||||
|
||||
MYPN=pytorch
|
||||
MYP=${MYPN}-${PV}
|
||||
|
||||
DESCRIPTION="A deep learning framework"
|
||||
HOMEPAGE="https://pytorch.org/"
|
||||
SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz
|
||||
-> ${MYP}.tar.gz"
|
||||
|
||||
S="${WORKDIR}"/${MYP}
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
IUSE="cuda distributed fbgemm flash gloo mkl mpi nnpack +numpy onednn openblas opencl openmp qnnpack rocm xnnpack"
|
||||
RESTRICT="test"
|
||||
REQUIRED_USE="
|
||||
${PYTHON_REQUIRED_USE}
|
||||
mpi? ( distributed )
|
||||
gloo? ( distributed )
|
||||
?? ( cuda rocm )
|
||||
rocm? (
|
||||
|| ( ${ROCM_REQUIRED_USE} )
|
||||
!flash
|
||||
)
|
||||
"
|
||||
|
||||
RDEPEND="
|
||||
${PYTHON_DEPS}
|
||||
dev-cpp/abseil-cpp:=
|
||||
dev-cpp/gflags:=
|
||||
>=dev-cpp/glog-0.5.0
|
||||
dev-cpp/nlohmann_json
|
||||
dev-cpp/opentelemetry-cpp
|
||||
dev-libs/cpuinfo
|
||||
dev-libs/libfmt
|
||||
dev-libs/protobuf:=
|
||||
dev-libs/pthreadpool
|
||||
dev-libs/sleef
|
||||
virtual/lapack
|
||||
sci-libs/onnx
|
||||
sci-libs/foxi
|
||||
cuda? (
|
||||
dev-libs/cudnn
|
||||
>=dev-libs/cudnn-frontend-1.0.3:0/8
|
||||
dev-util/nvidia-cuda-toolkit:=[profiler]
|
||||
)
|
||||
fbgemm? ( >=dev-libs/FBGEMM-2023.12.01 )
|
||||
gloo? ( sci-libs/gloo[cuda?] )
|
||||
mpi? ( virtual/mpi )
|
||||
nnpack? ( sci-libs/NNPACK )
|
||||
numpy? ( $(python_gen_cond_dep '
|
||||
dev-python/numpy[${PYTHON_USEDEP}]
|
||||
') )
|
||||
onednn? ( =dev-libs/oneDNN-3.5* )
|
||||
opencl? ( virtual/opencl )
|
||||
qnnpack? (
|
||||
!sci-libs/QNNPACK
|
||||
dev-cpp/gemmlowp
|
||||
)
|
||||
rocm? (
|
||||
=dev-util/hip-6.1*
|
||||
=dev-libs/rccl-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/rocThrust-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/rocPRIM-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/hipBLAS-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/hipFFT-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/hipSPARSE-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/hipRAND-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/hipCUB-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/hipSOLVER-6.1*[${ROCM_USEDEP}]
|
||||
=sci-libs/miopen-6.1*[${ROCM_USEDEP}]
|
||||
=dev-util/roctracer-6.1*[${ROCM_USEDEP}]
|
||||
|
||||
=sci-libs/hipBLASLt-6.1*
|
||||
amdgpu_targets_gfx90a? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx90a] )
|
||||
amdgpu_targets_gfx940? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx940] )
|
||||
amdgpu_targets_gfx941? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx941] )
|
||||
amdgpu_targets_gfx942? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx942] )
|
||||
)
|
||||
distributed? (
|
||||
sci-libs/tensorpipe[cuda?]
|
||||
dev-cpp/cpp-httplib
|
||||
)
|
||||
xnnpack? ( >=sci-libs/XNNPACK-2024.02.29 )
|
||||
mkl? ( sci-libs/mkl )
|
||||
openblas? ( sci-libs/openblas )
|
||||
"
|
||||
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
qnnpack? ( dev-libs/clog )
|
||||
cuda? ( <=dev-libs/cutlass-3.4.1 )
|
||||
onednn? ( sci-libs/ideep )
|
||||
dev-libs/psimd
|
||||
dev-libs/FP16
|
||||
dev-libs/FXdiv
|
||||
dev-libs/pocketfft
|
||||
dev-libs/flatbuffers
|
||||
>=sci-libs/kineto-0.4.0_p20240525
|
||||
$(python_gen_cond_dep '
|
||||
dev-python/pyyaml[${PYTHON_USEDEP}]
|
||||
dev-python/pybind11[${PYTHON_USEDEP}]
|
||||
dev-python/typing-extensions[${PYTHON_USEDEP}]
|
||||
')
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.5.1-unbundle_fmt.patch
|
||||
"${FILESDIR}"/${PN}-2.5.1-unbundle_kineto.patch
|
||||
"${FILESDIR}"/${PN}-2.5.1-cudnn_include_fix.patch
|
||||
"${FILESDIR}"/${P}-gentoo.patch
|
||||
"${FILESDIR}"/${PN}-2.4.0-cpp-httplib.patch
|
||||
"${FILESDIR}"/${PN}-2.5.1-glog-0.6.0.patch
|
||||
"${FILESDIR}"/${PN}-2.5.1-newfix-functorch-install.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
filter-lto #bug 862672
|
||||
|
||||
# Unbundle fmt
|
||||
sed -i \
|
||||
-e 's|::fmt-header-only||' \
|
||||
c10/CMakeLists.txt \
|
||||
cmake/Dependencies.cmake \
|
||||
torch/CMakeLists.txt \
|
||||
|| die
|
||||
|
||||
# Drop third_party from CMake tree
|
||||
sed -i \
|
||||
-e '/add_subdirectory.*third_party/d' \
|
||||
CMakeLists.txt \
|
||||
cmake/Dependencies.cmake \
|
||||
cmake/ProtoBuf.cmake \
|
||||
aten/src/ATen/CMakeLists.txt \
|
||||
|| die
|
||||
# Change libc10* path
|
||||
sed -i \
|
||||
-e "/EXPORT/s|DESTINATION lib)|DESTINATION $(get_libdir))|" \
|
||||
c10/cuda/CMakeLists.txt \
|
||||
c10/CMakeLists.txt \
|
||||
c10/hip/CMakeLists.txt \
|
||||
|| die
|
||||
|
||||
cmake_src_prepare
|
||||
pushd torch/csrc/jit/serialization || die
|
||||
flatc --cpp --gen-mutable --scoped-enums mobile_bytecode.fbs || die
|
||||
popd
|
||||
|
||||
# prefixify the hardcoded paths, after all patches are applied
|
||||
hprefixify \
|
||||
aten/CMakeLists.txt \
|
||||
caffe2/CMakeLists.txt \
|
||||
cmake/Metal.cmake \
|
||||
cmake/Modules/*.cmake \
|
||||
cmake/Modules_CUDA_fix/FindCUDNN.cmake \
|
||||
cmake/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake \
|
||||
cmake/Modules_CUDA_fix/upstream/FindPackageHandleStandardArgs.cmake \
|
||||
cmake/public/LoadHIP.cmake \
|
||||
cmake/public/cuda.cmake \
|
||||
cmake/Dependencies.cmake \
|
||||
torch/CMakeLists.txt \
|
||||
CMakeLists.txt
|
||||
|
||||
if use rocm; then
|
||||
sed -e "s:/opt/rocm:/usr:" \
|
||||
-e "s:lib/cmake:$(get_libdir)/cmake:g" \
|
||||
-e "s/HIP 1.0/HIP 1.0 REQUIRED/" \
|
||||
-i cmake/public/LoadHIP.cmake || die
|
||||
|
||||
ebegin "HIPifying cuda sources"
|
||||
${EPYTHON} tools/amd_build/build_amd.py || die
|
||||
eend $?
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
if use cuda && [[ -z ${TORCH_CUDA_ARCH_LIST} ]]; then
|
||||
ewarn "WARNING: caffe2 is being built with its default CUDA compute capabilities: 3.5 and 7.0."
|
||||
ewarn "These may not be optimal for your GPU."
|
||||
ewarn ""
|
||||
ewarn "To configure caffe2 with the CUDA compute capability that is optimal for your GPU,"
|
||||
ewarn "set TORCH_CUDA_ARCH_LIST in your make.conf, and re-emerge caffe2."
|
||||
ewarn "For example, to use CUDA capability 7.5 & 3.5, add: TORCH_CUDA_ARCH_LIST=7.5 3.5"
|
||||
ewarn "For a Maxwell model GPU, an example value would be: TORCH_CUDA_ARCH_LIST=Maxwell"
|
||||
ewarn ""
|
||||
ewarn "You can look up your GPU's CUDA compute capability at https://developer.nvidia.com/cuda-gpus"
|
||||
ewarn "or by running /opt/cuda/extras/demo_suite/deviceQuery | grep 'CUDA Capability'"
|
||||
fi
|
||||
|
||||
local mycmakeargs=(
|
||||
-DBUILD_CUSTOM_PROTOBUF=OFF
|
||||
-DLIBSHM_INSTALL_LIB_SUBDIR="${EPREFIX}"/usr/$(get_libdir)
|
||||
-DPython_EXECUTABLE="${PYTHON}"
|
||||
-DTORCH_INSTALL_LIB_DIR="${EPREFIX}"/usr/$(get_libdir)
|
||||
-DUSE_CCACHE=OFF
|
||||
-DUSE_CUDA=$(usex cuda)
|
||||
-DUSE_DISTRIBUTED=$(usex distributed)
|
||||
-DUSE_FAKELOWP=OFF
|
||||
-DUSE_FBGEMM=$(usex fbgemm)
|
||||
-DUSE_FLASH_ATTENTION=$(usex flash)
|
||||
-DUSE_GFLAGS=ON
|
||||
-DUSE_GLOG=ON
|
||||
-DUSE_GLOO=$(usex gloo)
|
||||
-DUSE_ITT=OFF
|
||||
-DUSE_KINETO=OFF # TODO
|
||||
-DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma
|
||||
-DUSE_MEM_EFF_ATTENTION=OFF
|
||||
-DUSE_MKLDNN=$(usex onednn)
|
||||
-DUSE_MPI=$(usex mpi)
|
||||
-DUSE_NCCL=OFF
|
||||
-DUSE_NNPACK=$(usex nnpack)
|
||||
-DUSE_NUMA=OFF
|
||||
-DUSE_NUMPY=$(usex numpy)
|
||||
-DUSE_OPENCL=$(usex opencl)
|
||||
-DUSE_OPENMP=$(usex openmp)
|
||||
-DUSE_PYTORCH_QNNPACK=$(usex qnnpack)
|
||||
-DUSE_PYTORCH_METAL=OFF
|
||||
-DUSE_ROCM=$(usex rocm)
|
||||
-DUSE_SYSTEM_CPUINFO=ON
|
||||
-DUSE_SYSTEM_EIGEN_INSTALL=ON
|
||||
-DUSE_SYSTEM_FP16=ON
|
||||
-DUSE_SYSTEM_FXDIV=ON
|
||||
-DUSE_SYSTEM_GLOO=ON
|
||||
-DUSE_SYSTEM_ONNX=ON
|
||||
-DUSE_SYSTEM_PSIMD=ON
|
||||
-DUSE_SYSTEM_PSIMD=ON
|
||||
-DUSE_SYSTEM_PTHREADPOOL=ON
|
||||
-DUSE_SYSTEM_PYBIND11=ON
|
||||
-DUSE_SYSTEM_SLEEF=ON
|
||||
-DUSE_SYSTEM_XNNPACK=$(usex xnnpack)
|
||||
-DUSE_TENSORPIPE=$(usex distributed)
|
||||
-DUSE_UCC=OFF
|
||||
-DUSE_VALGRIND=OFF
|
||||
-DUSE_XNNPACK=$(usex xnnpack)
|
||||
-DUSE_XPU=OFF
|
||||
-Wno-dev
|
||||
)
|
||||
|
||||
if use mkl; then
|
||||
mycmakeargs+=(-DBLAS=MKL)
|
||||
elif use openblas; then
|
||||
mycmakeargs+=(-DBLAS=OpenBLAS)
|
||||
else
|
||||
mycmakeargs+=(-DBLAS=Generic -DBLAS_LIBRARIES=)
|
||||
fi
|
||||
|
||||
if use cuda; then
|
||||
addpredict "/dev/nvidiactl" # bug 867706
|
||||
addpredict "/dev/char"
|
||||
addpredict "/proc/self/task" # bug 926116
|
||||
|
||||
mycmakeargs+=(
|
||||
-DUSE_CUDNN=ON
|
||||
-DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}"
|
||||
-DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library
|
||||
-DCMAKE_CUDA_FLAGS="$(cuda_gccdir -f | tr -d \")"
|
||||
)
|
||||
elif use rocm; then
|
||||
export PYTORCH_ROCM_ARCH="$(get_amdgpu_flags)"
|
||||
|
||||
mycmakeargs+=(
|
||||
-DUSE_NCCL=ON
|
||||
-DUSE_SYSTEM_NCCL=ON
|
||||
)
|
||||
|
||||
# ROCm libraries produce too much warnings
|
||||
append-cxxflags -Wno-deprecated-declarations -Wno-unused-result
|
||||
|
||||
if tc-is-clang; then
|
||||
# fix mangling in LLVM: https://github.com/llvm/llvm-project/issues/85656
|
||||
append-cxxflags -fclang-abi-compat=17
|
||||
fi
|
||||
fi
|
||||
|
||||
if use onednn; then
|
||||
mycmakeargs+=(
|
||||
-DMKLDNN_FOUND=ON
|
||||
-DMKLDNN_LIBRARIES=dnnl
|
||||
-DMKLDNN_INCLUDE_DIR="${ESYSROOT}/usr/include/oneapi/dnnl"
|
||||
)
|
||||
fi
|
||||
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
PYTORCH_BUILD_VERSION=${PV} \
|
||||
PYTORCH_BUILD_NUMBER=0 \
|
||||
cmake_src_compile
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
|
||||
# Used by pytorch ebuild
|
||||
insinto "/var/lib/${PN}"
|
||||
doins "${BUILD_DIR}"/CMakeCache.txt
|
||||
dostrip -x /var/lib/${PN}/functorch.so
|
||||
|
||||
rm -rf python
|
||||
mkdir -p python/torch || die
|
||||
cp torch/version.py python/torch/ || die
|
||||
python_domodule python/torch
|
||||
|
||||
mkdir "${D}"$(python_get_sitedir)/torch/bin || die
|
||||
mkdir "${D}"$(python_get_sitedir)/torch/lib || die
|
||||
mkdir "${D}"$(python_get_sitedir)/torch/include || die
|
||||
|
||||
ln -s ../../../../../include/torch \
|
||||
"${D}$(python_get_sitedir)"/torch/include/torch || die # bug 923269
|
||||
|
||||
mv "${D}"/usr/bin/torch_shm_manager \
|
||||
"${D}"/$(python_get_sitedir)/torch/bin/ || die
|
||||
|
||||
mv "${D}"/usr/$(get_libdir)/libtorch_global_deps.so \
|
||||
"${D}"/$(python_get_sitedir)/torch/lib/ || die
|
||||
}
|
||||
156
sci-libs/caffe2/files/caffe2-2.6.0-gentoo.patch
Normal file
156
sci-libs/caffe2/files/caffe2-2.6.0-gentoo.patch
Normal file
@@ -0,0 +1,156 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -984,12 +984,11 @@ endif()
|
||||
# third_party/FBGEMM
|
||||
include(cmake/public/utils.cmake)
|
||||
if(NOT MSVC)
|
||||
- string(APPEND CMAKE_CXX_FLAGS " -O2 -fPIC")
|
||||
+ string(APPEND CMAKE_CXX_FLAGS " -O2")
|
||||
# Eigen fails to build with some versions, so convert this to a warning
|
||||
# Details at http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1459
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wall")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wextra")
|
||||
- append_cxx_flag_if_supported("-Werror=return-type" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Werror=non-virtual-dtor" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Werror=braced-scalar-init" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Werror=range-loop-construct" CMAKE_CXX_FLAGS)
|
||||
@@ -1091,7 +1091,6 @@
|
||||
endif()
|
||||
append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS)
|
||||
- append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
|
||||
append_cxx_flag_if_supported("-Wno-error=dangling-reference" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Wno-error=redundant-move" CMAKE_CXX_FLAGS)
|
||||
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
|
||||
@@ -323,16 +323,8 @@ set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/pytorch_q
|
||||
set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/qnnpack_func.h)
|
||||
|
||||
# ---[ Configure clog
|
||||
-if(NOT TARGET clog)
|
||||
- set(CLOG_BUILD_TESTS OFF CACHE BOOL "")
|
||||
- set(CLOG_RUNTIME_TYPE "${CPUINFO_RUNTIME_TYPE}" CACHE STRING "")
|
||||
- add_subdirectory(
|
||||
- "${CLOG_SOURCE_DIR}"
|
||||
- "${CONFU_DEPENDENCIES_BINARY_DIR}/clog")
|
||||
- # We build static version of clog but a dynamic library may indirectly depend on it
|
||||
- set_property(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
-endif()
|
||||
-target_link_libraries(pytorch_qnnpack PUBLIC clog)
|
||||
+find_library(CLOG_LIBRARY NAMES clog REQUIRED)
|
||||
+target_link_libraries(pytorch_qnnpack PUBLIC ${CLOG_LIBRARY})
|
||||
|
||||
# ---[ Configure cpuinfo
|
||||
if(NOT TARGET cpuinfo AND USE_SYSTEM_CPUINFO)
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -87,7 +87,7 @@ endif()
|
||||
# Note: the folders that are being commented out have not been properly
|
||||
# addressed yet.
|
||||
|
||||
-if(NOT MSVC AND USE_XNNPACK)
|
||||
+if(FALSE)
|
||||
if(NOT TARGET fxdiv)
|
||||
set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
|
||||
set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
@@ -1130,7 +1130,6 @@ if(USE_XPU)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC AND USE_XNNPACK)
|
||||
- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
|
||||
endif()
|
||||
|
||||
# ==========================================================
|
||||
--- a/cmake/Codegen.cmake
|
||||
+++ b/cmake/Codegen.cmake
|
||||
@@ -64,7 +64,7 @@ if(INTERN_BUILD_ATEN_OPS)
|
||||
if(MSVC)
|
||||
set(OPT_FLAG "/fp:strict ")
|
||||
else(MSVC)
|
||||
- set(OPT_FLAG "-O3 ")
|
||||
+ set(OPT_FLAG " ")
|
||||
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||
set(OPT_FLAG " ")
|
||||
endif()
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -467,7 +467,9 @@
|
||||
set_property(TARGET pytorch_qnnpack PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
set_property(TARGET cpuinfo PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
# QNNPACK depends on gemmlowp headers
|
||||
- target_include_directories(pytorch_qnnpack PRIVATE "${CAFFE2_THIRD_PARTY_ROOT}/gemmlowp")
|
||||
+ find_package(gemmlowp REQUIRED)
|
||||
+ get_target_property(GEMMLOWP_INCLUDE_DIRS gemmlowp::gemmlowp INTERFACE_INCLUDE_DIRECTORIES)
|
||||
+ target_include_directories(pytorch_qnnpack PRIVATE ${GEMMLOWP_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS pytorch_qnnpack)
|
||||
@@ -556,7 +556,7 @@
|
||||
find_library(microkernels-prod_LIBRARY microkernels-prod)
|
||||
set_property(TARGET XNNPACK PROPERTY IMPORTED_LOCATION "${XNNPACK_LIBRARY}")
|
||||
set_property(TARGET microkernels-prod PROPERTY IMPORTED_LOCATION "${microkernels-prod_LIBRARY}")
|
||||
- if(NOT XNNPACK_LIBRARY or NOT microkernels-prod_LIBRARY)
|
||||
+ if(FALSE)
|
||||
message(FATAL_ERROR "Cannot find XNNPACK")
|
||||
endif()
|
||||
message("-- Found XNNPACK: ${XNNPACK_LIBRARY}")
|
||||
@@ -693,7 +695,7 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST)
|
||||
endif()
|
||||
|
||||
# ---[ FBGEMM
|
||||
-if(USE_FBGEMM)
|
||||
+if(FALSE)
|
||||
set(CAFFE2_THIRD_PARTY_ROOT "${PROJECT_SOURCE_DIR}/third_party")
|
||||
if(NOT DEFINED FBGEMM_SOURCE_DIR)
|
||||
set(FBGEMM_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/fbgemm" CACHE STRING "FBGEMM source directory")
|
||||
@@ -745,6 +747,7 @@ if(USE_FBGEMM)
|
||||
endif()
|
||||
|
||||
if(USE_FBGEMM)
|
||||
+ list(APPEND Caffe2_DEPENDENCY_LIBS fbgemm)
|
||||
caffe2_update_option(USE_FBGEMM ON)
|
||||
else()
|
||||
caffe2_update_option(USE_FBGEMM OFF)
|
||||
--- a/cmake/External/nnpack.cmake
|
||||
+++ b/cmake/External/nnpack.cmake
|
||||
@@ -56,7 +56,7 @@
|
||||
set(PTHREADPOOL_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/pthreadpool" CACHE STRING "pthreadpool source directory")
|
||||
set(GOOGLETEST_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/googletest" CACHE STRING "Google Test source directory")
|
||||
|
||||
- if(NOT TARGET nnpack)
|
||||
+ if(FALSE)
|
||||
set(NNPACK_BUILD_TESTS OFF CACHE BOOL "")
|
||||
set(NNPACK_BUILD_BENCHMARKS OFF CACHE BOOL "")
|
||||
set(NNPACK_LIBRARY_TYPE "static" CACHE STRING "")
|
||||
--- a/cmake/public/utils.cmake
|
||||
+++ b/cmake/public/utils.cmake
|
||||
@@ -422,8 +422,6 @@ function(torch_compile_options libname)
|
||||
endif()
|
||||
|
||||
# Use -O2 for release builds (-O3 doesn't improve perf, and -Os results in perf regression)
|
||||
- target_compile_options(${libname} PRIVATE
|
||||
- $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>>:-O2>)
|
||||
|
||||
endfunction()
|
||||
|
||||
--- a/aten/src/ATen/CMakeLists.txt 2025-02-27 14:23:02.402742165 +0100
|
||||
+++ b/aten/src/ATen/CMakeLists.txt 2025-02-27 14:23:40.445850718 +0100
|
||||
@@ -269,8 +269,6 @@
|
||||
if(USE_CUDA)
|
||||
list(APPEND ATen_CUDA_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/cuda)
|
||||
# Next two lines are needed because TunableOp uses third-party/fmt
|
||||
- list(APPEND ATen_CUDA_INCLUDE $<TARGET_PROPERTY:fmt::fmt-header-only,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
- list(APPEND ATen_CUDA_DEPENDENCY_LIBS fmt::fmt-header-only)
|
||||
list(APPEND ATen_CUDA_CU_SRCS
|
||||
${cuda_cu}
|
||||
${native_cuda_cu}
|
||||
@@ -315,8 +313,6 @@
|
||||
list(APPEND ATen_HIP_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party/composable_kernel/include)
|
||||
list(APPEND ATen_HIP_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party/composable_kernel/library/include)
|
||||
# Next two lines are needed because TunableOp uses third-party/fmt
|
||||
- list(APPEND ATen_HIP_INCLUDE $<TARGET_PROPERTY:fmt::fmt-header-only,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
- list(APPEND ATen_HIP_DEPENDENCY_LIBS fmt::fmt-header-only)
|
||||
list(APPEND ATen_HIP_SRCS
|
||||
${ATen_HIP_SRCS}
|
||||
${hip_hip}
|
||||
Reference in New Issue
Block a user