[llvm] [libsycl] USM Aligned allocation functions (PR #213468)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 10:56:15 PDT 2026


================
@@ -31,18 +32,34 @@ void *malloc_device(std::size_t numBytes, const queue &syclQueue,
                        syclQueue.get_context(), propList);
 }
 
+void *aligned_alloc_device(size_t alignment, size_t numBytes,
+                           const device &syclDevice, const context &syclContext,
+                           const property_list &propList) {
+  return aligned_alloc(alignment, numBytes, syclDevice, syclContext,
+                       usm::alloc::device, propList);
+}
+
+void *aligned_alloc_device(size_t alignment, size_t numBytes,
+                           const queue &syclQueue,
+                           const property_list &propList) {
+  return aligned_alloc_device(alignment, numBytes, syclQueue.get_device(),
+                              syclQueue.get_context(), propList);
+}
+
 // SYCL 2020 4.8.3.3. Host allocation functions.
 
 void *malloc_host(std::size_t numBytes, const context &syclContext,
----------------
Robertkq wrote:

All of the overloads end up calling `aligned_alloc` at the end of call chain, but I specify alignment as non zero, hope that I understood alignment specifications correctly, from section `3.8.3. USM allocations`



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


More information about the llvm-commits mailing list