Skip to content

[SYCL][RT] do not assume Linux always has aligned_alloc #2655

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 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/os_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <CL/sycl/detail/export.hpp>

#include <cstdint>
#include <stdlib.h>
#include <cstdlib>
#include <string>

#ifdef _WIN32
Expand Down
7 changes: 2 additions & 5 deletions sycl/source/detail/os_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

#include <cassert>

#ifdef SYCL_RT_OS_POSIX_SUPPORT
#include <cstdlib>
#endif

#if defined(SYCL_RT_OS_LINUX)

#ifndef _GNU_SOURCE
Expand Down Expand Up @@ -242,7 +238,8 @@ size_t OSUtil::getOSMemSize() {
}

void *OSUtil::alignedAlloc(size_t Alignment, size_t NumBytes) {
#if defined(SYCL_RT_OS_LINUX)
#if defined(SYCL_RT_OS_LINUX) && (defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) || \
defined(_LIBCPP_HAS_C11_FEATURES))
return aligned_alloc(Alignment, NumBytes);
#elif defined(SYCL_RT_OS_POSIX_SUPPORT)
void *Addr = nullptr;
Expand Down