repo/gentoo:master commit in: sci-ml/pytorch/files/, sci-ml/pytorch/

"Alfredo Tupone" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786703363.6820ec6b79fd95286711b86929008aa712dfde61.tupone@gentoo>
commit:     6820ec6b79fd95286711b86929008aa712dfde61
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 14 10:28:44 2026 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Fri Aug 14 10:29:23 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6820ec6b

sci-ml/pytorch: apply mimalloc patch from caffe2

Closes: https://bugs.gentoo.org/980675
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-ml/pytorch/files/pytorch-2.13.0-mimalloc.patch | 24 ++++++++++++++++++++++
 sci-ml/pytorch/pytorch-2.13.0-r3.ebuild            |  1 +
 2 files changed, 25 insertions(+)

diff --git a/sci-ml/pytorch/files/pytorch-2.13.0-mimalloc.patch b/sci-ml/pytorch/files/pytorch-2.13.0-mimalloc.patch
new file mode 100644
index 000000000000..cc51722801a3
--- /dev/null
+++ b/sci-ml/pytorch/files/pytorch-2.13.0-mimalloc.patch
@@ -0,0 +1,24 @@
+--- a/c10/CMakeLists.txt	2026-02-01 09:22:55.398151644 +0100
++++ b/c10/CMakeLists.txt	2026-02-01 09:30:46.720495230 +0100
+@@ -120,8 +120,9 @@
+   endif()
+ 
+   if(USE_MIMALLOC)
+-    target_link_libraries(c10 PRIVATE "mimalloc-static")
+-    add_dependencies(c10 mimalloc-static)
++    find_package(mimalloc REQUIRED)
++    target_link_libraries(c10 PRIVATE "mimalloc")
++    add_dependencies(c10 mimalloc)
+   endif()
+ 
+   if(LINUX)
+--- a/CMakeLists.txt	2026-02-03 16:47:46.949580063 +0100
++++ b/CMakeLists.txt	2026-02-03 16:48:57.348716061 +0100
+@@ -404,7 +404,6 @@
+ # on Windows and AArch64.
+ option(USE_MIMALLOC_ON_MKL "Use mimalloc on MKL" OFF)
+ if(WIN32 OR (CPU_AARCH64 AND NOT APPLE))
+-  set(USE_MIMALLOC ON)
+   # Disable OPT flags for mimalloc on aarch64 as it breaks ARMv8.0
+   # Not enable USE_MIMALLOC_ON_MKL due to it caused issue:
+   # See https://github.com/pytorch/pytorch/issues/174344

diff --git a/sci-ml/pytorch/pytorch-2.13.0-r3.ebuild b/sci-ml/pytorch/pytorch-2.13.0-r3.ebuild
index c519b4a5931c..1974781f6680 100644
--- a/sci-ml/pytorch/pytorch-2.13.0-r3.ebuild
+++ b/sci-ml/pytorch/pytorch-2.13.0-r3.ebuild
@@ -163,6 +163,7 @@ BDEPEND="dev-build/cmake"
 PATCHES=(
 	"${FILESDIR}"/${P}-aotriton-fixes.patch
 	"${FILESDIR}"/${P}-glog.patch
+	"${FILESDIR}"/${P}-mimalloc.patch
 	"${FILESDIR}"/${P}-removekineto-pr178960.patch
 	"${FILESDIR}"/${P}-rocm-assert-fix.patch
 	"${FILESDIR}"/${P}-unbundle_fbgemm.patch
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.