[llvm] [offload] add handling of memory alignment to MemoryManagerTy (PR #218418)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 01:27:20 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) {
----------------
EuphoricThinking wrote:
Do you mean that we should go back to `Size < SizeThreshold`? I think that this is a problem when an alignment is requested, but the example you have provided seems not to include an alignment (I might have overlooked something)
https://github.com/llvm/llvm-project/pull/218418
More information about the llvm-commits
mailing list