[all-commits] [llvm/llvm-project] 5dc993: [libc] Improve starting indices for GPU allocation...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Jul 28 05:55:10 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5dc9937ea910f807d3e7325669053c5740545875
      https://github.com/llvm/llvm-project/commit/5dc9937ea910f807d3e7325669053c5740545875
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2025-07-28 (Mon, 28 Jul 2025)

  Changed paths:
    M libc/src/__support/GPU/allocator.cpp

  Log Message:
  -----------
  [libc] Improve starting indices for GPU allocation (#150432)

Summary:
The slots in this allocation scheme are statically allocated. All sizes
share the same array of slots, but are given different starting
locations to space them apart. The previous implementation used a
trivial linear slice. This is inefficient because it provides the more
likely allocations (1-1024 bytes) with just as much space as a highly
unlikely one (1 MiB).

This patch uses a cubic easing function to gradually shrink the gaps.
For example, we used to get around 700 free slots for a 16 byte
allocation, now we get around 2100 before it starts encroaching on the
32 byte allocation space. This could be improved further, but I think
this is sufficient.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list