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

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 01:30:25 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;
+
+    ODBG(OLDT_Alloc) << "MemoryManagerTy::allocate: requested memory " << Size
+                     << ", allocated:  " << AllocationSize
                      << " with host pointer " << HstPtr << ".";
 
     // If the size is greater than the threshold, allocate it directly from
     // device.
-    if (Size > SizeThreshold) {
-      ODBG(OLDT_Alloc) << Size << " is greater than the threshold "
+    if (AllocationSize > SizeThreshold) {
----------------
blazej-smorawski wrote:

Oh sorry, I commented on a wrong line, the problem is change in `ODBG` log which is then used in the test.

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


More information about the llvm-commits mailing list