[llvm] [offload] add handling of memory alignment to MemoryManagerTy (PR #218418)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 01:31:57 PDT 2026


================
@@ -248,72 +260,102 @@ class MemoryManagerTy {
     if (Size == 0)
       return nullptr;
 
-    ODBG(OLDT_Alloc) << "MemoryManagerTy::allocate: size " << Size
+    size_t AllocationSize = Alignment > 0 ? (Size + Alignment - 1) : Size;
----------------
EuphoricThinking wrote:

The user might have requested an unreasonable amount of memory, but within the limits of `size_t`. I think it's a valid point that after adding a padding we might encounter a problem which has not been caused by the user, but by the implementation.

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


More information about the llvm-commits mailing list