commit:     9e31f3a377e59ad658f81070c2bd7c065387e860
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sun Dec  8 21:00:20 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  5 21:46:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e31f3a3

sci-libs/composable-kernel: add 6.3.0

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-libs/composable-kernel/Manifest                |  1 +
 .../composable-kernel-6.1.1.ebuild                 |  2 +-
 ...6.1.1.ebuild => composable-kernel-6.3.0.ebuild} | 58 +++++++++++++++++-----
 ...sable-kernel-6.3.0-conditional-ckprofiler.patch | 17 +++++++
 ...mposable-kernel-6.3.0-conditional-kernels.patch | 16 ++++++
 .../composable-kernel-6.3.0-no-inline-all.patch    | 16 ++++++
 sci-libs/composable-kernel/metadata.xml            |  3 ++
 7 files changed, 100 insertions(+), 13 deletions(-)

diff --git a/sci-libs/composable-kernel/Manifest 
b/sci-libs/composable-kernel/Manifest
index 9272a772facf..7bdbbc67114a 100644
--- a/sci-libs/composable-kernel/Manifest
+++ b/sci-libs/composable-kernel/Manifest
@@ -1,3 +1,4 @@
 DIST composable-kernel-5.7.1.tar.gz 2158402 BLAKE2B 
660c205c2a99cd17f29a9077e9e7b8b88e41f42ab40d92d0a235e7a60683a04234cce6b2eb6110265c2f461dd132c40151b2521b7d64df4cebb7f27094d8b2b0
 SHA512 
3931c5dbcab59513541103ebf7446311a1e318421a9e12aeafa7a98cf0717a75e1519140e6b2fbcaf4cb90829a11f03a724ff3ccc6636139c61667ac82558c55
 DIST composable-kernel-6.1.1.tar.gz 2520967 BLAKE2B 
549d76c5c36b0a273a4c51159abd162403ad035520f97c43dd4b66560ad30021199d2f4cf7e2c12ffe33beee2fb49604db6d7c40b3b33fdcbfde111b9d4833aa
 SHA512 
3f7667cea91760447c3f6ac0bfc261c0bca95abafbfce209d1c889e04f01ec29849e8d7f0e1cb1d77a4309ac06b3c2557721a773e4a67be383de91668cb279b2
+DIST composable-kernel-6.3.0.tar.gz 3376552 BLAKE2B 
ad3dde27d0134fa8bf6b5935603f7cac17c959ab7b123e8d69cfe82bee188ade0fe9d3666d46d9819de479e875e46c0fdad2574f68a3bcf0e9acbb871f163b24
 SHA512 
4fa7be3f54d06d894dca7ef9fa8e3db24971fb857fee96e7ccff89844fa466789756d5f140d2791a984311d59a044b5351d0358e676c218ea0b0aadf60954d8e
 DIST gtest-1.14.0_p20220421.tar.gz 849107 BLAKE2B 
e9c32d9c1d98959583b696430a6be411f5d69e3db96669b16cffc0f1dcad42512391c0a4733f6e829c82953ff33fa243ee782f3cf6e86436f0d290f45d1a3db7
 SHA512 
967aac7d85da0e216fe13b17d10f894a31d763d9b88201bac7d3dfc37600552b5472d30a166a6ef27f2778677e73fd3e43d082695a48f47824262eb9cd4fcd2f

diff --git a/sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild 
b/sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild
index 44abf5d59c81..59853bd41e85 100644
--- a/sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild
+++ b/sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild
@@ -25,7 +25,7 @@ REQUIRED_USE="${ROCM_REQUIRED_USE}"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
-       dev-util/hip
+       dev-util/hip:${SLOT}
        >=dev-db/sqlite-3.17
        sci-libs/rocBLAS:${SLOT}[${ROCM_USEDEP}]
        >=dev-libs/boost-1.72

diff --git a/sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild 
b/sci-libs/composable-kernel/composable-kernel-6.3.0.ebuild
similarity index 51%
copy from sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild
copy to sci-libs/composable-kernel/composable-kernel-6.3.0.ebuild
index 44abf5d59c81..bbd6854cb1e8 100644
--- a/sci-libs/composable-kernel/composable-kernel-6.1.1.ebuild
+++ b/sci-libs/composable-kernel/composable-kernel-6.3.0.ebuild
@@ -1,11 +1,13 @@
 # Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# shellcheck disable=SC2317
 EAPI=8
 
 ROCM_VERSION=${PV}
+PYTHON_COMPAT=( python3_{10..13} python3_13t )
 
-inherit cmake flag-o-matic rocm
+inherit cmake flag-o-matic python-r1 rocm
 
 GTEST_COMMIT="b85864c64758dec007208e56af933fc3f52044ee"
 GTEST_FILE="gtest-1.14.0_p20220421.tar.gz"
@@ -20,17 +22,13 @@ LICENSE="MIT"
 SLOT="0/$(ver_cut 1-2)"
 KEYWORDS="~amd64"
 
-IUSE="debug test"
-REQUIRED_USE="${ROCM_REQUIRED_USE}"
+IUSE="debug profiler test"
+REQUIRED_USE="${ROCM_REQUIRED_USE} ${PYTHON_REQUIRED_USE}"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
-       dev-util/hip
-       >=dev-db/sqlite-3.17
-       sci-libs/rocBLAS:${SLOT}[${ROCM_USEDEP}]
-       >=dev-libs/boost-1.72
-       dev-cpp/nlohmann_json
-       dev-cpp/frugally-deep
+       dev-util/hip:${SLOT}
+       ${PYTHON_DEPS}
 "
 
 DEPEND="${RDEPEND}"
@@ -41,11 +39,21 @@ BDEPEND="
 
 PATCHES=(
        "${FILESDIR}"/${PN}-6.1.1-enable-examples.patch
-       "${FILESDIR}"/${PN}-6.1.1-fix-clang-17-no-offload-uniform-block.patch
        "${FILESDIR}"/${PN}-6.1.1-no-git-no-hash.patch
-       "${FILESDIR}"/${PN}-6.1.1-fix-libcxx.patch
+       "${FILESDIR}"/${PN}-6.3.0-no-inline-all.patch
+       "${FILESDIR}"/${PN}-6.3.0-conditional-kernels.patch
+       "${FILESDIR}"/${PN}-6.3.0-conditional-ckprofiler.patch
 )
 
+pkg_pretend() {
+       targets=($AMDGPU_TARGETS)
+       if [[ ${#targets[@]} -gt 1 ]]; then
+               ewarn "composable-kernel will be compiled for multiple GPU 
architectures,"
+               ewarn "which will take a significant amount of time."
+               ewarn "Please consider setting AMDGPU_TARGETS USE_EXPAND 
variable to a single architecture."
+       fi
+}
+
 src_prepare() {
        sed -e '/-Werror/d' -i cmake/EnableCompilerWarnings.cmake || die
        cmake_src_prepare
@@ -68,17 +76,43 @@ src_configure() {
                -DGPU_TARGETS="$(get_amdgpu_flags)"
                -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
                -DBUILD_TESTING=$(usex test ON OFF)
+               -DCK_USE_PROFILER=$(usex profiler ON OFF)
+               -Wno-dev
        )
 
        if use test; then
                mycmakeargs+=(
-                       -DGOOGLETEST_DIR="${WORKDIR}/googletest-${GTEST_COMMIT}"
+                       
-DFETCHCONTENT_SOURCE_DIR_GTEST="${WORKDIR}/googletest-${GTEST_COMMIT}"
                )
        fi
 
        cmake_src_configure
 }
 
+src_install() {
+       cmake_src_install
+
+       installation() {
+               python_domodule python/ck4inductor
+
+               # install package-data manually, as there is no PEP517 
compliance
+               shopt -s globstar
+               package_data=(
+                       include/ck/**/*.hpp
+                       
library/src/tensor_operation_instance/gpu/gemm_universal/**/*.hpp
+               )
+               shopt -u globstar
+
+               inst_path="${D}$(python_get_sitedir)/ck4inductor"
+               for file in "${package_data[@]}"; do
+                       location="${inst_path}/$(dirname "$file")"
+                       mkdir -p "${location}"
+                       cp "${file}" "${location}"
+               done
+       }
+       python_foreach_impl installation
+}
+
 src_test() {
        check_amdgpu
        LD_LIBRARY_PATH="${BUILD_DIR}"/lib cmake_src_test -j1

diff --git 
a/sci-libs/composable-kernel/files/composable-kernel-6.3.0-conditional-ckprofiler.patch
 
b/sci-libs/composable-kernel/files/composable-kernel-6.3.0-conditional-ckprofiler.patch
new file mode 100644
index 000000000000..5a0c81de9879
--- /dev/null
+++ 
b/sci-libs/composable-kernel/files/composable-kernel-6.3.0-conditional-ckprofiler.patch
@@ -0,0 +1,17 @@
+Add a flag to build without ckprofiler, which takes few GB of space and not 
used in many cases.
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -561,11 +561,13 @@ if(NOT GPU_ARCHS AND USER_GPU_TARGETS)
+    endif()
+ endif()
+ 
++if(CK_USE_PROFILER)
+ rocm_package_setup_component(profiler
+     LIBRARY_NAME composablekernel
+     PACKAGE_NAME ckprofiler
+ )
+ add_subdirectory(profiler)
++endif()
+ 
+ if(CK_USE_CODEGEN AND (GPU_TARGETS MATCHES "gfx9" OR GPU_ARCHS))
+   add_subdirectory(codegen)

diff --git 
a/sci-libs/composable-kernel/files/composable-kernel-6.3.0-conditional-kernels.patch
 
b/sci-libs/composable-kernel/files/composable-kernel-6.3.0-conditional-kernels.patch
new file mode 100644
index 000000000000..64a8e0b96905
--- /dev/null
+++ 
b/sci-libs/composable-kernel/files/composable-kernel-6.3.0-conditional-kernels.patch
@@ -0,0 +1,16 @@
+Fix component discovery, when some targets are not installed.
+Upstream bug: https://github.com/ROCm/composable_kernel/issues/1646
+--- a/Config.cmake.in
++++ b/Config.cmake.in
+@@ -6,6 +6,10 @@ foreach(_comp ${composable_kernel_FIND_COMPONENTS})
+       if(NOT _comp IN_LIST _composable_kernel_supported_components)
+               set(composable_kernel_FOUND False)
+               set(composable_kernel_NOT_FOUND_MESSAGE "Unsupported component: 
${_comp}")
++      elseif(NOT EXISTS 
"${CMAKE_CURRENT_LIST_DIR}/composable_kernel${_comp}Targets.cmake")
++              set(composable_kernel_FOUND False)
++              set(composable_kernel_NOT_FOUND_MESSAGE "Unsupported component 
for current targets: ${_comp}")
++      else()
++              
include("${CMAKE_CURRENT_LIST_DIR}/composable_kernel${_comp}Targets.cmake")
+       endif()
+-      
include("${CMAKE_CURRENT_LIST_DIR}/composable_kernel${_comp}Targets.cmake")
+ endforeach()

diff --git 
a/sci-libs/composable-kernel/files/composable-kernel-6.3.0-no-inline-all.patch 
b/sci-libs/composable-kernel/files/composable-kernel-6.3.0-no-inline-all.patch
new file mode 100644
index 000000000000..5ccf5239cb1e
--- /dev/null
+++ 
b/sci-libs/composable-kernel/files/composable-kernel-6.3.0-no-inline-all.patch
@@ -0,0 +1,16 @@
+Flag -amdgpu-early-inline-all explodes memory consumption, so that build does 
not fit 64GB of RAM.
+LLVM bug: https://github.com/llvm/llvm-project/issues/86332
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -213,11 +213,6 @@ if(NOT WIN32 AND check-coerce AND ${hip_VERSION_FLAT} 
GREATER 600241132 AND ${hi
+    message("Adding the amdgpu-coerce-illegal-types=1")
+    add_compile_options("SHELL: -mllvm -amdgpu-coerce-illegal-types=1")
+ endif()
+-if(NOT WIN32 AND ${hip_VERSION_FLAT} GREATER 600241132)
+-   message("Adding -amdgpu-early-inline-all=true and 
-amdgpu-function-calls=false")
+-   add_compile_options("SHELL: -mllvm -amdgpu-early-inline-all=true")
+-   add_compile_options("SHELL: -mllvm -amdgpu-function-calls=false")
+-endif()
+ #
+ # Seperate linking jobs from compiling
+ # Too many concurrent linking jobs can break the build

diff --git a/sci-libs/composable-kernel/metadata.xml 
b/sci-libs/composable-kernel/metadata.xml
index afd22272458c..304ae9aafa5e 100644
--- a/sci-libs/composable-kernel/metadata.xml
+++ b/sci-libs/composable-kernel/metadata.xml
@@ -9,6 +9,9 @@
     <email>[email protected]</email>
     <name>Science Project</name>
   </maintainer>
+       <use>
+               <flag name="profiler">Build and install the Composable Kernal 
profiler (ckProfiler)</flag>
+       </use>
   <upstream>
     <remote-id type="github">ROCm/composable_kernel</remote-id>
   </upstream>

Reply via email to