summaryrefslogtreecommitdiff
path: root/sys-libs/llvm-offload
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-12-08 02:07:29 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-12-08 02:07:29 +0000
commit494168b06b81a32b889c3cb1f721f925d0a6824f (patch)
tree0ec763ffa61af808a83f365fb6680258d2e28a50 /sys-libs/llvm-offload
parent2198f8593ae0312add1bdccb49edfcb935e5f8a6 (diff)
gentoo auto-resync : 08:12:2024 - 02:07:28
Diffstat (limited to 'sys-libs/llvm-offload')
-rw-r--r--sys-libs/llvm-offload/Manifest4
-rw-r--r--sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild147
-rw-r--r--sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild152
-rw-r--r--sys-libs/llvm-offload/metadata.xml13
4 files changed, 316 insertions, 0 deletions
diff --git a/sys-libs/llvm-offload/Manifest b/sys-libs/llvm-offload/Manifest
new file mode 100644
index 000000000000..22bb3cc3c92c
--- /dev/null
+++ b/sys-libs/llvm-offload/Manifest
@@ -0,0 +1,4 @@
+DIST llvm-project-32f7f0010bca99ee4bd917f57272733fb2bf3bd9.tar.gz 223983502 BLAKE2B fd3e6b0b795abc42568ef98fa774d927029c18838a5d0f34eaa66c37976444a63f2fc5d883f3bf3a98533f51e387936f1c659230f31c757d26153425696a16cd SHA512 65a345ad5b77c627008f759947e5e9f28a62c8992d7146113e0446e5849feaf9088c15c8b22ca0824af5b927d6a417f5326258b489fb8ccea78ec9e0e0fe8fba
+EBUILD llvm-offload-20.0.0.9999.ebuild 3740 BLAKE2B a322833d1dabd50b7f8883ffad5fad760365de982d9442b6a0b3076c8f12596e3a45c058db14907f1bc6ffff7b2c630f5fc91168f064386e58a5aa2881e65ba6 SHA512 291226ca6c6ffb1e83525e6cef8a41e08925f6404366e4981eaf3bbac43b8c7bc7d41a0bddbe0387bf013f62c4c0b0de391e46ba63ed73b2a79ffc50747c12f3
+EBUILD llvm-offload-20.0.0_pre20241207.ebuild 4093 BLAKE2B bb2cbe1363a77de377fab7fcdd4ec55c0b9288303d7c7753791a9966990b2d14b832c9b9d6a42b35ab3f9905fe2ce836c1e3edefe28d81693c6103da37ac1020 SHA512 137a7adec3a0a01991fc06cfcc1833c77742e31a08fa69ab1f877429374031b0280673a45f6bebe314f6bd93fe651bf4b464372fe8b4fa771317801602826ffd
+MISC metadata.xml 379 BLAKE2B 2b4c75d4ec6e126d887b736ea978c4b34683a347252f408c9d1f5f55c6c1bead7b7f9533812806f816538d8abaa00ded4d439dbe626d3f2cf09b78a3674e41bd SHA512 d49054d4b5a1a051d83f1ef397a7925fb36ee3092668d134e6ed5c1218bf5d67a43145b689709677643da070a783ec9f8705b37f15587475829fe185634af1d4
diff --git a/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild b/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild
new file mode 100644
index 000000000000..1e9ec4ce3ce4
--- /dev/null
+++ b/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+inherit cmake flag-o-matic llvm.org python-any-r1 toolchain-funcs
+
+DESCRIPTION="OpenMP offloading support"
+HOMEPAGE="https://openmp.llvm.org"
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0/${LLVM_SOABI}"
+IUSE="+debug ompt test llvm_targets_AMDGPU llvm_targets_NVPTX"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ dev-libs/libffi:=
+ ~sys-devel/llvm-${PV}
+ ~sys-libs/libomp-${PV}[ompt?]
+ llvm_targets_AMDGPU? ( dev-libs/rocr-runtime:= )
+"
+DEPEND="
+ ${RDEPEND}
+"
+# tests:
+# - dev-python/lit provides the test runner
+# - sys-devel/llvm provide test utils (e.g. FileCheck)
+# - sys-devel/clang provides the compiler to run tests
+BDEPEND="
+ dev-lang/perl
+ virtual/pkgconfig
+ llvm_targets_AMDGPU? ( sys-devel/clang )
+ llvm_targets_NVPTX? ( sys-devel/clang )
+ test? (
+ $(python_gen_any_dep '
+ dev-python/lit[${PYTHON_USEDEP}]
+ ')
+ sys-devel/clang
+ )
+"
+# TODO: can it be fixed to compile with gcc?
+BDEPEND+="
+ sys-devel/clang
+"
+
+LLVM_COMPONENTS=( offload cmake runtimes/cmake libc/shared )
+LLVM_TEST_COMPONENTS=( openmp/cmake )
+llvm.org_set_globals
+
+pkg_pretend() {
+ if [[ ${LLVM_ALLOW_GPU_TESTING} ]]; then
+ ewarn "LLVM_ALLOW_GPU_TESTING set. This package will run tests against your"
+ ewarn "GPU if it is supported. Note that these tests may be flaky, fail or"
+ ewarn "hang, or even cause your GPU to crash (requiring a reboot)."
+ fi
+}
+
+pkg_setup() {
+ if use test; then
+ python-any-r1_pkg_setup
+ fi
+}
+
+src_configure() {
+ # TODO
+ local -x CC=${CHOST}-clang
+ local -x CXX=${CHOST}-clang++
+ strip-unsupported-flags
+
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+ local libdir="$(get_libdir)"
+ local ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
+ local ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
+ local plugins="host"
+ local gpus=
+ local build_devicertl=FALSE
+
+ if has "${CHOST%%-*}" aarch64 powerpc64le x86_64; then
+ if use llvm_targets_AMDGPU; then
+ plugins+=";amdgpu"
+ build_devicertl=TRUE
+ gpus+="amdgpu"
+ fi
+ if use llvm_targets_NVPTX; then
+ plugins+=";cuda"
+ build_devicertl=TRUE
+ gpus+="nvptx"
+ fi
+ [[ ${gpus} == amdgpunvptx ]] && gpus=all
+ fi
+
+ local mycmakeargs=(
+ -DOFFLOAD_LIBDIR_SUFFIX="${libdir#lib}"
+ -DLIBOMPTARGET_PLUGINS_TO_BUILD="${plugins}"
+ -DLIBOMPTARGET_OMPT_SUPPORT="$(usex ompt)"
+ -DLIBOMPTARGET_BUILD_DEVICERTL_BCLIB="${build_devicertl}"
+
+ # this breaks building static target libs
+ -DBUILD_SHARED_LIBS=OFF
+
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+ )
+
+ [[ ! ${LLVM_ALLOW_GPU_TESTING} ]] && mycmakeargs+=(
+ # prevent trying to access the GPU
+ -DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
+ -DLIBOMPTARGET_NVPTX_ARCH=LIBOMPTARGET_NVPTX_ARCH-NOTFOUND
+ )
+ [[ -n ${gpus} ]] && mycmakeargs+=(
+ -DLIBOMPTARGET_DEVICE_ARCHITECTURES="${gpus}"
+ )
+ use test && mycmakeargs+=(
+ # this project does not use standard LLVM cmake macros
+ -DOPENMP_LLVM_LIT_EXECUTABLE="${EPREFIX}/usr/bin/lit"
+ -DOPENMP_LIT_ARGS="$(get_lit_flags)"
+
+ -DOPENMP_TEST_C_COMPILER="$(type -P "${CHOST}-clang")"
+ -DOPENMP_TEST_CXX_COMPILER="$(type -P "${CHOST}-clang++")"
+ )
+
+ cmake_src_configure
+
+ if [[ -z ${gpus} ]]; then
+ # clang requires libomptarget.devicertl.a, but it can be empty
+ > "${BUILD_DIR}"/libomptarget.devicertl.a || die
+ fi
+}
+
+src_test() {
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+
+ cmake_build check-offload
+}
+
+src_install() {
+ cmake_src_install
+
+ if [[ ! -f ${ED}/usr/$(get_libdir)/libomptarget.devicertl.a ]]
+ then
+ dolib.a "${BUILD_DIR}"/libomptarget.devicertl.a
+ fi
+}
diff --git a/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild b/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild
new file mode 100644
index 000000000000..adee1702c49a
--- /dev/null
+++ b/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild
@@ -0,0 +1,152 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+inherit cmake flag-o-matic llvm.org python-any-r1 toolchain-funcs
+
+DESCRIPTION="OpenMP offloading support"
+HOMEPAGE="https://openmp.llvm.org"
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0/${LLVM_SOABI}"
+IUSE="+debug ompt test llvm_targets_AMDGPU llvm_targets_NVPTX"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ dev-libs/libffi:=
+ ~sys-devel/llvm-${PV}
+ ~sys-libs/libomp-${PV}[ompt?]
+ llvm_targets_AMDGPU? ( dev-libs/rocr-runtime:= )
+"
+DEPEND="
+ ${RDEPEND}
+"
+# tests:
+# - dev-python/lit provides the test runner
+# - sys-devel/llvm provide test utils (e.g. FileCheck)
+# - sys-devel/clang provides the compiler to run tests
+BDEPEND="
+ dev-lang/perl
+ virtual/pkgconfig
+ llvm_targets_AMDGPU? ( sys-devel/clang )
+ llvm_targets_NVPTX? ( sys-devel/clang )
+ test? (
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep '
+ dev-python/lit[${PYTHON_USEDEP}]
+ ')
+ sys-devel/clang
+ )
+"
+# TODO: can it be fixed to compile with gcc?
+BDEPEND+="
+ sys-devel/clang
+"
+
+LLVM_COMPONENTS=( offload cmake runtimes/cmake libc/shared )
+LLVM_TEST_COMPONENTS=( openmp/cmake )
+llvm.org_set_globals
+
+pkg_pretend() {
+ if [[ ${LLVM_ALLOW_GPU_TESTING} ]]; then
+ ewarn "LLVM_ALLOW_GPU_TESTING set. This package will run tests against your"
+ ewarn "GPU if it is supported. Note that these tests may be flaky, fail or"
+ ewarn "hang, or even cause your GPU to crash (requiring a reboot)."
+ fi
+}
+
+pkg_setup() {
+ if use test; then
+ python-any-r1_pkg_setup
+ fi
+}
+
+src_configure() {
+ # TODO
+ local -x CC=${CHOST}-clang
+ local -x CXX=${CHOST}-clang++
+ strip-unsupported-flags
+
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+ local libdir="$(get_libdir)"
+ local ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
+ local ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
+ local plugins="host"
+ local gpus=
+ local build_devicertl=FALSE
+
+ if has "${CHOST%%-*}" aarch64 powerpc64le x86_64; then
+ if use llvm_targets_AMDGPU; then
+ plugins+=";amdgpu"
+ build_devicertl=TRUE
+ gpus+=";gfx700;gfx701;gfx801;gfx803;gfx900;gfx902;gfx906"
+ gpus+=";gfx908;gfx90a;gfx90c;gfx940;gfx941;gfx942;gfx950"
+ gpus+=";gfx1010;gfx1012;gfx1030;gfx1031;gfx1032;gfx1033"
+ gpus+=";gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102"
+ gpus+=";gfx1103;gfx1150;gfx1151;gfx1152;gfx1153"
+ fi
+ if use llvm_targets_NVPTX; then
+ plugins+=";cuda"
+ build_devicertl=TRUE
+ gpus+=";sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62"
+ gpus+=";sm_70;sm_72;sm_75;sm_80;sm_86;sm_87;sm_89;sm_90"
+ fi
+ fi
+
+ local mycmakeargs=(
+ -DOFFLOAD_LIBDIR_SUFFIX="${libdir#lib}"
+ -DLIBOMPTARGET_PLUGINS_TO_BUILD="${plugins}"
+ -DLIBOMPTARGET_OMPT_SUPPORT="$(usex ompt)"
+ -DLIBOMPTARGET_BUILD_DEVICERTL_BCLIB="${build_devicertl}"
+
+ # this breaks building static target libs
+ -DBUILD_SHARED_LIBS=OFF
+
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+ )
+
+ [[ ! ${LLVM_ALLOW_GPU_TESTING} ]] && mycmakeargs+=(
+ # prevent trying to access the GPU
+ -DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
+ -DLIBOMPTARGET_NVPTX_ARCH=LIBOMPTARGET_NVPTX_ARCH-NOTFOUND
+ )
+ [[ -n ${gpus} ]] && mycmakeargs+=(
+ -DLIBOMPTARGET_DEVICE_ARCHITECTURES="${gpus}"
+ )
+ use test && mycmakeargs+=(
+ # this project does not use standard LLVM cmake macros
+ -DOPENMP_LLVM_LIT_EXECUTABLE="${EPREFIX}/usr/bin/lit"
+ -DOPENMP_LIT_ARGS="$(get_lit_flags)"
+
+ -DOPENMP_TEST_C_COMPILER="$(type -P "${CHOST}-clang")"
+ -DOPENMP_TEST_CXX_COMPILER="$(type -P "${CHOST}-clang++")"
+ )
+
+ cmake_src_configure
+
+ if [[ -z ${gpus} ]]; then
+ # clang requires libomptarget.devicertl.a, but it can be empty
+ > "${BUILD_DIR}"/libomptarget.devicertl.a || die
+ fi
+}
+
+src_test() {
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+
+ cmake_build check-offload
+}
+
+src_install() {
+ cmake_src_install
+
+ if [[ ! -f ${ED}/usr/$(get_libdir)/libomptarget.devicertl.a ]]
+ then
+ dolib.a "${BUILD_DIR}"/libomptarget.devicertl.a
+ fi
+}
diff --git a/sys-libs/llvm-offload/metadata.xml b/sys-libs/llvm-offload/metadata.xml
new file mode 100644
index 000000000000..d13785bbe1b6
--- /dev/null
+++ b/sys-libs/llvm-offload/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>llvm@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="ompt">Enable OpenMP Tools Interface support</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">llvm/llvm-project</remote-id>
+ </upstream>
+</pkgmetadata>