3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
|
6 |
PYTHON_COMPAT=( python3_{10..11} )
|
7 |
7 |
DISTUTILS_USE_PEP517=setuptools
|
8 |
|
inherit distutils-r1 llvm prefix
|
|
8 |
ROCM_VERSION=${PV}
|
|
9 |
inherit cmake distutils-r1 llvm prefix rocm
|
9 |
10 |
|
10 |
11 |
LLVM_MAX_SLOT=15
|
11 |
12 |
|
12 |
13 |
DESCRIPTION="Stretching GPU performance for GEMMs and tensor contractions"
|
13 |
14 |
HOMEPAGE="https://github.com/ROCmSoftwarePlatform/Tensile"
|
14 |
|
SRC_URI="https://github.com/ROCmSoftwarePlatform/Tensile/archive/rocm-${PV}.tar.gz -> rocm-Tensile-${PV}.tar.gz
|
15 |
|
https://github.com/littlewu2508/littlewu2508.github.io/raw/main/gentoo-distfiles/${PN}-5.0.2-PR1419.patch.gz"
|
|
15 |
SRC_URI="https://github.com/ROCmSoftwarePlatform/Tensile/archive/rocm-${PV}.tar.gz -> rocm-Tensile-${PV}.tar.gz"
|
16 |
16 |
S="${WORKDIR}/${PN}-rocm-${PV}"
|
17 |
17 |
|
18 |
18 |
LICENSE="MIT"
|
19 |
19 |
KEYWORDS="~amd64"
|
20 |
20 |
SLOT="0/$(ver_cut 1-2)"
|
|
21 |
IUSE="client"
|
|
22 |
REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
|
21 |
23 |
|
22 |
24 |
# Not compatible with recent versions of pytest
|
23 |
25 |
RESTRICT="test"
|
... | ... | |
27 |
29 |
dev-python/pyyaml[${PYTHON_USEDEP}]
|
28 |
30 |
dev-python/msgpack[${PYTHON_USEDEP}]
|
29 |
31 |
dev-util/hip
|
30 |
|
sys-devel/clang:${LLVM_MAX_SLOT}
|
31 |
32 |
>=dev-util/rocm-smi-4.3.0
|
|
33 |
sys-devel/clang:${LLVM_MAX_SLOT}
|
32 |
34 |
"
|
33 |
35 |
DEPEND="${RDEPEND}"
|
34 |
36 |
|
35 |
37 |
PATCHES=(
|
36 |
38 |
"${FILESDIR}"/${PN}-change-cmake-name-for-msgpack-cxx-6-release.patch
|
37 |
39 |
"${FILESDIR}"/${PN}-4.3.0-output-commands.patch
|
38 |
|
"${FILESDIR}"/${PN}-5.0.2-gfx1031.patch
|
39 |
|
"${FILESDIR}"/${PN}-5.0.2-fix-arch-parse.patch
|
40 |
|
"${FILESDIR}"/${PN}-5.0.2-use-ninja.patch
|
|
40 |
"${FILESDIR}"/${PN}-5.4.2-gfx1031.patch
|
|
41 |
"${FILESDIR}"/${PN}-5.4.2-fix-arch-parse.patch
|
|
42 |
"${FILESDIR}"/${PN}-5.4.2-use-ninja.patch
|
41 |
43 |
)
|
42 |
44 |
|
43 |
|
CMAKE_USE_DIR="${WORKDIR}/Source"
|
|
45 |
CMAKE_USE_DIR="${S}/${PN}/Source"
|
44 |
46 |
|
45 |
47 |
src_prepare() {
|
46 |
48 |
distutils-r1_src_prepare
|
47 |
|
sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix ${LLVM_MAX_SLOT}),g" "${FILESDIR}"/${PN}-5.1.3-gentoopath.patch > "${S}"/gentoopath.patch || die
|
|
49 |
sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix ${LLVM_MAX_SLOT}),g" \
|
|
50 |
"${FILESDIR}"/${PN}-5.4.2-gentoopath.patch > "${S}"/gentoopath.patch || die
|
48 |
51 |
eapply $(prefixify_ro "${S}"/gentoopath.patch)
|
49 |
52 |
|
50 |
53 |
pushd ${PN} || die
|
... | ... | |
54 |
57 |
sed -r -e "/TENSILE_USE_LLVM/s/ON/OFF/" \
|
55 |
58 |
-i Source/CMakeLists.txt || die
|
56 |
59 |
sed -e "/chmod 755/d" -i Source/TensileCreateLibrary.cmake || die # remove chmod 755 on
|
57 |
|
sed -e "s,\${Tensile_ROOT}/bin/,,g" -i Source/TensileCreateLibrary.cmake cmake/TensileConfig.cmake || die # ${Tensile_ROOT}/bin does not exists; call command directly
|
|
60 |
|
|
61 |
# ${Tensile_ROOT}/bin does not exists; call command directly
|
|
62 |
sed -e "s,\${Tensile_ROOT}/bin/,,g" -i Source/TensileCreateLibrary.cmake cmake/TensileConfig.cmake || die
|
58 |
63 |
|
59 |
64 |
local Tensile_share_dir="\"${EPREFIX}/usr/share/${PN}\""
|
60 |
|
sed -e "/HipClangVersion/s/0,0,0/$(hipconfig -v)/" -i Common.py || die
|
|
65 |
sed -e "/HipClangVersion/s/0.0.0/$(hipconfig -v)/" -i Common.py || die
|
61 |
66 |
|
62 |
|
sed -e "s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir},g" -i ReplacementKernels.py Common.py ${PN}.py || die
|
|
67 |
sed -e "s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir},g" \
|
|
68 |
-i ReplacementKernels.py Common.py ${PN}.py || die
|
63 |
69 |
|
64 |
70 |
sed -e "s|os\.path\.dirname.*$|\"${EPREFIX}/usr/share/Tensile/Source\", end='')|" -i __init__.py || die
|
65 |
71 |
|
66 |
72 |
popd || die
|
67 |
73 |
|
68 |
74 |
sed -e "/package_data/d" -e "/data_files/d" -i setup.py || die
|
|
75 |
use client && PATCHES= cmake_src_prepare # do not apply patches again in cmake_src_prepare
|
|
76 |
}
|
|
77 |
|
|
78 |
src_configure() {
|
|
79 |
distutils-r1_src_configure
|
|
80 |
if use client; then
|
|
81 |
local mycmakeargs=(
|
|
82 |
-DCMAKE_SKIP_RPATH=ON
|
|
83 |
-DTENSILE_USE_MSGPACK=ON
|
|
84 |
-DTENSILE_USE_LLVM=ON
|
|
85 |
-DTensile_LIBRARY_FORMAT=msgpack
|
|
86 |
-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
|
|
87 |
)
|
|
88 |
CXX=hipcc cmake_src_configure
|
|
89 |
fi
|
|
90 |
}
|
|
91 |
|
|
92 |
src_compile() {
|
|
93 |
distutils-r1_src_compile
|
|
94 |
use client && cmake_src_compile
|
69 |
95 |
}
|
70 |
96 |
|
71 |
97 |
python_install() {
|
... | ... | |
85 |
111 |
doins -r Configs Perf ReplacementKernels ReplacementKernels-cov3 Source CustomKernels
|
86 |
112 |
insinto /usr/$(get_libdir)/cmake/${PN}
|
87 |
113 |
doins cmake/*.cmake
|
|
114 |
|
|
115 |
if use client; then
|
|
116 |
pushd "${BUILD_DIR}" || die
|
|
117 |
dobin client/tensile_client
|
|
118 |
fi
|
88 |
119 |
}
|