[llvm] [libsycl] USM Aligned allocation functions (PR #213468)
Kseniya Tikhomirova via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 07:05:09 PDT 2026
================
@@ -103,14 +154,29 @@ void *malloc(std::size_t numBytes, const device &syclDevice,
void *Ptr{};
auto OLDevice = detail::getSyclObjImpl(syclDevice)->getOLHandle();
- auto Result =
- kind == usm::alloc::host
- ? detail::callNoCheck(olMemAllocHost, OLDevice, numBytes, &Ptr)
- : detail::callNoCheck(olMemAlloc, OLDevice,
- detail::getOlAllocType(kind), numBytes, &Ptr);
+ auto Result = kind == usm::alloc::host
+ ? detail::callNoCheck(olMemAllocAlignedHost, OLDevice,
----------------
KseniyaTikhomirova wrote:
I think that my previous comments about alignment may confuse you. Let me clarify.
Alignment == 0 seems to be a valid alignment (or the absence of alignment) in terms of SYCL API. Unfortunately, liboffload has 2 different functions (4 with host allocations) for allocation with alignment and without.
So I expect that we won't send exception of alignment == 0 as you did before but we will route allocation request to the right liboffload API depending on this condition. And then liboffload API for the aligned allocations will check alignment validness (the power of 2).
https://github.com/llvm/llvm-project/pull/213468
More information about the llvm-commits
mailing list