Enable mimalloc on non-Windows platforms and make default for AArch64 builds (#164741)

This change removes the Windows requirement for mimalloc builds, and makes mimalloc the default c10 system allocator for AArch64 builds. This significantly improves the performance of AArch64 builds of PyTorch as large allocations are better cached by mimalloc than glibc.

**Updated Results**

Torchbench FP32 eager Inference, 16 threads:
<img width="1510" height="733" alt="mimalloc-v2-fp32-diff" src="https://github.com/user-attachments/assets/7fe3ea0c-3b52-42e7-879b-612444479c90" />

Torchbench BF16 eager Inference, 16 threads:
<img width="1510" height="733" alt="mimalloc-v2-bf16-diff" src="https://github.com/user-attachments/assets/56469a72-9e06-4d57-ae2a-aeb139ca79a3" />

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164741
Approved by: https://github.com/fadara01, https://github.com/aditew01, https://github.com/malfet
This commit is contained in:
Murray Steele
2025-10-09 20:49:46 +00:00
committed by PyTorch MergeBot
parent 9944cac6e6
commit 0fd976b65c
3 changed files with 11 additions and 10 deletions

View File

@ -225,7 +225,7 @@
#
# USE_MIMALLOC
# Static link mimalloc into C10, and use mimalloc in alloc_cpu & alloc_free.
# By default, It is only enabled on Windows.
# By default, It is only enabled on Windows and AArch64.
#
# BUILD_LIBTORCH_WHL
# Builds libtorch.so and its dependencies as a wheel