Gentoo Archives: gentoo-commits

From: Alfredo Tupone <tupone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/, sci-libs/caffe2/files/
Date: Sat, 02 Jul 2022 11:04:07
Message-Id: 1656759824.e4f62deb1b127d32fc9845d5e90d21a0c090bf53.tupone@gentoo
1 commit: e4f62deb1b127d32fc9845d5e90d21a0c090bf53
2 Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 1 22:22:08 2022 +0000
4 Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 2 11:03:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4f62deb
7
8 sci-libs/caffe2: add XNNPACK usage
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
12
13 .../{caffe2-1.11.0.ebuild => caffe2-1.11.0-r1.ebuild} | 7 ++++++-
14 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch | 19 +++++++++++++++++++
15 sci-libs/caffe2/metadata.xml | 3 +++
16 3 files changed, 28 insertions(+), 1 deletion(-)
17
18 diff --git a/sci-libs/caffe2/caffe2-1.11.0.ebuild b/sci-libs/caffe2/caffe2-1.11.0-r1.ebuild
19 similarity index 92%
20 rename from sci-libs/caffe2/caffe2-1.11.0.ebuild
21 rename to sci-libs/caffe2/caffe2-1.11.0-r1.ebuild
22 index e0f6d0d772f2..137c5df60ebe 100644
23 --- a/sci-libs/caffe2/caffe2-1.11.0.ebuild
24 +++ b/sci-libs/caffe2/caffe2-1.11.0-r1.ebuild
25 @@ -18,6 +18,7 @@ LICENSE="BSD"
26 SLOT="0"
27 KEYWORDS="~amd64"
28 RESTRICT="test"
29 +IUSE="xnnpack"
30 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
31
32 RDEPEND="
33 @@ -29,6 +30,7 @@ RDEPEND="
34 sci-libs/lapack
35 sci-libs/onnx
36 sci-libs/foxi
37 + xnnpack? ( sci-libs/XNNPACK )
38 "
39 DEPEND="${RDEPEND}
40 dev-libs/FP16
41 @@ -53,7 +55,7 @@ src_configure() {
42 python_setup
43 local mycmakeargs=(
44 -DUSE_KINETO=OFF
45 - -DUSE_XNNPACK=OFF
46 + -DUSE_XNNPACK=$(usex xnnpack ON OFF)
47 -DUSE_SYSTEM_SLEEF=ON
48 -DUSE_BREAKPAD=OFF
49 -DUSE_SYSTEM_ONNX=ON
50 @@ -76,6 +78,9 @@ src_configure() {
51 -DTORCH_INSTALL_LIB_DIR=/usr/$(get_libdir)
52 -DLIBSHM_INSTALL_LIB_SUBDIR=/usr/$(get_libdir)
53 -DUSE_CCACHE=OFF
54 + -DUSE_SYSTEM_PTHREADPOOL=ON
55 + -DUSE_SYSTEM_XNNPACK=ON
56 + -DUSE_SYSTEM_FXDIV=ON
57 )
58 cmake_src_configure
59 }
60
61 diff --git a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
62 index ac74edadab35..f34216ea0970 100644
63 --- a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
64 +++ b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
65 @@ -91,3 +91,22 @@
66 install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
67 DESTINATION include
68 FILES_MATCHING PATTERN "*.h")
69 +--- a/caffe2/CMakeLists.txt 2022-07-01 21:56:49.643490049 +0200
70 ++++ b/caffe2/CMakeLists.txt 2022-07-01 21:57:17.091489479 +0200
71 +@@ -109,7 +109,7 @@
72 + # Note: the folders that are being commented out have not been properly
73 + # addressed yet.
74 +
75 +-if(NOT MSVC AND USE_XNNPACK)
76 ++if(FALSE)
77 + if(NOT TARGET fxdiv)
78 + set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
79 + set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
80 +@@ -967,7 +967,6 @@
81 + endif()
82 +
83 + if(NOT MSVC AND USE_XNNPACK)
84 +- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
85 + endif()
86 +
87 + # ==========================================================
88
89 diff --git a/sci-libs/caffe2/metadata.xml b/sci-libs/caffe2/metadata.xml
90 index d12749aa5c21..bdd11115f0fe 100644
91 --- a/sci-libs/caffe2/metadata.xml
92 +++ b/sci-libs/caffe2/metadata.xml
93 @@ -5,6 +5,9 @@
94 <email>tupone@g.o</email>
95 <name>Tupone Alfredo</name>
96 </maintainer>
97 + <use>
98 + <flag name="xnnpack">Use XNNPACK</flag>
99 + </use>
100 <upstream>
101 <remote-id type="github">pytorch/pytorch</remote-id>
102 </upstream>