Skip to content
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

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

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 <peisen.hu@intel.com>
Signed-off-by: Hu, Peisen <peisen.hu@intel.com>
sycl/include/sycl/usm.hpp Outdated Show resolved Hide resolved
sycl/include/sycl/usm.hpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
Signed-off-by: Hu, Peisen <peisen.hu@intel.com>
Copy link
Contributor

github-actions bot commented Feb 1, 2024

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

….cpp

Signed-off-by: Hu, Peisen <peisen.hu@intel.com>
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/USM/align.cpp Show resolved Hide resolved
Signed-off-by: Hu, Peisen <peisen.hu@intel.com>
@AlexeySachkov AlexeySachkov merged commit 4c8569c into intel:sycl Feb 8, 2024
12 checks passed
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