summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2024-01-20 15:25:20 +0000
committerSam James <sam@gentoo.org>2024-03-08 19:22:05 +0000
commitd49991905031dbe78494f500730da8a43cd2763c (patch)
treee2ad3bb30740051537129cb45ac1b8c97680235d /dev-util/hip
parentdev-util/hip: add rocm_version.h header (required by some caffe2/fbgemm/rocpr... (diff)
downloadgentoo-d49991905031dbe78494f500730da8a43cd2763c.tar.gz
gentoo-d49991905031dbe78494f500730da8a43cd2763c.tar.bz2
gentoo-d49991905031dbe78494f500730da8a43cd2763c.zip
dev-util/hip: add backported fix for OOM check
Fixes failure of oidnTest from media-libs/oidn with HIP from https://github.com/gentoo/gentoo/pull/34869 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-5.7.1-fix-mmap-oom-check.patch41
-rw-r--r--dev-util/hip/hip-5.7.1-r2.ebuild1
2 files changed, 42 insertions, 0 deletions
diff --git a/dev-util/hip/files/hip-5.7.1-fix-mmap-oom-check.patch b/dev-util/hip/files/hip-5.7.1-fix-mmap-oom-check.patch
new file mode 100644
index 000000000000..dbafe4e11a74
--- /dev/null
+++ b/dev-util/hip/files/hip-5.7.1-fix-mmap-oom-check.patch
@@ -0,0 +1,41 @@
+Backport of SWDEV-417691 - Error handling for MemoryMap OS calls.
+The issue was fixed in rocclr 6.0.0.
+https://github.com/ROCm/clr/commit/7a10423a44b8b353f67539dc1ae14c0b99c209b8
+--- a/rocclr/os/os_posix.cpp
++++ b/rocclr/os/os_posix.cpp
+@@ -214,7 +214,7 @@ address Os::reserveMemory(address start, size_t size, size_t alignment, MemProt
+ MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, 0, 0);
+
+ // check for out of memory
+- if (mem == NULL) return NULL;
++ if (mem == MAP_FAILED) return NULL;
+
+ address aligned = alignUp(mem, alignment);
+
+@@ -842,7 +842,7 @@ bool Os::MemoryMapFileDesc(FileDesc fdesc, size_t fsize, size_t foffset, const v
+ }
+
+ *mmap_ptr = mmap(NULL, fsize, PROT_READ, MAP_SHARED, fdesc, foffset);
+- return true;
++ return (*mmap_ptr == MAP_FAILED) ? false : true;
+ }
+
+ bool Os::MemoryUnmapFile(const void* mmap_ptr, size_t mmap_size) {
+@@ -874,7 +874,7 @@ bool Os::MemoryMapFile(const char* fname, const void** mmap_ptr, size_t* mmap_si
+
+ close(fd);
+
+- if (*mmap_ptr == nullptr) {
++ if (*mmap_ptr == MAP_FAILED) {
+ return false;
+ }
+
+@@ -899,7 +899,7 @@ bool Os::MemoryMapFileTruncated(const char* fname, const void** mmap_ptr, size_t
+
+ close(fd);
+
+- if (*mmap_ptr == nullptr) {
++ if (*mmap_ptr == MAP_FAILED) {
+ return false;
+ }
+ \ No newline at end of file
diff --git a/dev-util/hip/hip-5.7.1-r2.ebuild b/dev-util/hip/hip-5.7.1-r2.ebuild
index f91ef2a7083c..034378272f53 100644
--- a/dev-util/hip/hip-5.7.1-r2.ebuild
+++ b/dev-util/hip/hip-5.7.1-r2.ebuild
@@ -47,6 +47,7 @@ PATCHES=(
"${FILESDIR}/${PN}-5.7.1-disable-stack-protector.patch"
"${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch"
"${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch"
+ "${FILESDIR}/${PN}-5.7.1-fix-mmap-oom-check.patch"
)
S="${WORKDIR}/clr-rocm-${PV}/"