summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2024-05-22 10:15:20 +0000
committerSam James <sam@gentoo.org>2024-06-26 10:19:08 +0100
commitb586bf0bd34aa9bb5ad469b650e237ba43615ffb (patch)
treedf79cf357bd4f3da357f037252ab3f28e3343a9a /dev-util/hip
parentdev-libs/rocm-comgr: drop 6.0.0, cleanup in 6.1.1 patches (diff)
downloadgentoo-b586bf0bd34aa9bb5ad469b650e237ba43615ffb.tar.gz
gentoo-b586bf0bd34aa9bb5ad469b650e237ba43615ffb.tar.bz2
gentoo-b586bf0bd34aa9bb5ad469b650e237ba43615ffb.zip
dev-util/hip: fix compilation with musl
Upstream pull-requests: * https://github.com/ROCm/clr/pull/83 * https://github.com/ROCm/hip-tests/pull/463 Signed-off-by: Sv. Lockal <lockalsash@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-util/hip')
-rw-r--r--dev-util/hip/files/hip-6.1.1-fix-musl.patch24
-rw-r--r--dev-util/hip/files/hip-test-6.1.1-fix-musl.patch159
-rw-r--r--dev-util/hip/hip-6.1.1.ebuild2
3 files changed, 185 insertions, 0 deletions
diff --git a/dev-util/hip/files/hip-6.1.1-fix-musl.patch b/dev-util/hip/files/hip-6.1.1-fix-musl.patch
new file mode 100644
index 000000000000..424cd0dde119
--- /dev/null
+++ b/dev-util/hip/files/hip-6.1.1-fix-musl.patch
@@ -0,0 +1,24 @@
+Fix "basename" and "__cpu_mask" definitions for musl
+
+Upstream PR: https://github.com/ROCm/clr/pull/83
+--- a/rocclr/os/os.hpp
++++ b/rocclr/os/os.hpp
+@@ -29,6 +29,7 @@
+
+ #if defined(__linux__)
+ #include <sched.h>
++#include <libgen.h>
+ #endif
+
+ #ifdef _WIN32
+@@ -377,6 +378,10 @@ ALWAYSINLINE address Os::currentStackPtr() {
+
+ #if defined(__linux__)
+
++#ifndef __GLIBC__
++typedef unsigned long int __cpu_mask;
++#endif
++
+ inline void Os::ThreadAffinityMask::init() { CPU_ZERO(&mask_); }
+
+ inline void Os::ThreadAffinityMask::set(uint cpu) { CPU_SET(cpu, &mask_); }
diff --git a/dev-util/hip/files/hip-test-6.1.1-fix-musl.patch b/dev-util/hip/files/hip-test-6.1.1-fix-musl.patch
new file mode 100644
index 000000000000..c3f3e45efe4d
--- /dev/null
+++ b/dev-util/hip/files/hip-test-6.1.1-fix-musl.patch
@@ -0,0 +1,159 @@
+Fix musl errors:
+* reinterpret_cast from 'std::nullptr_t' to 'void **' is not allowed
+* error.h is GNU extension
+
+Upstream PR: https://github.com/ROCm/hip-tests/pull/463
+--- a/unit/rtc/headers/printf_common.h
++++ b/unit/rtc/headers/printf_common.h
+@@ -30,7 +30,6 @@ THE SOFTWARE.
+ #if defined(_WIN32)
+ #include <io.h>
+ #else
+-#include <error.h>
+ #include <unistd.h>
+ #endif
+
+@@ -110,7 +109,7 @@ struct CaptureStream {
+ saved_fd = dup(orig_fd);
+
+ if ((temp_fd = mkstemp(tempname)) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -118,11 +117,11 @@ struct CaptureStream {
+ void Begin() {
+ fflush(nullptr);
+ if (dup2(temp_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(temp_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -130,11 +129,11 @@ struct CaptureStream {
+ void End() {
+ fflush(nullptr);
+ if (dup2(saved_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(saved_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -148,7 +147,7 @@ struct CaptureStream {
+
+ ~CaptureStream() {
+ if (remove(tempname) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+--- a/unit/memory/hipMemRangeGetAttributes_old.cc
++++ b/unit/memory/hipMemRangeGetAttributes_old.cc
+@@ -268,7 +268,7 @@ TEST_CASE("Unit_hipMemRangeGetAttributes_NegativeTst") {
+ // Passing NULL as first parameter
+ SECTION("Passing NULL as first parameter") {
+ if (!CheckError(hipMemRangeGetAttributes(
+- reinterpret_cast<void**>(NULL),
++ static_cast<void**>(NULL),
+ reinterpret_cast<size_t*>(dataSizes),
+ AttrArr, 4, Hmm, MEM_SIZE),
+ __LINE__)) {
+--- a/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor_old.cc
++++ b/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor_old.cc
+@@ -40,7 +40,7 @@ TEST_CASE("Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Negative") {
+ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(NULL, f1, blockSize, 0);
+ REQUIRE(ret != hipSuccess);
+
+- ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, NULL, blockSize, 0);
++ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, static_cast<void*>(NULL), blockSize, 0);
+ REQUIRE(ret != hipSuccess);
+
+ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, f1, 0, 0);
+--- a/unit/occupancy/hipOccupancyMaxPotentialBlockSize_old.cc
++++ b/unit/occupancy/hipOccupancyMaxPotentialBlockSize_old.cc
+@@ -37,7 +37,7 @@ TEST_CASE("Unit_hipOccupancyMaxPotentialBlockSize_Negative") {
+
+ #ifndef __HIP_PLATFORM_NVIDIA__
+ // nvcc doesnt support kernelfunc(NULL) for api
+- ret = hipOccupancyMaxPotentialBlockSize(&gridSize, &blockSize, NULL, 0, 0);
++ ret = hipOccupancyMaxPotentialBlockSize(&gridSize, &blockSize, static_cast<void*>(NULL), 0, 0);
+ REQUIRE(ret != hipSuccess);
+ #endif
+ }
+--- a/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor.cc
++++ b/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor.cc
+@@ -48,7 +48,7 @@ TEST_CASE("Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Negative_Parameters
+ blockSize);
+
+ SECTION("Kernel function is NULL") {
+- HIP_CHECK_ERROR(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, NULL, blockSize, 0),
++ HIP_CHECK_ERROR(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, static_cast<void*>(NULL), blockSize, 0),
+ hipErrorInvalidDeviceFunction);
+ }
+ }
+--- a/unit/kernel/printf_common.h
++++ b/unit/kernel/printf_common.h
+@@ -24,7 +24,6 @@ THE SOFTWARE.
+ #define _STRESSTEST_PRINTF_COMMON_H_
+
+ #include <errno.h>
+-#include <error.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -47,17 +46,17 @@ struct CaptureStream {
+ saved_fd = dup(orig_fd);
+
+ if ((temp_fd = mkstemp(tempname)) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+
+ fflush(nullptr);
+ if (dup2(temp_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(temp_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -67,11 +66,11 @@ struct CaptureStream {
+ return;
+ fflush(nullptr);
+ if (dup2(saved_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(saved_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ saved_fd = -1;
+@@ -90,7 +89,7 @@ struct CaptureStream {
+ ~CaptureStream() {
+ restoreStream();
+ if (remove(tempname) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
diff --git a/dev-util/hip/hip-6.1.1.ebuild b/dev-util/hip/hip-6.1.1.ebuild
index 94a16644a6bb..ecdf174fed4b 100644
--- a/dev-util/hip/hip-6.1.1.ebuild
+++ b/dev-util/hip/hip-6.1.1.ebuild
@@ -49,6 +49,7 @@ PATCHES=(
"${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch"
"${FILESDIR}/${PN}-6.1.0-install.patch"
"${FILESDIR}/${PN}-6.1.0-extend-isa-compatibility-check.patch"
+ "${FILESDIR}/${PN}-6.1.1-fix-musl.patch"
)
hip_test_wrapper() {
@@ -79,6 +80,7 @@ src_prepare() {
"${FILESDIR}"/hip-test-6.0.2-hipcc-system-install.patch
"${FILESDIR}"/hip-test-5.7.1-remove-incompatible-flag.patch
"${FILESDIR}"/hip-test-6.1.0-disable-hipKerArgOptimization.patch
+ "${FILESDIR}"/hip-test-6.1.1-fix-musl.patch
)
hip_test_wrapper cmake_src_prepare
}