[libc-commits] [libc] [libc] Efficiently implement `aligned_alloc` for AMDGPU (PR #146585)

Matt Arsenault via libc-commits libc-commits at lists.llvm.org
Tue Jul 1 18:59:44 PDT 2025


================
@@ -572,5 +577,28 @@ void *reallocate(void *ptr, uint64_t size) {
   return new_ptr;
 }
 
+void *aligned_allocate(uint64_t alignment, uint64_t size) {
+  // All alignment values must be a non-zero power of two.
+  if (!impl::is_pow2(alignment))
+    return nullptr;
----------------
arsenm wrote:

Should use size_t, and the implementation should just use uint32 for the align value. We don't support ultra-alignment? 

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


More information about the libc-commits mailing list