From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 81DEA1382C5 for ; Wed, 20 Jan 2021 05:36:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8EDA4E0824; Wed, 20 Jan 2021 05:36:27 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6189FE0824 for ; Wed, 20 Jan 2021 05:36:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C722C340139 for ; Wed, 20 Jan 2021 05:36:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 38910CC for ; Wed, 20 Jan 2021 05:36:24 +0000 (UTC) From: "Benda XU" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Benda XU" Message-ID: <1611118312.8837056f58be66a4bc0cad115f66264fb8e066d7.heroxbd@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/hip/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-util/hip/hip-4.0.0-r1.ebuild X-VCS-Directories: dev-util/hip/ X-VCS-Committer: heroxbd X-VCS-Committer-Name: Benda XU X-VCS-Revision: 8837056f58be66a4bc0cad115f66264fb8e066d7 X-VCS-Branch: master Date: Wed, 20 Jan 2021 05:36:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 571a8d8a-0b5c-4f6d-b6d5-f141d868bed8 X-Archives-Hash: e291459208c33e25bc3f0273dc73efd4 commit: 8837056f58be66a4bc0cad115f66264fb8e066d7 Author: Benda Xu gentoo org> AuthorDate: Tue Jan 19 12:53:28 2021 +0000 Commit: Benda XU gentoo org> CommitDate: Wed Jan 20 04:51:52 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8837056f dev-util/hip: replace hcc with rocclr. hcc is deprecated and rocclr is the mainstream. Replace remaining hcc in run_hipcc.cmake and hipcc. This also enables --genco support, which will be essential in building e.g. Tensile. Fix trailing - in HIP_LIB_VERSION_STRING by imposing Gentoo version. Let cmake use the correct HIP_CLANG_INCLUDE_PATH for llvm-roc. Suggested-by: Yiyang Wu gmail.com> Closes: https://bugs.gentoo.org/733794 Package-Manager: Portage-3.0.12, Repoman-3.0.1 Signed-off-by: Benda Xu gentoo.org> dev-util/hip/hip-4.0.0-r1.ebuild | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/dev-util/hip/hip-4.0.0-r1.ebuild b/dev-util/hip/hip-4.0.0-r1.ebuild new file mode 100644 index 00000000000..9252cfffc77 --- /dev/null +++ b/dev-util/hip/hip-4.0.0-r1.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit cmake flag-o-matic prefix + +DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" +HOMEPAGE="https://github.com/ROCm-Developer-Tools/HIP" +SRC_URI="https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-${PV}.tar.gz -> rocm-hip-${PV}.tar.gz" + +KEYWORDS="~amd64" +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" + +IUSE="debug profile" + +# Don't strip to prevent some tests from failing. +RESTRICT="strip" + +DEPEND=">=dev-libs/rocclr-$(ver_cut 1-2) + >=dev-util/rocminfo-$(ver_cut 1-2) + =sys-devel/llvm-roc-${PV}*[runtime]" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}/${PN}-3.9.0-DisableTest.patch" + "${FILESDIR}/${PN}-3.9.0-add-include-directories.patch" + "${FILESDIR}/${PN}-3.5.1-config-cmake-in.patch" + "${FILESDIR}/${PN}-3.5.1-hip_vector_types.patch" + "${FILESDIR}/${PN}-3.5.1-detect_offload-arch_for_clang-roc.patch" + "${FILESDIR}/${PN}-3.9.0-lpl_ca-add-include.patch" +) + +S="${WORKDIR}/HIP-rocm-${PV}" + +src_prepare() { + cmake_src_prepare + eapply_user + + # Use Gentoo version number, otherwise git hash is attempted in vain. + sed -e "/set (HIP_LIB_VERSION_STRING/cset (HIP_LIB_VERSION_STRING ${PVR})" -i CMakeLists.txt || die + + # disable PCH, because it results in a build error in ROCm 4.0.0 + sed -e "s:option(__HIP_ENABLE_PCH:#option(__HIP_ENABLE_PCH:" -i "${S}/CMakeLists.txt" || die + + # "hcc" is deprecated and not installed, new platform is "rocclr"; + # Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include" + # which makes "stdlib.h" not found when using "#include_next" in header files; + sed -e "/HIP_PLATFORM.*HIP_COMPILER.*clang/s:hcc:rocclr:" \ + -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \ + -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \ + -i bin/hipcc || die + + # replace hcc remnants with modern rocclr. + sed -e "/HIP_PLATFORM.*STREQUAL/s:hcc:rocclr:" -i cmake/FindHIP/run_hipcc.cmake || die + + # correctly find HIP_CLANG_INCLUDE_PATH using cmake + sed -e "/set(HIP_CLANG_ROOT/s:\"\${ROCM_PATH}/llvm\":/usr/lib/llvm/roc:" -i hip-config.cmake.in || die + + # change --hip-device-lib-path to "/usr/lib/amdgcn/bitcode", must align with "dev-libs/rocm-device-libs" + sed -e "s:\${AMD_DEVICE_LIBS_PREFIX}/lib:/usr/lib/amdgcn/bitcode:" \ + -i "${S}/hip-config.cmake.in" || die + + einfo "prefixing hipcc and its utils..." + hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${S}") +} + +src_configure() { + strip-flags + if ! use debug; then + append-cflags "-DNDEBUG" + append-cxxflags "-DNDEBUG" + buildtype="Release" + else + buildtype="Debug" + fi + + # TODO: Currently a GENTOO configuration is build, + # this is also used in the cmake configuration files + # which will be installed to find HIP; + # Other ROCm packages expect a "RELEASE" configuration, + # see "hipBLAS" + local mycmakeargs=( + -DCMAKE_PREFIX_PATH="${EPREFIX}/usr/lib/llvm/roc" + -DCMAKE_BUILD_TYPE=${buildtype} + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/hip" + -DBUILD_HIPIFY_CLANG=OFF + -DHIP_PLATFORM=rocclr + -DHIP_RUNTIME=ROCclr + -DHIP_COMPILER=clang + -DROCM_PATH="${EPREFIX}/usr" + -DHSA_PATH="${EPREFIX}/usr" + -DUSE_PROF_API=$(usex profile 1 0) + -DROCclr_DIR="${EPREFIX}"/usr/include/rocclr + ) + + cmake_src_configure +} + +src_install() { + echo "HSA_PATH=${EPREFIX}/usr" > 99hip || die + echo "ROCM_PATH=${EPREFIX}/usr" >> 99hip || die + echo "HIP_PLATFORM=rocclr" >> 99hip || die + echo "HIP_RUNTIME=ROCclr" >> 99hip || die + echo "HIP_COMPILER=clang" >> 99hip || die + echo "HIP_CLANG_PATH=${EPREFIX}/usr/lib/llvm/roc/bin" >> 99hip || die + + echo "PATH=${EPREFIX}/usr/lib/hip/bin" >> 99hip || die + echo "HIP_PATH=${EPREFIX}/usr/lib/hip" >> 99hip || die + echo "LDPATH=${EPREFIX}/usr/lib/hip/lib" >> 99hip || die + echo "ROOTPATH=${EPREFIX}/usr/lib/hip/bin" >> 99hip || die + + doenvd 99hip + + cmake_src_install +}