Skip to content

Commit 9c39a30

Browse files
[SYCL][USM] Follow-up for #6205 - loosen alignment (#6221)
Addressing #6205 (comment)
1 parent b545c60 commit 9c39a30

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

sycl/include/CL/sycl/usm.hpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,8 @@ T *malloc_device(
157157
size_t Count, const device &Dev, const context &Ctxt,
158158
const property_list &PropList = {},
159159
const detail::code_location CodeLoc = detail::code_location::current()) {
160-
return static_cast<T *>(
161-
aligned_alloc_device(std::max(alignof(T), alignof(std::max_align_t)),
162-
Count * sizeof(T), Dev, Ctxt, PropList, CodeLoc));
160+
return static_cast<T *>(aligned_alloc_device(alignof(T), Count * sizeof(T),
161+
Dev, Ctxt, PropList, CodeLoc));
163162
}
164163

165164
template <typename T>
@@ -193,9 +192,8 @@ template <typename T>
193192
T *malloc_host(
194193
size_t Count, const context &Ctxt, const property_list &PropList = {},
195194
const detail::code_location CodeLoc = detail::code_location::current()) {
196-
return static_cast<T *>(
197-
aligned_alloc_host(std::max(alignof(T), alignof(std::max_align_t)),
198-
Count * sizeof(T), Ctxt, PropList, CodeLoc));
195+
return static_cast<T *>(aligned_alloc_host(alignof(T), Count * sizeof(T),
196+
Ctxt, PropList, CodeLoc));
199197
}
200198

201199
template <typename T>
@@ -210,9 +208,8 @@ T *malloc_shared(
210208
size_t Count, const device &Dev, const context &Ctxt,
211209
const property_list &PropList = {},
212210
const detail::code_location CodeLoc = detail::code_location::current()) {
213-
return static_cast<T *>(
214-
aligned_alloc_shared(std::max(alignof(T), alignof(std::max_align_t)),
215-
Count * sizeof(T), Dev, Ctxt, PropList, CodeLoc));
211+
return static_cast<T *>(aligned_alloc_shared(alignof(T), Count * sizeof(T),
212+
Dev, Ctxt, PropList, CodeLoc));
216213
}
217214

218215
template <typename T>
@@ -266,9 +263,8 @@ T *malloc(
266263
size_t Count, const device &Dev, const context &Ctxt, usm::alloc Kind,
267264
const property_list &PropList = {},
268265
const detail::code_location CodeLoc = detail::code_location::current()) {
269-
return static_cast<T *>(
270-
aligned_alloc(std::max(alignof(T), alignof(std::max_align_t)),
271-
Count * sizeof(T), Dev, Ctxt, Kind, PropList, CodeLoc));
266+
return static_cast<T *>(aligned_alloc(alignof(T), Count * sizeof(T), Dev,
267+
Ctxt, Kind, PropList, CodeLoc));
272268
}
273269

274270
template <typename T>

0 commit comments

Comments
 (0)