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

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 06:53:08 PDT 2026


================
@@ -117,6 +174,45 @@ void *malloc(std::size_t numBytes, const queue &syclQueue, usm::alloc kind,
                 propList);
 }
 
+void *aligned_alloc(std::size_t alignment, std::size_t numBytes,
+                    const device &syclDevice, const context &syclContext,
+                    usm::alloc kind, const property_list &propList) {
+  if (alignment == 0 || !detail::isPowerOf2(alignment))
+    throw exception(make_error_code(errc::invalid),
+                    "Alignment must be a non-zero power of two");
+
+  auto ContextDevices = syclContext.get_devices();
+  assert(!ContextDevices.empty() && "Context can't be created without device");
----------------
KseniyaTikhomirova wrote:

I don't think this assert make sense, that will be broken if this expectation is incorrect? next line uses safe container lookup that will trigger failure

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


More information about the llvm-commits mailing list