[PATCH] D142317: [Support] Avoid using main thread for llvm::parallelFor().

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 05:39:27 PST 2023


avl added a comment.

In D142317#4076553 <https://reviews.llvm.org/D142317#4076553>, @andrewng wrote:

> I think you need to be a bit careful with terminology because IIUC it's not actually "thread-safe" but a "per thread" allocator. I think this could be useful in some situations but perhaps a better overall approach would be to use a low-level thread aware memory allocator. I think some toolchains/runtimes already have such an allocator and there are other options such as `rpmalloc` and `mimalloc`. This way, the benefit is more widespread and doesn't require any extra effort (although some allocator libraries have some limitations on certain platforms).

Other than limitations on certain platforms, AFAICT, these libraries do not have a notion of memory pools - allocating data in "one big chunk"(To avoid memory fragmentation and to have a possibility to free resources fast). Thus if someone need a thread aware memory pool using `rpmalloc` and `mimalloc` would be not enough.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142317/new/

https://reviews.llvm.org/D142317



More information about the llvm-commits mailing list