Skip to content

Commit dd7daf7

Browse files
committed
Update aligned_alloc_annotated with T
1 parent aa0171d commit dd7daf7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sycl/include/sycl/ext/oneapi/experimental/annotated_usm/alloc_base.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ aligned_alloc_annotated(size_t alignment, size_t count,
108108
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
109109
"Unknown USM allocation kind was specified.");
110110

111-
void *rawPtr = sycl::aligned_alloc(
112-
combine_align(alignment, alignFromPropList), count * sizeof(T),
113-
syclDevice, syclContext, kind, usmPropList);
111+
size_t combinedAlign = combine_align(alignment, alignFromPropList);
112+
void *rawPtr =
113+
sycl::aligned_alloc(std::max(sizeof(T), combinedAlign), count * sizeof(T),
114+
syclDevice, syclContext, kind, usmPropList);
114115
return annotated_ptr<T, propertyListB>(static_cast<T *>(rawPtr));
115116
}
116117

0 commit comments

Comments
 (0)