[libc-commits] [libc] [libc] Cache old slabs when allocating GPU memory (PR #151866)

Jon Chesterfield via libc-commits libc-commits at lists.llvm.org
Sun Aug 3 07:19:30 PDT 2025


================
@@ -39,6 +40,9 @@ constexpr static uint32_t MIN_ALIGNMENT = MIN_SIZE - 1;
 // The number of times to attempt claiming an in-progress slab allocation.
 constexpr static uint32_t MAX_TRIES = 1024;
 
+// The number of previously allocated slabs we will keep in memory.
+constexpr static uint32_t CACHED_SLABS = 32;
----------------
JonChesterfield wrote:

32 seems high, 1 should be enough to avoid the splitting behaviour. Perhaps it should scale with something architecture dependent? CU count or something else what approximates size of device.

https://github.com/llvm/llvm-project/pull/151866


More information about the libc-commits mailing list