Skip to content

Conversation

@jeffhammond
Copy link
Contributor

@jeffhammond jeffhammond commented Oct 17, 2020

Older glibc lacks aligned_alloc (C11 and C++17).
Dropping through to the POSIX option (posix_memalign) is necessary
on such systems.

The lazy way to detect if aligned_alloc is supported is:

defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) || defined(_LIBCPP_HAS_C11_FEATURES)

This does not work for C++ libraries besides GCC and LLVM (e.g. MUSL)
but unless those are explicitly supported and tested, we should not
need to include them here anyways.

The inclusion of stdlib.h was changed to cstdlib, as appropriate for C++
code. The conditional inclusion of cstdlib in the cpp file was removed
since it was included unconditionally in the header.

Signed-off-by: Jeff Hammond [email protected]

@jeffhammond jeffhammond requested a review from a team as a code owner October 17, 2020 16:42
@jeffhammond jeffhammond requested a review from rbegam October 17, 2020 16:42
@jeffhammond jeffhammond changed the title do not assume Linux always has aligned_alloc [SYCL][RT] do not assume Linux always has aligned_alloc Oct 17, 2020
Older glibc lacks aligned_alloc (C11 and C++17).
Dropping through to the POSIX option (posix_memalign) is necessary
on such systems.

The lazy way to detect if aligned_alloc is supported is:
defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) || defined(_LIBCPP_HAS_C11_FEATURES)

This does not work for C++ libraries besides GCC and LLVM (e.g. MUSL)
but unless those are explicitly supported and tested, we should not
need to include them here anyways.

The inclusion of stdlib.h was changed to cstdlib, as appropriate for C++
code.  The conditional inclusion of cstdlib in the cpp file was removed
since it was included unconditionally in the header.

Signed-off-by: Jeff Hammond <[email protected]>
@romanovvlad romanovvlad merged commit 6c7b39d into intel:sycl Oct 20, 2020
@jeffhammond jeffhammond deleted the no_aligned_malloc branch October 31, 2020 20:27
iclsrc pushed a commit that referenced this pull request Aug 15, 2024
Update a test after llvm-project commit 92a0654
("[LowerMemIntrinsics] Lower llvm.memmove to wide memory accesses
(#100122)", 2024-07-26).

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@84f525abd741c30
kbenzie added a commit to kbenzie/intel-llvm that referenced this pull request Feb 17, 2025
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
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.

3 participants