Skip to content

[SYCL] Only export public API #1456

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 6 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions sycl/include/CL/__spirv/spirv_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once
#include <CL/__spirv/spirv_types.hpp>
#include <CL/sycl/detail/defines.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/detail/export.hpp>
#include <cstddef>
#include <cstdint>
#include <type_traits>
Expand Down Expand Up @@ -257,17 +257,17 @@ OpGroupAsyncCopyLocalToGlobal(__spv::Scope::Flag Execution, dataT *Dest,
return nullptr;
}

extern SYCL_API void __spirv_ocl_prefetch(const char *Ptr,
size_t NumBytes) noexcept;
extern __SYCL_EXPORT void __spirv_ocl_prefetch(const char *Ptr,
size_t NumBytes) noexcept;

__SYCL_CONVERGENT__ extern SYCL_EXTERNAL SYCL_API void
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL __SYCL_EXPORT void
__spirv_ControlBarrier(__spv::Scope Execution, __spv::Scope Memory,
uint32_t Semantics) noexcept;

__SYCL_CONVERGENT__ extern SYCL_EXTERNAL SYCL_API void
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL __SYCL_EXPORT void
__spirv_MemoryBarrier(__spv::Scope Memory, uint32_t Semantics) noexcept;

__SYCL_CONVERGENT__ extern SYCL_EXTERNAL SYCL_API void
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL __SYCL_EXPORT void
__spirv_GroupWaitEvents(__spv::Scope Execution, uint32_t NumEvents,
__ocl_event_t *WaitEvents) noexcept;

Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#pragma once
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/exception_list.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/info/info_desc.hpp>
#include <CL/sycl/stl.hpp>

Expand All @@ -25,7 +25,7 @@ namespace detail {
class context_impl;
}

class SYCL_API context {
class __SYCL_EXPORT context {
public:
/// Constructs a SYCL context instance using an instance of default_selector.
///
Expand Down
8 changes: 4 additions & 4 deletions sycl/include/CL/sycl/detail/accessor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#pragma once

#include <CL/sycl/access/access.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/sycl_mem_obj_i.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/id.hpp>
#include <CL/sycl/range.hpp>
#include <CL/sycl/stl.hpp>
Expand Down Expand Up @@ -59,7 +59,7 @@ template <int Dims> class LocalAccessorBaseDevice {
}
};

class SYCL_API AccessorImplHost {
class __SYCL_EXPORT AccessorImplHost {
public:
AccessorImplHost(id<3> Offset, range<3> AccessRange, range<3> MemoryRange,
access::mode AccessMode, detail::SYCLMemObjI *SYCLMemObject,
Expand Down Expand Up @@ -129,7 +129,7 @@ class AccessorBaseHost {
AccessorImplPtr impl;
};

class SYCL_API LocalAccessorImplHost {
class __SYCL_EXPORT LocalAccessorImplHost {
public:
LocalAccessorImplHost(sycl::range<3> Size, int Dims, int ElemSize)
: MSize(Size), MDims(Dims), MElemSize(ElemSize),
Expand Down Expand Up @@ -185,7 +185,7 @@ class LocalAccessorBaseHost {

using Requirement = AccessorImplHost;

void SYCL_API addHostAccessorAndWait(Requirement *Req);
void __SYCL_EXPORT addHostAccessorAndWait(Requirement *Req);

} // namespace detail
} // namespace sycl
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/buffer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <CL/sycl/access/access.hpp>
#include <CL/sycl/context.hpp>
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/helpers.hpp>
#include <CL/sycl/detail/sycl_mem_obj_t.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/handler.hpp>
#include <CL/sycl/property_list.hpp>
#include <CL/sycl/stl.hpp>
Expand All @@ -39,7 +39,7 @@ using buffer_allocator = detail::sycl_memory_object_allocator;

namespace detail {

class SYCL_API buffer_impl final : public SYCLMemObjT {
class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
using BaseT = SYCLMemObjT;
using typename BaseT::MemObjType;

Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/cg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

#include <CL/sycl/detail/accessor_impl.hpp>
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/helpers.hpp>
#include <CL/sycl/detail/host_profiling_info.hpp>
#include <CL/sycl/detail/kernel_desc.hpp>
#include <CL/sycl/detail/type_traits.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/group.hpp>
#include <CL/sycl/id.hpp>
#include <CL/sycl/kernel.hpp>
Expand Down Expand Up @@ -56,7 +56,7 @@ class interop_handler {
private:
cl_command_queue MQueue;
std::vector<ReqToMem> MMemObjs;
SYCL_API cl_mem getMemImpl(detail::Requirement *Req) const;
__SYCL_EXPORT cl_mem getMemImpl(detail::Requirement *Req) const;
};

namespace detail {
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

#include <CL/sycl/detail/defines.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/detail/export.hpp>

// Suppress a compiler warning about undefined CL_TARGET_OPENCL_VERSION
// Khronos ICD supports only latest OpenCL version
Expand Down Expand Up @@ -85,7 +85,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

SYCL_API const char *stringifyErrorCode(cl_int error);
__SYCL_EXPORT const char *stringifyErrorCode(cl_int error);

static inline std::string codeToString(cl_int code) {
return std::string(std::to_string(code) + " (" + stringifyErrorCode(code) +
Expand Down
6 changes: 3 additions & 3 deletions sycl/include/CL/sycl/detail/common_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
//===----------------------------------------------------------------------===//

#pragma once
#include <CL/sycl/export.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/stl.hpp>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

vector_class<string_class> SYCL_API split_string(const string_class &str,
char delimeter);
vector_class<string_class> __SYCL_EXPORT split_string(const string_class &str,
char delimeter);

} // namespace detail
} // namespace sycl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,31 @@

#pragma once

#ifndef SYCL_API
#ifndef SYCL_DEVICE_ONLY
#ifndef __SYCL_EXPORT
#ifdef _WIN32

// MSVC discourages export of classes, that use STL class in API. This
// results in a warning, treated as compile error. Silence C4251 to workaround.
#pragma warning(disable : 4251)
#pragma warning(disable : 4275)

#define DLL_LOCAL

#if __SYCL_BUILD_SYCL_DLL
#define SYCL_API __declspec(dllexport)
#define SYCL_API_DEPRECATED(x) __declspec(dllexport, deprecated)
#define __SYCL_EXPORT __declspec(dllexport)
#define __SYCL_EXPORT_DEPRECATED(x) __declspec(dllexport, deprecated)
#else
#define SYCL_API __declspec(dllimport)
#define SYCL_API_DEPRECATED(x) __declspec(dllimport, deprecated)
#define __SYCL_EXPORT __declspec(dllimport)
#define __SYCL_EXPORT_DEPRECATED(x) __declspec(dllimport, deprecated)
#endif
#else
#define SYCL_API __attribute__((visibility("default")))
#define SYCL_API_DEPRECATED(x) \

#define DLL_LOCAL __attribute__((visibility("hidden")))

#define __SYCL_EXPORT __attribute__((visibility("default")))
#define __SYCL_EXPORT_DEPRECATED(x) \
__attribute__((visibility("default"), deprecated(x)))
#endif
#endif
#endif
6 changes: 3 additions & 3 deletions sycl/include/CL/sycl/detail/force_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
#pragma once

#include <CL/sycl/detail/defines.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/info/info_desc.hpp>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

SYCL_API bool match_types(const info::device_type &l,
const info::device_type &r);
__SYCL_EXPORT bool match_types(const info::device_type &l,
const info::device_type &r);

info::device_type get_forced_type();

Expand Down
22 changes: 10 additions & 12 deletions sycl/include/CL/sycl/detail/generic_type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/generic_type_lists.hpp>
#include <CL/sycl/detail/type_traits.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/half_type.hpp>

#include <limits>
Expand Down Expand Up @@ -291,7 +290,7 @@ template <typename T, typename B>
using convert_data_type = convert_data_type_impl<T, B, T>;

// Try to get pointer_t, otherwise T
template <typename T> class SYCL_API TryToGetPointerT {
template <typename T> class TryToGetPointerT {
static T check(...);
template <typename A> static typename A::pointer_t check(const A &);

Expand All @@ -302,7 +301,7 @@ template <typename T> class SYCL_API TryToGetPointerT {
};

// Try to get element_type, otherwise T
template <typename T> class SYCL_API TryToGetElementType {
template <typename T> class TryToGetElementType {
static T check(...);
template <typename A> static typename A::element_type check(const A &);

Expand All @@ -312,7 +311,7 @@ template <typename T> class SYCL_API TryToGetElementType {
};

// Try to get vector_t, otherwise T
template <typename T> class SYCL_API TryToGetVectorT {
template <typename T> class TryToGetVectorT {
static T check(...);
template <typename A> static typename A::vector_t check(const A &);

Expand All @@ -323,7 +322,7 @@ template <typename T> class SYCL_API TryToGetVectorT {

// Try to get pointer_t (if pointer_t indicates on the type with_remainder
// vector_t creates a pointer type on vector_t), otherwise T
template <typename T> class SYCL_API TryToGetPointerVecT {
template <typename T> class TryToGetPointerVecT {
static T check(...);
template <typename A>
static typename PtrValueType<
Expand Down Expand Up @@ -583,23 +582,22 @@ struct RelConverter<
};

template <typename T> static constexpr T max_v() {
return std::numeric_limits<T>::max();
return (std::numeric_limits<T>::max)();
}

template <typename T> static constexpr T min_v() {
return std::numeric_limits<T>::min();
return (std::numeric_limits<T>::min)();
}

template <typename T> static constexpr T quiet_NaN() {
return std::numeric_limits<T>::quiet_NaN();
}

// is_same_vector_size
template <int FirstSize, typename... Args>
class SYCL_API is_same_vector_size_impl;
template <int FirstSize, typename... Args> class is_same_vector_size_impl;

template <int FirstSize, typename T, typename... Args>
class SYCL_API is_same_vector_size_impl<FirstSize, T, Args...> {
class is_same_vector_size_impl<FirstSize, T, Args...> {
using CurrentT = detail::remove_pointer_t<T>;
static constexpr int Size = vector_size<CurrentT>::value;
static constexpr bool IsSizeEqual = (Size == FirstSize);
Expand All @@ -610,9 +608,9 @@ class SYCL_API is_same_vector_size_impl<FirstSize, T, Args...> {
};

template <int FirstSize>
class SYCL_API is_same_vector_size_impl<FirstSize> : public std::true_type {};
class is_same_vector_size_impl<FirstSize> : public std::true_type {};

template <typename T, typename... Args> class SYCL_API is_same_vector_size {
template <typename T, typename... Args> class is_same_vector_size {
using CurrentT = remove_pointer_t<T>;
static constexpr int Size = vector_size<CurrentT>::value;

Expand Down
8 changes: 4 additions & 4 deletions sycl/include/CL/sycl/detail/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <CL/__spirv/spirv_vars.hpp>
#include <CL/sycl/access/access.hpp>
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/pi.hpp>
#include <CL/sycl/detail/type_traits.hpp>
#include <CL/sycl/export.hpp>

#include <memory>
#include <stdexcept>
Expand All @@ -34,7 +34,7 @@ template <int Dims> class h_item;
enum class memory_order;

namespace detail {
SYCL_API inline void memcpy(void *Dst, const void *Src, size_t Size) {
inline void memcpy(void *Dst, const void *Src, size_t Size) {
char *Destination = reinterpret_cast<char *>(Dst);
const char *Source = reinterpret_cast<const char *>(Src);
for (size_t I = 0; I < Size; ++I) {
Expand All @@ -45,11 +45,11 @@ SYCL_API inline void memcpy(void *Dst, const void *Src, size_t Size) {
class context_impl;
// The function returns list of events that can be passed to OpenCL API as
// dependency list and waits for others.
SYCL_API std::vector<RT::PiEvent>
__SYCL_EXPORT std::vector<RT::PiEvent>
getOrWaitEvents(std::vector<cl::sycl::event> DepEvents,
std::shared_ptr<cl::sycl::detail::context_impl> Context);

SYCL_API void waitEvents(std::vector<cl::sycl::event> DepEvents);
__SYCL_EXPORT void waitEvents(std::vector<cl::sycl::event> DepEvents);

class Builder {
public:
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/host_profiling_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#pragma once

#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/detail/export.hpp>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

/// Profiling info for the host execution.
class SYCL_API HostProfilingInfo {
class __SYCL_EXPORT HostProfilingInfo {
cl_ulong StartTime = 0;
cl_ulong EndTime = 0;

Expand Down
Loading