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 0000000000000..cc51722801a3d --- /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 c519b4a5931c9..1974781f66806 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