public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocr-runtime/files/, dev-libs/rocr-runtime/
Date: Sun, 10 Mar 2024 02:16:49 +0000 (UTC)	[thread overview]
Message-ID: <1710036974.9e7cda93ca888ceabe7c14bf3ddb961c36fdc049.sam@gentoo> (raw)

commit:     9e7cda93ca888ceabe7c14bf3ddb961c36fdc049
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sat Mar  9 14:49:32 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 10 02:16:14 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e7cda93

dev-libs/rocr-runtime: fix compilation with musl for 5.7.1 and 6.0.0

Upstream bug: https://github.com/ROCm/ROCR-Runtime/issues/181
Closes: https://bugs.gentoo.org/921322
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/rocr-runtime-5.7.1-musl.patch            | 106 +++++++++++++++++++++
 ....7.1-r1.ebuild => rocr-runtime-5.7.1-r2.ebuild} |   9 +-
 ...e-6.0.0.ebuild => rocr-runtime-6.0.0-r1.ebuild} |   7 +-
 3 files changed, 115 insertions(+), 7 deletions(-)

diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-musl.patch b/dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-musl.patch
new file mode 100644
index 000000000000..0e8e53209738
--- /dev/null
+++ b/dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-musl.patch
@@ -0,0 +1,106 @@
+Fix compilation with musl.
+
+Bug: https://github.com/ROCm/ROCR-Runtime/issues/181
+--- a/core/inc/checked.h
++++ b/core/inc/checked.h
+@@ -58,7 +58,7 @@ template <uint64_t code, bool multiProcess = false> class Check final {
+   Check(const Check&) { object_ = uintptr_t(this) ^ uintptr_t(code); }
+   Check(Check&&) { object_ = uintptr_t(this) ^ uintptr_t(code); }
+ 
+-  ~Check() { object_ = NULL; }
++  ~Check() { object_ = uintptr_t(NULL); }
+ 
+   const Check& operator=(Check&& rhs) { return *this; }
+   const Check& operator=(const Check& rhs) { return *this; }
+--- a/core/runtime/default_signal.cpp
++++ b/core/runtime/default_signal.cpp
+@@ -57,7 +57,7 @@ int BusyWaitSignal::rtti_id_ = 0;
+ BusyWaitSignal::BusyWaitSignal(SharedSignal* abi_block, bool enableIPC)
+     : Signal(abi_block, enableIPC) {
+   signal_.kind = AMD_SIGNAL_KIND_USER;
+-  signal_.event_mailbox_ptr = NULL;
++  signal_.event_mailbox_ptr = uint64_t(NULL);
+ }
+ 
+ hsa_signal_value_t BusyWaitSignal::LoadRelaxed() {
+--- a/core/util/lnx/os_linux.cpp
++++ b/core/util/lnx/os_linux.cpp
+@@ -111,9 +111,12 @@ class os_thread {
+       }
+     }
+ 
++    int cores = 0;
++    cpu_set_t* cpuset = nullptr;
++
+     if (core::Runtime::runtime_singleton_->flag().override_cpu_affinity()) {
+-      int cores = get_nprocs_conf();
+-      cpu_set_t* cpuset = CPU_ALLOC(cores);
++      cores = get_nprocs_conf();
++      cpuset = CPU_ALLOC(cores);
+       if (cpuset == nullptr) {
+         fprintf(stderr, "CPU_ALLOC failed: %s\n", strerror(errno));
+         return;
+@@ -122,12 +125,6 @@ class os_thread {
+       for (int i = 0; i < cores; i++) {
+         CPU_SET(i, cpuset);
+       }
+-      err = pthread_attr_setaffinity_np(&attrib, CPU_ALLOC_SIZE(cores), cpuset);
+-      CPU_FREE(cpuset);
+-      if (err != 0) {
+-        fprintf(stderr, "pthread_attr_setaffinity_np failed: %s\n", strerror(err));
+-        return;
+-      }
+     }
+ 
+     err = pthread_create(&thread, &attrib, ThreadTrampoline, args.get());
+@@ -157,6 +154,14 @@ class os_thread {
+     if (err != 0) {
+       fprintf(stderr, "pthread_attr_destroy failed: %s\n", strerror(err));
+     }
++
++    if (thread && cores && cpuset) {
++      err = pthread_setaffinity_np(thread, CPU_ALLOC_SIZE(cores), cpuset);
++      CPU_FREE(cpuset);
++      if (err != 0) {
++        fprintf(stderr, "pthread_setaffinity_np failed: %s\n", strerror(err));
++      }
++    }
+   }
+ 
+   os_thread(os_thread&& rhs) {
+@@ -617,11 +622,13 @@ SharedMutex CreateSharedMutex() {
+     fprintf(stderr, "rw lock attribute init failed: %s\n", strerror(err));
+     return nullptr;
+   }
++#if defined(__GLIBC__)
+   err = pthread_rwlockattr_setkind_np(&attrib, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
+   if (err != 0) {
+     fprintf(stderr, "Set rw lock attribute failure: %s\n", strerror(err));
+     return nullptr;
+   }
++#endif
+ 
+   pthread_rwlock_t* lock = new pthread_rwlock_t;
+   err = pthread_rwlock_init(lock, &attrib);
+--- a/core/util/utils.h
++++ b/core/util/utils.h
+@@ -74,7 +74,7 @@ static __forceinline void* _aligned_malloc(size_t size, size_t alignment) {
+   return aligned_alloc(alignment, size);
+ #else
+   void *mem = NULL;
+-  if (NULL != posix_memalign(&mem, alignment, size))
++  if (0 != posix_memalign(&mem, alignment, size))
+     return NULL;
+   return mem;
+ #endif
+--- a/image/util.h
++++ b/image/util.h
+@@ -95,7 +95,7 @@ static __forceinline void* _aligned_malloc(size_t size, size_t alignment) {
+   return aligned_alloc(alignment, size);
+ #else
+   void* mem = NULL;
+-  if (NULL != posix_memalign(&mem, alignment, size)) return NULL;
++  if (0 != posix_memalign(&mem, alignment, size)) return NULL;
+   return mem;
+ #endif
+ }

diff --git a/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild b/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r2.ebuild
similarity index 94%
rename from dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild
rename to dev-libs/rocr-runtime/rocr-runtime-5.7.1-r2.ebuild
index 564da67950fa..00615488c2d2 100644
--- a/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild
+++ b/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r2.ebuild
@@ -3,10 +3,10 @@
 
 EAPI=8
 
-inherit cmake flag-o-matic llvm
-
 LLVM_MAX_SLOT=17
 
+inherit cmake flag-o-matic llvm
+
 if [[ ${PV} == *9999 ]] ; then
 	EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCR-Runtime/"
 	inherit git-r3
@@ -22,6 +22,7 @@ HOMEPAGE="https://github.com/RadeonOpenCompute/ROCR-Runtime"
 PATCHES=(
 	"${FILESDIR}/${PN}-4.3.0_no-aqlprofiler.patch"
 	"${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch"
+	"${FILESDIR}/${PN}-5.7.1-musl.patch"
 )
 
 LICENSE="MIT"
@@ -33,8 +34,8 @@ COMMON_DEPEND="dev-libs/elfutils
 DEPEND="${COMMON_DEPEND}
 	>=dev-libs/roct-thunk-interface-${PV}
 	>=dev-libs/rocm-device-libs-${PV}
-	sys-devel/clang
-	sys-devel/lld"
+	sys-devel/clang:${LLVM_MAX_SLOT}=
+	sys-devel/lld:${LLVM_MAX_SLOT}="
 RDEPEND="${DEPEND}"
 BDEPEND="app-editors/vim-core"
 	# vim-core is needed for "xxd"

diff --git a/dev-libs/rocr-runtime/rocr-runtime-6.0.0.ebuild b/dev-libs/rocr-runtime/rocr-runtime-6.0.0-r1.ebuild
similarity index 92%
rename from dev-libs/rocr-runtime/rocr-runtime-6.0.0.ebuild
rename to dev-libs/rocr-runtime/rocr-runtime-6.0.0-r1.ebuild
index 840a1949b160..cdd27fbbbefd 100644
--- a/dev-libs/rocr-runtime/rocr-runtime-6.0.0.ebuild
+++ b/dev-libs/rocr-runtime/rocr-runtime-6.0.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -21,6 +21,7 @@ DESCRIPTION="Radeon Open Compute Runtime"
 HOMEPAGE="https://github.com/RadeonOpenCompute/ROCR-Runtime"
 PATCHES=(
 	"${FILESDIR}/${PN}-4.3.0_no-aqlprofiler.patch"
+	"${FILESDIR}/${PN}-5.7.1-musl.patch"
 )
 
 LICENSE="MIT"
@@ -32,8 +33,8 @@ COMMON_DEPEND="dev-libs/elfutils
 DEPEND="${COMMON_DEPEND}
 	>=dev-libs/roct-thunk-interface-${PV}
 	>=dev-libs/rocm-device-libs-${PV}
-	sys-devel/clang
-	sys-devel/lld"
+	sys-devel/clang:${LLVM_MAX_SLOT}=
+	sys-devel/lld:${LLVM_MAX_SLOT}="
 RDEPEND="${DEPEND}"
 BDEPEND="app-editors/vim-core"
 	# vim-core is needed for "xxd"


             reply	other threads:[~2024-03-10  2:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10  2:16 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-13  8:38 [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocr-runtime/files/, dev-libs/rocr-runtime/ Sam James
2024-03-08 19:22 Sam James
2022-12-19 14:00 Andreas Sturmlechner
2022-02-11 16:12 Joonas Niilola
2022-02-06 14:48 Benda XU
2021-03-28 21:20 Craig Andrews
2020-08-22 17:49 Craig Andrews
2019-10-03 15:54 Craig Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1710036974.9e7cda93ca888ceabe7c14bf3ddb961c36fdc049.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox