[llvm] [offload] add handling of memory alignment to MemoryManagerTy (PR #218418)
Jan Trusiłło via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 02:54:56 PDT 2026
================
@@ -615,18 +615,6 @@ struct CUDADeviceTy : public GenericDeviceTy {
if (auto Err = Plugin::check(Res, "error in cuMemAlloc[Host|Managed]: %s"))
return std::move(Err);
- if (Alignment > 0 && !isAddrAligned(Align(Alignment), MemAlloc)) {
----------------
311Volt wrote:
What I have in mind is a check in `GenericDeviceTy::dataAlloc()` in PluginInterface.cpp.
In fact, a comment on line 984 suggests as much:
```cpp
// TODO Check alignment.
```
If the pointer returned by `allocate` is not aligned, free it and return `ErrorCode::UNSUPPORTED`. It's a temporary fix, because now there's a problem that the concerns of "use allocation pooling" and "overallocate for alignment" are coupled together by whether the memory manager is enabled.
But at least the implementation is then compliant - it becomes an implementation quality issue, not a straight-up bug where we claim to have returned an aligned pointer but actually we didn't. It cleanly sets up for a followup patch where we can rethink this
https://github.com/llvm/llvm-project/pull/218418
More information about the llvm-commits
mailing list