| 1 |
1 |
# Copyright 1999-2025 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
|
# shellcheck disable=SC2317
|
| 5 |
4 |
EAPI=8
|
| 6 |
5 |
|
| 7 |
6 |
ROCM_VERSION=${PV}
|
| 8 |
|
PYTHON_COMPAT=( python3_{10..13} python3_13t )
|
|
7 |
PYTHON_COMPAT=( python3_{10..14} python3_13t )
|
| 9 |
8 |
|
| 10 |
9 |
inherit check-reqs cmake flag-o-matic multiprocessing python-r1 rocm
|
| 11 |
10 |
|
| ... | ... | |
| 38 |
37 |
"
|
| 39 |
38 |
|
| 40 |
39 |
PATCHES=(
|
| 41 |
|
"${FILESDIR}"/${PN}-6.1.1-enable-examples.patch
|
| 42 |
40 |
"${FILESDIR}"/${PN}-6.1.1-no-git-no-hash.patch
|
| 43 |
|
"${FILESDIR}"/${PN}-6.3.0-no-inline-all.patch
|
| 44 |
41 |
"${FILESDIR}"/${PN}-6.3.0-conditional-kernels.patch
|
| 45 |
|
"${FILESDIR}"/${PN}-6.3.0-conditional-ckprofiler.patch
|
| 46 |
|
"${FILESDIR}"/${PN}-6.3.0-expand-isa.patch
|
|
42 |
"${FILESDIR}"/${PN}-7.0.1-conditional-ckprofiler.patch
|
|
43 |
"${FILESDIR}"/${PN}-7.0.1-libcxx-includes.patch
|
|
44 |
"${FILESDIR}"/${PN}-7.1.0-expand-isa.patch
|
| 47 |
45 |
)
|
| 48 |
46 |
|
| 49 |
47 |
ck_check-reqs() {
|
| ... | ... | |
| 56 |
54 |
ewarn "Please consider setting AMDGPU_TARGETS USE_EXPAND variable to a single architecture."
|
| 57 |
55 |
fi
|
| 58 |
56 |
|
| 59 |
|
# It takes ~2Gb of RAM per build thread
|
|
57 |
# It takes ~3GB of RAM per build thread
|
| 60 |
58 |
local user_jobs=$(makeopts_jobs)
|
| 61 |
|
local free_memory_mb=$(free -m | awk '/Mem:/ {print $4}')
|
| 62 |
|
local max_jobs=$(( free_memory_mb / 2048 ))
|
|
59 |
local available_memory_mb=$(free -m | awk '/Mem:/ {print $7}')
|
|
60 |
local max_jobs=$(( available_memory_mb / 2048 ))
|
| 63 |
61 |
max_jobs=$(( max_jobs < 1 ? 1 : max_jobs ))
|
| 64 |
62 |
local limited_jobs=$(( user_jobs < max_jobs ? user_jobs : max_jobs ))
|
| 65 |
63 |
if [[ "${max_jobs}" -lt "${user_jobs}" ]]; then
|
| 66 |
|
ewarn "${free_memory_mb} MB of free RAM is not enough for ${user_jobs} parallel build jobs (~2Gb per job)."
|
|
64 |
ewarn "${available_memory_mb} MB of free RAM is not enough for ${user_jobs} parallel build jobs (~2Gb per job)."
|
| 67 |
65 |
ewarn "Please consider setting MAKEOPTS=\"-j${limited_jobs}\" for this package."
|
| 68 |
66 |
fi
|
| 69 |
67 |
|
| 70 |
|
local CHECKREQS_MEMORY=$((user_jobs*2048))M
|
|
68 |
local CHECKREQS_MEMORY=$((user_jobs*3072))M
|
| 71 |
69 |
check-reqs_${EBUILD_PHASE_FUNC}
|
| 72 |
70 |
}
|
| 73 |
71 |
|
| ... | ... | |
| 81 |
79 |
|
| 82 |
80 |
src_prepare() {
|
| 83 |
81 |
sed -e '/-Werror/d' -i cmake/EnableCompilerWarnings.cmake || die
|
|
82 |
|
|
83 |
# don't build examples
|
|
84 |
sed -e "/add_subdirectory(example)/d" -i CMakeLists.txt || die
|
|
85 |
|
|
86 |
# Flag -amdgpu-early-inline-all explodes memory consumption
|
|
87 |
# https://github.com/llvm/llvm-project/issues/86332
|
|
88 |
sed -e "/-amdgpu-early-inline-all/d" -e "/-amdgpu-function-calls/d" -i CMakeLists.txt || die
|
|
89 |
|
| 84 |
90 |
cmake_src_prepare
|
| 85 |
91 |
}
|
| 86 |
92 |
|
| ... | ... | |
| 105 |
111 |
-Wno-dev
|
| 106 |
112 |
)
|
| 107 |
113 |
|
|
114 |
# Since 6.4.1 "fallback" DL kernels should be enabled manually...
|
|
115 |
if use amdgpu_targets_gfx1010 || use amdgpu_targets_gfx1011 || use amdgpu_targets_gfx1012 \
|
|
116 |
|| use amdgpu_targets_gfx1030 || use amdgpu_targets_gfx1031 ; then
|
|
117 |
mycmakeargs+=(-DDL_KERNELS=ON)
|
|
118 |
fi
|
|
119 |
|
| 108 |
120 |
if use test; then
|
| 109 |
121 |
mycmakeargs+=(
|
| 110 |
122 |
-DFETCHCONTENT_SOURCE_DIR_GTEST="${WORKDIR}/googletest-${GTEST_COMMIT}"
|
| 111 |
123 |
)
|
| 112 |
124 |
fi
|
| 113 |
125 |
|
|
126 |
# rocminfo call during configuration; should not happen
|
|
127 |
# Bug: https://github.com/ROCm/composable_kernel/issues/2994
|
|
128 |
rocm_add_sandbox -w
|
|
129 |
addpredict /dev/random
|
|
130 |
|
| 114 |
131 |
cmake_src_configure
|
| 115 |
132 |
}
|
| 116 |
133 |
|
| 117 |
134 |
src_install() {
|
| 118 |
135 |
cmake_src_install
|
| 119 |
136 |
|
|
137 |
# shellcheck disable=SC2329
|
| 120 |
138 |
installation() {
|
| 121 |
139 |
python_domodule python/ck4inductor
|
| 122 |
140 |
|