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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 6 additions & 4 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 3 additions & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 3 additions & 2 deletions
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

Lines changed: 0 additions & 8 deletions
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

Lines changed: 3 additions & 1 deletion
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

0 commit comments

Comments
 (0)