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
1 change: 0 additions & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ project(sycl-solution)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF)

# enable all warnings by default
Expand Down
10 changes: 6 additions & 4 deletions sycl/include/CL/__spirv/spirv_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once
#include <CL/__spirv/spirv_types.hpp>
#include <CL/sycl/detail/defines.hpp>
#include <CL/sycl/export.hpp>
#include <cstddef>
#include <cstdint>
#include <type_traits>
Expand Down Expand Up @@ -256,16 +257,17 @@ OpGroupAsyncCopyLocalToGlobal(__spv::Scope::Flag Execution, dataT *Dest,
return nullptr;
}

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

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

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

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

Expand Down
4 changes: 3 additions & 1 deletion sycl/include/CL/sycl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#pragma once
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/exception_list.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/info/info_desc.hpp>
#include <CL/sycl/stl.hpp>

#include <type_traits>
// 4.6.2 Context class

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

class context {
class SYCL_API context {
public:
/// Constructs a SYCL context instance using an instance of default_selector.
///
Expand Down
10 changes: 5 additions & 5 deletions sycl/include/CL/sycl/detail/accessor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <CL/sycl/access/access.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 @@ -37,8 +38,7 @@ template <int Dims> class AccessorImplDevice {
range<Dims> MemRange;

bool operator==(const AccessorImplDevice &Rhs) const {
return (Offset == Rhs.Offset &&
AccessRange == Rhs.AccessRange &&
return (Offset == Rhs.Offset && AccessRange == Rhs.AccessRange &&
MemRange == Rhs.MemRange);
}
};
Expand All @@ -59,7 +59,7 @@ template <int Dims> class LocalAccessorBaseDevice {
}
};

class AccessorImplHost {
class SYCL_API 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 LocalAccessorImplHost {
class SYCL_API 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 addHostAccessorAndWait(Requirement *Req);
void SYCL_API addHostAccessorAndWait(Requirement *Req);

} // namespace detail
} // namespace sycl
Expand Down
5 changes: 3 additions & 2 deletions sycl/include/CL/sycl/detail/buffer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <CL/sycl/detail/common.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 @@ -38,7 +39,7 @@ using buffer_allocator = detail::sycl_memory_object_allocator;

namespace detail {

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

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

void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
void *HostPtr, RT::PiEvent &OutEventToWait) override;
void *HostPtr, RT::PiEvent &OutEventToWait) override;

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

Expand Down
3 changes: 2 additions & 1 deletion sycl/include/CL/sycl/detail/cg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#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 @@ -55,7 +56,7 @@ class interop_handler {
private:
cl_command_queue MQueue;
std::vector<ReqToMem> MMemObjs;
cl_mem getMemImpl(detail::Requirement* Req) const;
SYCL_API cl_mem getMemImpl(detail::Requirement *Req) const;
};

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

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

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

const char *stringifyErrorCode(cl_int error);
SYCL_API 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
5 changes: 3 additions & 2 deletions sycl/include/CL/sycl/detail/common_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
//===----------------------------------------------------------------------===//

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

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

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

} // namespace detail
} // namespace sycl
Expand Down
8 changes: 0 additions & 8 deletions sycl/include/CL/sycl/detail/defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,3 @@
#ifndef SYCL_EXTERNAL
#define SYCL_EXTERNAL
#endif

#if __cplusplus >= 201402
#define __SYCL_DEPRECATED__(message) [[deprecated(message)]]
#elif !defined _MSC_VER
#define __SYCL_DEPRECATED__(message) __attribute__((deprecated(message)))
#else
#define __SYCL_DEPRECATED__(message)
#endif
4 changes: 3 additions & 1 deletion sycl/include/CL/sycl/detail/force_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
#pragma once

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

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

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

info::device_type get_forced_type();

Expand Down
21 changes: 11 additions & 10 deletions sycl/include/CL/sycl/detail/generic_type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#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 @@ -290,7 +291,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 TryToGetPointerT {
template <typename T> class SYCL_API TryToGetPointerT {
static T check(...);
template <typename A> static typename A::pointer_t check(const A &);

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

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

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

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

Expand All @@ -322,7 +323,7 @@ template <typename T> class 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 TryToGetPointerVecT {
template <typename T> class SYCL_API TryToGetPointerVecT {
static T check(...);
template <typename A>
static typename PtrValueType<
Expand Down Expand Up @@ -594,24 +595,24 @@ template <typename T> static constexpr T quiet_NaN() {
}

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

template <int FirstSize, typename T, typename... Args>
class is_same_vector_size_impl<FirstSize, T, Args...> {
class SYCL_API 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);

public:
static constexpr bool value =
IsSizeEqual ? is_same_vector_size_impl<FirstSize, Args...>::value
: false;
IsSizeEqual ? is_same_vector_size_impl<FirstSize, Args...>::value : false;
};

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

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

Expand Down
7 changes: 4 additions & 3 deletions sycl/include/CL/sycl/detail/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <CL/sycl/detail/common.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 @@ -33,7 +34,7 @@ template <int Dims> class h_item;
enum class memory_order;

namespace detail {
inline void memcpy(void *Dst, const void *Src, size_t Size) {
SYCL_API 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 @@ -44,11 +45,11 @@ 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.
std::vector<RT::PiEvent>
SYCL_API std::vector<RT::PiEvent>
getOrWaitEvents(std::vector<cl::sycl::event> DepEvents,
std::shared_ptr<cl::sycl::detail::context_impl> Context);

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

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

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

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

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

Expand Down
16 changes: 9 additions & 7 deletions sycl/include/CL/sycl/detail/image_accessor_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef __SYCL_DEVICE_ONLY__
#include <CL/sycl/builtins.hpp>
#include <CL/sycl/detail/generic_type_traits.hpp>
#include <CL/sycl/export.hpp>
#include <CL/sycl/image.hpp>
#include <CL/sycl/sampler.hpp>
#include <CL/sycl/types.hpp>
Expand Down Expand Up @@ -99,21 +100,22 @@ getImageOffset(const vec<T, 4> &Coords, const id<3> ImgPitch,

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

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

// Check if PixelCoord are out of range for Sampler with clamp adressing mode.
bool isOutOfRange(const cl_int4 PixelCoord, const addressing_mode SmplAddrMode,
const range<3> ImgRange);
SYCL_API bool isOutOfRange(const cl_int4 PixelCoord,
const addressing_mode SmplAddrMode,
const range<3> ImgRange);

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

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