Skip to content

[SYCL][NFC] Mark external libc functions. #19368

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

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions sycl/include/sycl/builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
#ifdef __SYCL_DEVICE_ONLY__
extern "C" {

extern __DPCPP_SYCL_EXTERNAL void *memcpy(void *dest, const void *src,
size_t n);
extern __DPCPP_SYCL_EXTERNAL void *memset(void *dest, int c, size_t n);
extern __DPCPP_SYCL_EXTERNAL int memcmp(const void *s1, const void *s2,
size_t n);
extern __DPCPP_SYCL_EXTERNAL int rand();
extern __DPCPP_SYCL_EXTERNAL void srand(unsigned int seed);
extern __DPCPP_SYCL_EXTERNAL_LIBC void *memcpy(void *dest, const void *src,
size_t n);
extern __DPCPP_SYCL_EXTERNAL_LIBC void *memset(void *dest, int c, size_t n);
extern __DPCPP_SYCL_EXTERNAL_LIBC int memcmp(const void *s1, const void *s2,
size_t n);
extern __DPCPP_SYCL_EXTERNAL_LIBC int rand();
extern __DPCPP_SYCL_EXTERNAL_LIBC void srand(unsigned int seed);
extern __DPCPP_SYCL_EXTERNAL long long int __imf_llmax(long long int x,
long long int y);
extern __DPCPP_SYCL_EXTERNAL long long int __imf_llmin(long long int x,
Expand Down Expand Up @@ -634,15 +634,15 @@ extern __DPCPP_SYCL_EXTERNAL int __imf_vimin_s32_relu(int x, int y);
}
#ifdef __GLIBC__
namespace std {
extern __DPCPP_SYCL_EXTERNAL void
extern __DPCPP_SYCL_EXTERNAL_LIBC void
__glibcxx_assert_fail(const char *file, int line, const char *func,
const char *cond) noexcept;
} // namespace std
extern "C" {
extern __DPCPP_SYCL_EXTERNAL void __assert_fail(const char *expr,
const char *file,
unsigned int line,
const char *func);
extern __DPCPP_SYCL_EXTERNAL_LIBC void __assert_fail(const char *expr,
const char *file,
unsigned int line,
const char *func);
}
#elif defined(_WIN32)
extern "C" {
Expand All @@ -652,8 +652,8 @@ extern "C" {
// APIs used by STL, such as _Cosh, are undocumented, even though
// they are open-sourced. Recognizing them as builtins is not
// straightforward currently.
extern __DPCPP_SYCL_EXTERNAL void _wassert(const wchar_t *wexpr,
const wchar_t *wfile, unsigned line);
extern __DPCPP_SYCL_EXTERNAL_LIBC void
_wassert(const wchar_t *wexpr, const wchar_t *wfile, unsigned line);
}
#endif
#endif // __SYCL_DEVICE_ONLY__
4 changes: 4 additions & 0 deletions sycl/include/sycl/detail/defines_elementary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#endif
#endif

#ifndef __DPCPP_SYCL_EXTERNAL_LIBC
#define __DPCPP_SYCL_EXTERNAL_LIBC __DPCPP_SYCL_EXTERNAL
#endif

// Helper for enabling empty-base optimizations on MSVC.
// TODO: Remove this when MSVC has this optimization enabled by default.
#ifdef _MSC_VER
Expand Down
Loading