You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Small patch on annotated USM allocation (#11801)
This PR is a small change on the implementation of
`aligned_alloc_annotated<T>`, which is a variant of the SYCL annotated
USM allocation:
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/proposed/sycl_ext_oneapi_usm_malloc_properties.asciidoc
Right now `aligned_alloc_annotated<T>` is implemented by calling
`sycl::aligned_alloc` (allocation in bytes) with a specified alignment
(which is a combination (i.e. least common multiple) of the compile-time
`alignment<K>` property and the runtime argument), and then cast the
returned pointer type from `void *` to `T*`
This does not cover the case where T has a extended alignment as follows
```
struct alignas(256) MyStruct {
int x;
};
```
in this case, both the combined alignment and `alignof(T)` should be
considered, and the greater value of the two should be the final
alignment passed to the SYCL runtime. Therefore, this PR changes the
impl by directly calling the SYCL core usm API: `aligned_alloc<T>`.
Some e2e tests are updated with this header change: when `alignof(T)` is
large enough, the `aligned_alloc_annotated<T>` is no longer expected to
return null when the specified alignment is not a power of 2, because
`alignof(T)` (always a power of 2) is the final alignment passed to the
SYCL runtime. Therefore, we bump up the specified alignments in these
cases to make sure they are always larger the `alignof(T)`
0 commit comments