Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/base/, sci-libs/rocFFT/files/, sci-libs/rocFFT/
Date: Thu, 22 Sep 2022 01:08:56
Message-Id: 1663808857.abdf31db4cfb9a43bd7581ab271c03facf933490.heroxbd@gentoo
1 commit: abdf31db4cfb9a43bd7581ab271c03facf933490
2 Author: Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Wed Jul 13 12:18:42 2022 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 22 01:07:37 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abdf31db
7
8 sci-libs/rocFFT: add 5.1.3, use rocm.eclass
9
10 profiles/base: mask rocFFT-5.1.3 gfx906 amdgpu target, because
11 intolerable error found on Radeon VII.
12
13 No need to rebuilt rocFFT when hip upgrade because librocfft is
14 dynamically linked to libhipamd, while llvm SLOT does not matter because
15 it is only used to produce GPU kernels, libclang and libLLVM does not
16 linked in.
17
18 Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
19 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
20
21 profiles/base/package.use.mask | 8 +-
22 sci-libs/rocFFT/Manifest | 1 +
23 .../files/rocFFT-5.1.3-add-stdexcept-header.patch | 11 ++
24 .../files/rocFFT-5.1.3-unbundle-sqlite.patch | 67 ++++++++++
25 sci-libs/rocFFT/rocFFT-5.1.3.ebuild | 144 +++++++++++++++++++++
26 5 files changed, 230 insertions(+), 1 deletion(-)
27
28 diff --git a/profiles/base/package.use.mask b/profiles/base/package.use.mask
29 index 39c17ccff6de..13964d29926c 100644
30 --- a/profiles/base/package.use.mask
31 +++ b/profiles/base/package.use.mask
32 @@ -11,6 +11,12 @@
33 # Allowing that use flag for >=43.0 would stop users from updating nautilus
34 >=app-text/evince-43.0 nautilus
35
36 +# Yiyang Wu <xgreenlandforwyy@×××××.com> (2022-09-21)
37 +# Intolerable mathematical errors found on AMD Radeon VII GPU during src_test,
38 +# may lead to incorrect results in computation.
39 +# https://github.com/ROCmSoftwarePlatform/rocFFT/issues/369
40 +=sci-libs/rocFFT-5.1.3 amdgpu_targets_gfx906
41 +
42 # Georgy Yakovlev <gyakovlev@g.o> (2022-09-17)
43 # po4a crashes while translating
44 # mask for now
45 @@ -24,7 +30,7 @@
46 # bug #870211.
47 dev-lang/rust llvm-libunwind
48
49 -# Matt Jolly <Matt.Jolly@××××××××.ninja (2022-09-09)
50 +# Matt Jolly <Matt.Jolly@××××××××.ninja> (2022-09-09)
51 # app-antivirus/clamav JIT support requires LLVM <=13
52 # ebuild support is there but currently failing to link
53 app-antivirus/clamav jit
54
55 diff --git a/sci-libs/rocFFT/Manifest b/sci-libs/rocFFT/Manifest
56 index a6b401c669d5..62c113ca488d 100644
57 --- a/sci-libs/rocFFT/Manifest
58 +++ b/sci-libs/rocFFT/Manifest
59 @@ -1,3 +1,4 @@
60 DIST rocFFT-4.0.0.tar.gz 772176 BLAKE2B f08db9487449e707ba814a66d23992f68c140017a38f72ee45b3b224fc3e46abd40b976aef645f4432601265b38cff8939456981c686360eba135349b5d28fb5 SHA512 db9a6b49162dfb7924aa5f5dc8d42c92a5a741e03c3c0b4ece2cfb72de7506a345f3d28d31a3d7755cfe78078c448c9f952ca671e472335a4301de8702916176
61 DIST rocFFT-4.3.0.tar.gz 840748 BLAKE2B 236a5faa930751d35e501a9a32ecc8b4075448ef21a0ffb0bb7ec04f4ed1cb67b908aa153b5b424e0823d3e306cf375d7c01a77d687220ed79de6d374037e003 SHA512 765d41e4018a04a53e847c03de80eec830d3e8766187fb8cb493624afa2673175347c16e6eeeebd4ad7d88bb866e58f7e572708f22238723c710b98565a0cd3d
62 DIST rocFFT-5.0.2.tar.gz 837508 BLAKE2B b74d0c6edd7b232f775bffefbca829d88d9d7cd9108c27a0698f45d7fe2760d40463bcda8c710e923874b3bbfb1e83e0fe8622db4dfa28afb29392b3e135e9a5 SHA512 d6810a92a10a27dbcac8a04e8fcd56c7fa198f208da626d8938d5ff28b6ab8b89a058c7a56b5666464165e8f6bd7c4c031a94315625a3613eb02a9b8eccd9eb9
63 +DIST rocFFT-5.1.3.tar.gz 845470 BLAKE2B 86060ce4f8612869fedc5bc92ed6a5bb7fbc539b26c7f5ab0ded5406ab6c340f64116782285d040824e54557af87d9ddb6f907fd1550b80c3da903d3c1d5e5c0 SHA512 175402856bd4753e74ce14326569be99221e21d0ce675e007900f6982c53e1566ad0b060eec545e0f17ff4dc4811688cc1003dc986226205ee95ee6f22d1ca43
64
65 diff --git a/sci-libs/rocFFT/files/rocFFT-5.1.3-add-stdexcept-header.patch b/sci-libs/rocFFT/files/rocFFT-5.1.3-add-stdexcept-header.patch
66 new file mode 100644
67 index 000000000000..edfd89ea4b70
68 --- /dev/null
69 +++ b/sci-libs/rocFFT/files/rocFFT-5.1.3-add-stdexcept-header.patch
70 @@ -0,0 +1,11 @@
71 +Contributed-by: perestoronin https://bugs.gentoo.org/693200#c25
72 +--- a/library/src/include/twiddles.h
73 ++++ b/library/src/include/twiddles.h
74 +@@ -14,6 +14,7 @@
75 + #include <numeric>
76 + #include <tuple>
77 + #include <vector>
78 ++#include <stdexcept>
79 +
80 + static const size_t LTWD_BASE_DEFAULT = 8;
81 + static const size_t LARGE_TWIDDLE_THRESHOLD = 4096;
82
83 diff --git a/sci-libs/rocFFT/files/rocFFT-5.1.3-unbundle-sqlite.patch b/sci-libs/rocFFT/files/rocFFT-5.1.3-unbundle-sqlite.patch
84 new file mode 100644
85 index 000000000000..b18b55eb8048
86 --- /dev/null
87 +++ b/sci-libs/rocFFT/files/rocFFT-5.1.3-unbundle-sqlite.patch
88 @@ -0,0 +1,67 @@
89 +Disable rocFFT fetching SQLite3 and link to system libsqlite.so
90 +Index: rocFFT-rocm-5.1.3/library/src/CMakeLists.txt
91 +===================================================================
92 +--- rocFFT-rocm-5.1.3.orig/library/src/CMakeLists.txt
93 ++++ rocFFT-rocm-5.1.3/library/src/CMakeLists.txt
94 +@@ -134,49 +134,22 @@ set( rocfft_source
95 + rtcsubprocess.cpp
96 + )
97 +
98 +-# SQLite 3.36.0 enabled the backup API by default, which we need
99 +-# for cache serialization. We also want to use a static SQLite,
100 +-# and distro static libraries aren't typically built
101 +-# position-independent.
102 +-include( FetchContent )
103 +-
104 +-set(SQLITE_SRC_URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip CACHE STRING "Location of SQLite source code")
105 +-set(SQLITE_SRC_SHA256 999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729 CACHE STRING "SHA256 hash of SQLite source code")
106 +-
107 +-# embed SQLite
108 +-FetchContent_Declare(sqlite_local
109 +- URL ${SQLITE_SRC_URL}
110 +- URL_HASH SHA256=${SQLITE_SRC_SHA256}
111 +-)
112 +-FetchContent_MakeAvailable(sqlite_local)
113 +-add_library( sqlite3 OBJECT ${sqlite_local_SOURCE_DIR}/sqlite3.c )
114 +-set_target_properties( sqlite3 PROPERTIES
115 +- C_VISIBILITY_PRESET "hidden"
116 +- VISIBILITY_INLINES_HIDDEN ON
117 +- POSITION_INDEPENDENT_CODE ON
118 +- )
119 +-
120 +-# we don't need extensions, and omitting them from SQLite removes the
121 +-# need for dlopen/dlclose from within rocFFT
122 +-target_compile_options(
123 +- sqlite3
124 +- PRIVATE -DSQLITE_OMIT_LOAD_EXTENSION
125 +-)
126 +-
127 + set_property(
128 + SOURCE rtc.cpp
129 + PROPERTY OBJECT_DEPENDS ${kgen_embed_h}
130 + )
131 +
132 ++find_package( SQLite3 REQUIRED )
133 ++
134 + prepend_path( ".." rocfft_headers_public relative_rocfft_headers_public )
135 +
136 + add_library( rocfft
137 + ${rocfft_source}
138 + ${relative_rocfft_headers_public}
139 +- $<TARGET_OBJECTS:sqlite3>
140 + )
141 + add_library( roc::rocfft ALIAS rocfft )
142 +
143 ++target_link_libraries( rocfft PRIVATE ${SQLite3_LIBRARIES} )
144 + if( NOT WIN32 )
145 + target_link_libraries( rocfft PRIVATE -lstdc++fs )
146 + endif()
147 +@@ -209,7 +182,7 @@ endif()
148 + target_include_directories( rocfft
149 + PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/library/src/include>
150 + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/library/src/device>
151 +- ${sqlite_local_SOURCE_DIR}
152 ++ ${SQLite3_LIBRARIES}
153 + PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/library/include>
154 + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
155 + $<INSTALL_INTERFACE:include>
156
157 diff --git a/sci-libs/rocFFT/rocFFT-5.1.3.ebuild b/sci-libs/rocFFT/rocFFT-5.1.3.ebuild
158 new file mode 100644
159 index 000000000000..67d33f28847e
160 --- /dev/null
161 +++ b/sci-libs/rocFFT/rocFFT-5.1.3.ebuild
162 @@ -0,0 +1,144 @@
163 +# Copyright 1999-2022 Gentoo Authors
164 +# Distributed under the terms of the GNU General Public License v2
165 +
166 +EAPI=8
167 +
168 +PYTHON_COMPAT=( python3_{8..10} )
169 +ROCM_VERSION=${PV}
170 +
171 +inherit cmake check-reqs edo multiprocessing python-r1 rocm
172 +
173 +DESCRIPTION="Next generation FFT implementation for ROCm"
174 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocFFT"
175 +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocFFT/archive/rocm-${PV}.tar.gz -> rocFFT-${PV}.tar.gz"
176 +
177 +LICENSE="MIT"
178 +KEYWORDS="~amd64"
179 +SLOT="0/$(ver_cut 1-2)"
180 +
181 +# RDEPEND: perfscripts? dev-python/plotly[${PYTHON_USEDEP}] # currently masked by arch/amd64/x32/package.mask
182 +RDEPEND="
183 +perfscripts? (
184 + >=media-gfx/asymptote-2.61
185 + dev-texlive/texlive-latex
186 + dev-tex/latexmk
187 + sys-apps/texinfo
188 + dev-python/sympy[${PYTHON_USEDEP}]
189 + dev-python/numpy[${PYTHON_USEDEP}]
190 + dev-python/scipy[${PYTHON_USEDEP}]
191 + dev-python/pandas[${PYTHON_USEDEP}] )
192 +${PYTHON_DEPS}"
193 +
194 +DEPEND="dev-util/hip
195 + ${PYTHON_DEPS}"
196 +
197 +BDEPEND="
198 + test? ( dev-cpp/gtest dev-libs/boost
199 + >=sci-libs/fftw-3 sys-libs/libomp )
200 + >=dev-util/cmake-3.22
201 + dev-util/rocm-cmake:${SLOT}
202 +"
203 +
204 +CHECKREQS_DISK_BUILD="7G"
205 +
206 +IUSE="benchmark perfscripts test"
207 +REQUIRED_USE="perfscripts? ( benchmark ) ${PYTHON_REQUIRED_USE} ${ROCM_REQUIRED_USE}"
208 +
209 +RESTRICT="!test? ( test )"
210 +
211 +S="${WORKDIR}/rocFFT-rocm-${PV}"
212 +
213 +PATCHES=(
214 + "${FILESDIR}/${PN}-4.2.0-add-functional-header.patch"
215 + "${FILESDIR}/${PN}-5.1.3-unbundle-sqlite.patch"
216 + "${FILESDIR}/${PN}-5.0.2-add-math-header.patch"
217 + "${FILESDIR}/${PN}-5.1.3-add-stdexcept-header.patch" )
218 +
219 +required_mem() {
220 + if use test; then
221 + echo "52G"
222 + else
223 + if [[ -n "${AMDGPU_TARGETS}" ]]; then
224 + local NARCH=$(($(awk -F";" '{print NF-1}' <<< "${AMDGPU_TARGETS}" || die)+1)) # count how many archs user specified in ${AMDGPU_TARGETS}
225 + else
226 + local NARCH=7 # The default number of AMDGPU_TARGETS for rocFFT-4.3.0. May change in the future.
227 + fi
228 + echo "$(($(makeopts_jobs)*${NARCH}*25+2200))M" # A linear function estimating how much memory required
229 + fi
230 +}
231 +
232 +pkg_pretend() {
233 + return # leave the disk space check to pkg_setup phase
234 +}
235 +
236 +pkg_setup() {
237 + export CHECKREQS_MEMORY=$(required_mem)
238 + check-reqs_pkg_setup
239 + python_setup
240 +}
241 +
242 +src_prepare() {
243 + sed -e "s/PREFIX rocfft//" \
244 + -e "/rocm_install_symlink_subdir/d" \
245 + -e "/<INSTALL_INTERFACE/s,include,include/rocFFT," \
246 + -i library/src/CMakeLists.txt || die
247 +
248 + sed -e "/rocm_install_symlink_subdir/d" \
249 + -e "$!N;s:PREFIX\n[ ]*rocfft:# PREFIX rocfft\n:;P;D" \
250 + -i library/src/device/CMakeLists.txt || die
251 +
252 + if use perfscripts; then
253 + pushd scripts/perf || die
254 + sed -e "/\/opt\/rocm/d" -e "/rocmversion/s,rocm_info.strip(),\"${PV}\"," -i perflib/specs.py || dir
255 + sed -e "/^top/,+1d" -i rocfft-perf suites.py || die
256 + sed -e "s,perflib,${PN}_perflib,g" -i rocfft-perf suites.py perflib/*.py || die
257 + sed -e "/^top = /s,__file__).*$,\"${EPREFIX}/usr/share/${PN}-perflib\")," -i perflib/pdf.py perflib/generators.py || die
258 + popd
259 + fi
260 +
261 + cmake_src_prepare
262 +}
263 +
264 +src_configure() {
265 + addpredict /dev/kfd
266 + addpredict /dev/dri/
267 +
268 + local mycmakeargs=(
269 + -DCMAKE_SKIP_RPATH=On
270 + -DAMDGPU_TARGETS="$(get_amdgpu_flags)"
271 + -Wno-dev
272 + -DCMAKE_INSTALL_INCLUDEDIR="include/rocFFT/"
273 + -DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
274 + -DBUILD_CLIENTS_SELFTEST=$(usex test ON OFF)
275 + -DPYTHON3_EXE=${EPYTHON}
276 + -DBUILD_CLIENTS_RIDER=$(usex benchmark ON OFF)
277 + )
278 +
279 + CXX=hipcc cmake_src_configure
280 +}
281 +
282 +src_test() {
283 + check_amdgpu
284 + cd "${BUILD_DIR}/clients/staging" || die
285 + export LD_LIBRARY_PATH=${BUILD_DIR}/library/src/:${BUILD_DIR}/library/src/device
286 + edob ./${PN,,}-test
287 + edob ./${PN,,}-selftest
288 +}
289 +
290 +src_install() {
291 + cmake_src_install
292 +
293 + if use benchmark; then
294 + cd "${BUILD_DIR}"/clients/staging || die
295 + dobin *rider
296 + fi
297 +
298 + if use perfscripts; then
299 + cd "${S}"/scripts/perf || die
300 + python_foreach_impl python_doexe rocfft-perf
301 + python_moduleinto ${PN}_perflib
302 + python_foreach_impl python_domodule perflib/*.py
303 + insinto /usr/share/${PN}-perflib
304 + doins *.asy suites.py
305 + fi
306 +}