Skip to content

Commit 9928b53

Browse files
author
Alexander Batashev
committed
[SYCL] Only export public API
To enable better control over ABI compatibility, only export functions that users are expected to use. A public API is the part of SYCL Runtime that is implemented in the dynamic Runtime library and is expected to be accessed by the user. That is all public SYCL API (as defined by the spec), implemented in *.cpp files and all routines accessed by these APIs (also implemented in *.cpp). Signed-off-by: Alexander Batashev <[email protected]>
1 parent 18a2354 commit 9928b53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1075
-852
lines changed

sycl/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ project(sycl-solution)
55
set(CMAKE_CXX_STANDARD 11)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77
set(CMAKE_CXX_EXTENSIONS OFF)
8-
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
98
option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF)
109

1110
# enable all warnings by default

sycl/include/CL/__spirv/spirv_ops.hpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma once
1010
#include <CL/__spirv/spirv_types.hpp>
1111
#include <CL/sycl/detail/defines.hpp>
12+
#include <CL/sycl/export.hpp>
1213
#include <cstddef>
1314
#include <cstdint>
1415
#include <type_traits>
@@ -256,16 +257,17 @@ OpGroupAsyncCopyLocalToGlobal(__spv::Scope::Flag Execution, dataT *Dest,
256257
return nullptr;
257258
}
258259

259-
extern void __spirv_ocl_prefetch(const char *Ptr, size_t NumBytes) noexcept;
260+
extern SYCL_API void __spirv_ocl_prefetch(const char *Ptr,
261+
size_t NumBytes) noexcept;
260262

261-
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL void
263+
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL SYCL_API void
262264
__spirv_ControlBarrier(__spv::Scope Execution, __spv::Scope Memory,
263265
uint32_t Semantics) noexcept;
264266

265-
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL void
267+
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL SYCL_API void
266268
__spirv_MemoryBarrier(__spv::Scope Memory, uint32_t Semantics) noexcept;
267269

268-
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL void
270+
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL SYCL_API void
269271
__spirv_GroupWaitEvents(__spv::Scope Execution, uint32_t NumEvents,
270272
__ocl_event_t *WaitEvents) noexcept;
271273

sycl/include/CL/sycl/context.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
#pragma once
1010
#include <CL/sycl/detail/common.hpp>
1111
#include <CL/sycl/exception_list.hpp>
12+
#include <CL/sycl/export.hpp>
1213
#include <CL/sycl/info/info_desc.hpp>
1314
#include <CL/sycl/stl.hpp>
15+
1416
#include <type_traits>
1517
// 4.6.2 Context class
1618

@@ -23,7 +25,7 @@ namespace detail {
2325
class context_impl;
2426
}
2527

26-
class context {
28+
class SYCL_API context {
2729
public:
2830
/// Constructs a SYCL context instance using an instance of default_selector.
2931
///

sycl/include/CL/sycl/detail/accessor_impl.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <CL/sycl/access/access.hpp>
1212
#include <CL/sycl/detail/sycl_mem_obj_i.hpp>
13+
#include <CL/sycl/export.hpp>
1314
#include <CL/sycl/id.hpp>
1415
#include <CL/sycl/range.hpp>
1516
#include <CL/sycl/stl.hpp>
@@ -37,8 +38,7 @@ template <int Dims> class AccessorImplDevice {
3738
range<Dims> MemRange;
3839

3940
bool operator==(const AccessorImplDevice &Rhs) const {
40-
return (Offset == Rhs.Offset &&
41-
AccessRange == Rhs.AccessRange &&
41+
return (Offset == Rhs.Offset && AccessRange == Rhs.AccessRange &&
4242
MemRange == Rhs.MemRange);
4343
}
4444
};
@@ -59,7 +59,7 @@ template <int Dims> class LocalAccessorBaseDevice {
5959
}
6060
};
6161

62-
class AccessorImplHost {
62+
class SYCL_API AccessorImplHost {
6363
public:
6464
AccessorImplHost(id<3> Offset, range<3> AccessRange, range<3> MemoryRange,
6565
access::mode AccessMode, detail::SYCLMemObjI *SYCLMemObject,
@@ -129,7 +129,7 @@ class AccessorBaseHost {
129129
AccessorImplPtr impl;
130130
};
131131

132-
class LocalAccessorImplHost {
132+
class SYCL_API LocalAccessorImplHost {
133133
public:
134134
LocalAccessorImplHost(sycl::range<3> Size, int Dims, int ElemSize)
135135
: MSize(Size), MDims(Dims), MElemSize(ElemSize),
@@ -185,7 +185,7 @@ class LocalAccessorBaseHost {
185185

186186
using Requirement = AccessorImplHost;
187187

188-
void addHostAccessorAndWait(Requirement *Req);
188+
void SYCL_API addHostAccessorAndWait(Requirement *Req);
189189

190190
} // namespace detail
191191
} // namespace sycl

sycl/include/CL/sycl/detail/buffer_impl.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <CL/sycl/detail/common.hpp>
1515
#include <CL/sycl/detail/helpers.hpp>
1616
#include <CL/sycl/detail/sycl_mem_obj_t.hpp>
17+
#include <CL/sycl/export.hpp>
1718
#include <CL/sycl/handler.hpp>
1819
#include <CL/sycl/property_list.hpp>
1920
#include <CL/sycl/stl.hpp>
@@ -38,7 +39,7 @@ using buffer_allocator = detail::sycl_memory_object_allocator;
3839

3940
namespace detail {
4041

41-
class buffer_impl final : public SYCLMemObjT {
42+
class SYCL_API buffer_impl final : public SYCLMemObjT {
4243
using BaseT = SYCLMemObjT;
4344
using typename BaseT::MemObjType;
4445

@@ -104,7 +105,7 @@ class buffer_impl final : public SYCLMemObjT {
104105
std::move(Allocator)) {}
105106

106107
void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
107-
void *HostPtr, RT::PiEvent &OutEventToWait) override;
108+
void *HostPtr, RT::PiEvent &OutEventToWait) override;
108109

109110
MemObjType getType() const override { return MemObjType::BUFFER; }
110111

sycl/include/CL/sycl/detail/cg.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <CL/sycl/detail/host_profiling_info.hpp>
1515
#include <CL/sycl/detail/kernel_desc.hpp>
1616
#include <CL/sycl/detail/type_traits.hpp>
17+
#include <CL/sycl/export.hpp>
1718
#include <CL/sycl/group.hpp>
1819
#include <CL/sycl/id.hpp>
1920
#include <CL/sycl/kernel.hpp>
@@ -55,7 +56,7 @@ class interop_handler {
5556
private:
5657
cl_command_queue MQueue;
5758
std::vector<ReqToMem> MMemObjs;
58-
cl_mem getMemImpl(detail::Requirement* Req) const;
59+
SYCL_API cl_mem getMemImpl(detail::Requirement *Req) const;
5960
};
6061

6162
namespace detail {

sycl/include/CL/sycl/detail/common.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma once
1010

1111
#include <CL/sycl/detail/defines.hpp>
12+
#include <CL/sycl/export.hpp>
1213

1314
// Suppress a compiler warning about undefined CL_TARGET_OPENCL_VERSION
1415
// Khronos ICD supports only latest OpenCL version
@@ -84,7 +85,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
8485
namespace sycl {
8586
namespace detail {
8687

87-
const char *stringifyErrorCode(cl_int error);
88+
SYCL_API const char *stringifyErrorCode(cl_int error);
8889

8990
static inline std::string codeToString(cl_int code) {
9091
return std::string(std::to_string(code) + " (" + stringifyErrorCode(code) +

sycl/include/CL/sycl/detail/common_info.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
//===----------------------------------------------------------------------===//
88

99
#pragma once
10+
#include <CL/sycl/export.hpp>
1011
#include <CL/sycl/stl.hpp>
1112

1213
__SYCL_INLINE_NAMESPACE(cl) {
1314
namespace sycl {
1415
namespace detail {
1516

16-
vector_class<string_class> split_string(const string_class &str,
17-
char delimeter);
17+
vector_class<string_class> SYCL_API split_string(const string_class &str,
18+
char delimeter);
1819

1920
} // namespace detail
2021
} // namespace sycl

sycl/include/CL/sycl/detail/defines.hpp

-8
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,3 @@
3131
#ifndef SYCL_EXTERNAL
3232
#define SYCL_EXTERNAL
3333
#endif
34-
35-
#if __cplusplus >= 201402
36-
#define __SYCL_DEPRECATED__(message) [[deprecated(message)]]
37-
#elif !defined _MSC_VER
38-
#define __SYCL_DEPRECATED__(message) __attribute__((deprecated(message)))
39-
#else
40-
#define __SYCL_DEPRECATED__(message)
41-
#endif

sycl/include/CL/sycl/detail/force_device.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
#pragma once
1010

1111
#include <CL/sycl/detail/defines.hpp>
12+
#include <CL/sycl/export.hpp>
1213
#include <CL/sycl/info/info_desc.hpp>
1314

1415
__SYCL_INLINE_NAMESPACE(cl) {
1516
namespace sycl {
1617
namespace detail {
1718

18-
bool match_types(const info::device_type &l, const info::device_type &r);
19+
SYCL_API bool match_types(const info::device_type &l,
20+
const info::device_type &r);
1921

2022
info::device_type get_forced_type();
2123

sycl/include/CL/sycl/detail/generic_type_traits.hpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <CL/sycl/detail/common.hpp>
1414
#include <CL/sycl/detail/generic_type_lists.hpp>
1515
#include <CL/sycl/detail/type_traits.hpp>
16+
#include <CL/sycl/export.hpp>
1617
#include <CL/sycl/half_type.hpp>
1718

1819
#include <limits>
@@ -290,7 +291,7 @@ template <typename T, typename B>
290291
using convert_data_type = convert_data_type_impl<T, B, T>;
291292

292293
// Try to get pointer_t, otherwise T
293-
template <typename T> class TryToGetPointerT {
294+
template <typename T> class SYCL_API TryToGetPointerT {
294295
static T check(...);
295296
template <typename A> static typename A::pointer_t check(const A &);
296297

@@ -301,7 +302,7 @@ template <typename T> class TryToGetPointerT {
301302
};
302303

303304
// Try to get element_type, otherwise T
304-
template <typename T> class TryToGetElementType {
305+
template <typename T> class SYCL_API TryToGetElementType {
305306
static T check(...);
306307
template <typename A> static typename A::element_type check(const A &);
307308

@@ -311,7 +312,7 @@ template <typename T> class TryToGetElementType {
311312
};
312313

313314
// Try to get vector_t, otherwise T
314-
template <typename T> class TryToGetVectorT {
315+
template <typename T> class SYCL_API TryToGetVectorT {
315316
static T check(...);
316317
template <typename A> static typename A::vector_t check(const A &);
317318

@@ -322,7 +323,7 @@ template <typename T> class TryToGetVectorT {
322323

323324
// Try to get pointer_t (if pointer_t indicates on the type with_remainder
324325
// vector_t creates a pointer type on vector_t), otherwise T
325-
template <typename T> class TryToGetPointerVecT {
326+
template <typename T> class SYCL_API TryToGetPointerVecT {
326327
static T check(...);
327328
template <typename A>
328329
static typename PtrValueType<
@@ -594,24 +595,24 @@ template <typename T> static constexpr T quiet_NaN() {
594595
}
595596

596597
// is_same_vector_size
597-
template <int FirstSize, typename... Args> class is_same_vector_size_impl;
598+
template <int FirstSize, typename... Args>
599+
class SYCL_API is_same_vector_size_impl;
598600

599601
template <int FirstSize, typename T, typename... Args>
600-
class is_same_vector_size_impl<FirstSize, T, Args...> {
602+
class SYCL_API is_same_vector_size_impl<FirstSize, T, Args...> {
601603
using CurrentT = detail::remove_pointer_t<T>;
602604
static constexpr int Size = vector_size<CurrentT>::value;
603605
static constexpr bool IsSizeEqual = (Size == FirstSize);
604606

605607
public:
606608
static constexpr bool value =
607-
IsSizeEqual ? is_same_vector_size_impl<FirstSize, Args...>::value
608-
: false;
609+
IsSizeEqual ? is_same_vector_size_impl<FirstSize, Args...>::value : false;
609610
};
610611

611612
template <int FirstSize>
612-
class is_same_vector_size_impl<FirstSize> : public std::true_type {};
613+
class SYCL_API is_same_vector_size_impl<FirstSize> : public std::true_type {};
613614

614-
template <typename T, typename... Args> class is_same_vector_size {
615+
template <typename T, typename... Args> class SYCL_API is_same_vector_size {
615616
using CurrentT = remove_pointer_t<T>;
616617
static constexpr int Size = vector_size<CurrentT>::value;
617618

sycl/include/CL/sycl/detail/helpers.hpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <CL/sycl/detail/common.hpp>
1515
#include <CL/sycl/detail/pi.hpp>
1616
#include <CL/sycl/detail/type_traits.hpp>
17+
#include <CL/sycl/export.hpp>
1718

1819
#include <memory>
1920
#include <stdexcept>
@@ -33,7 +34,7 @@ template <int Dims> class h_item;
3334
enum class memory_order;
3435

3536
namespace detail {
36-
inline void memcpy(void *Dst, const void *Src, size_t Size) {
37+
SYCL_API inline void memcpy(void *Dst, const void *Src, size_t Size) {
3738
char *Destination = reinterpret_cast<char *>(Dst);
3839
const char *Source = reinterpret_cast<const char *>(Src);
3940
for (size_t I = 0; I < Size; ++I) {
@@ -44,11 +45,11 @@ inline void memcpy(void *Dst, const void *Src, size_t Size) {
4445
class context_impl;
4546
// The function returns list of events that can be passed to OpenCL API as
4647
// dependency list and waits for others.
47-
std::vector<RT::PiEvent>
48+
SYCL_API std::vector<RT::PiEvent>
4849
getOrWaitEvents(std::vector<cl::sycl::event> DepEvents,
4950
std::shared_ptr<cl::sycl::detail::context_impl> Context);
5051

51-
void waitEvents(std::vector<cl::sycl::event> DepEvents);
52+
SYCL_API void waitEvents(std::vector<cl::sycl::event> DepEvents);
5253

5354
class Builder {
5455
public:

sycl/include/CL/sycl/detail/host_profiling_info.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
#pragma once
1010

1111
#include <CL/sycl/detail/common.hpp>
12+
#include <CL/sycl/export.hpp>
1213

1314
__SYCL_INLINE_NAMESPACE(cl) {
1415
namespace sycl {
1516
namespace detail {
1617

1718
/// Profiling info for the host execution.
18-
class HostProfilingInfo {
19+
class SYCL_API HostProfilingInfo {
1920
cl_ulong StartTime = 0;
2021
cl_ulong EndTime = 0;
2122

sycl/include/CL/sycl/detail/image_accessor_util.hpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef __SYCL_DEVICE_ONLY__
1515
#include <CL/sycl/builtins.hpp>
1616
#include <CL/sycl/detail/generic_type_traits.hpp>
17+
#include <CL/sycl/export.hpp>
1718
#include <CL/sycl/image.hpp>
1819
#include <CL/sycl/sampler.hpp>
1920
#include <CL/sycl/types.hpp>
@@ -99,21 +100,22 @@ getImageOffset(const vec<T, 4> &Coords, const id<3> ImgPitch,
99100

100101
// Process cl_float4 Coordinates and return the appropriate Pixel Coordinates to
101102
// read from based on Addressing Mode for Nearest filter mode.
102-
cl_int4 getPixelCoordNearestFiltMode(cl_float4, const addressing_mode,
103-
const range<3>);
103+
SYCL_API cl_int4 getPixelCoordNearestFiltMode(cl_float4, const addressing_mode,
104+
const range<3>);
104105

105106
// Process cl_float4 Coordinates and return the appropriate Pixel Coordinates to
106107
// read from based on Addressing Mode for Linear filter mode.
107-
cl_int8 getPixelCoordLinearFiltMode(cl_float4, const addressing_mode,
108-
const range<3>, cl_float4 &);
108+
SYCL_API cl_int8 getPixelCoordLinearFiltMode(cl_float4, const addressing_mode,
109+
const range<3>, cl_float4 &);
109110

110111
// Check if PixelCoord are out of range for Sampler with clamp adressing mode.
111-
bool isOutOfRange(const cl_int4 PixelCoord, const addressing_mode SmplAddrMode,
112-
const range<3> ImgRange);
112+
SYCL_API bool isOutOfRange(const cl_int4 PixelCoord,
113+
const addressing_mode SmplAddrMode,
114+
const range<3> ImgRange);
113115

114116
// Get Border Color for the image_channel_order, the border color values are
115117
// only used when the sampler has clamp addressing mode.
116-
cl_float4 getBorderColor(const image_channel_order ImgChannelOrder);
118+
SYCL_API cl_float4 getBorderColor(const image_channel_order ImgChannelOrder);
117119

118120
// Reads data from a pixel at Ptr location, based on the number of Channels in
119121
// Order and returns the data.

0 commit comments

Comments
 (0)