[libc-commits] [libc] [libc] Efficiently implement 'realloc' for AMDGPU devices (PR #145960)

Matt Arsenault via libc-commits libc-commits at lists.llvm.org
Fri Jun 27 18:43:23 PDT 2025


================
@@ -550,5 +551,26 @@ void deallocate(void *ptr) {
   release_slab(slab);
 }
 
+void *reallocate(void *ptr, uint64_t size) {
+  if (ptr == nullptr)
+    return gpu::allocate(size);
+
+  // Non-slab allocations are considered foreign pointers so we fail.
+  if ((reinterpret_cast<uintptr_t>(ptr) & SLAB_ALIGNMENT) == 0)
----------------
arsenm wrote:

sure, I assume there are other places that should update too 

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


More information about the libc-commits mailing list