Skip to content

[SYCL] Add logics for aligned_alloc_xxx<T> to deal with unsupported Alignment argument #12569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 8, 2024

Conversation

HPS-1
Copy link
Contributor

@HPS-1 HPS-1 commented Jan 31, 2024

Added logics for aligned_alloc_xxx<T> to return nullptr when the Alignment argument is not a power of 2. Also updated and added a new test file align.cpp used to test such cases (where Alignment is not 2's power). The fixed methods, all in sycl/include/sycl/usm.hpp, are:
aligned_alloc_device<T>
aligned_alloc_shared<T>
aligned_alloc_host<T>
aligned_alloc<T>

*Note that each of these methods has two slighly different versions with different parameter lists.

**Also note that Alignment=0 is considered as a valid "default" case in our implementation so it will not cause nullptr to be returned. (Code here:

if (!Alignment) {
) (Also if we let these methods return nullptr when Alignment=0, test SYCL :: Annotated_usm/annotated_usm_kind.cpp will fail.)

Link to the issue: #11642

… Alignment argument is not a power of 2

Signed-off-by: Hu, Peisen <[email protected]>
@HPS-1 HPS-1 requested a review from a team as a code owner January 31, 2024 23:02
@HPS-1 HPS-1 requested a review from bso-intel January 31, 2024 23:02
Copy link
Contributor

github-actions bot commented Feb 1, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Signed-off-by: Hu, Peisen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants