diff --git a/sycl/include/sycl/async_handler.hpp b/sycl/include/sycl/async_handler.hpp new file mode 100644 index 0000000000000..01ba71dc51efd --- /dev/null +++ b/sycl/include/sycl/async_handler.hpp @@ -0,0 +1,23 @@ +//===- async_handler.hpp --------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include + +#include + +namespace sycl { +__SYCL_INLINE_VER_NAMESPACE(_V1) { + +// Forward declaration +class exception_list; + +using async_handler = std::function; +} // __SYCL_INLINE_VER_NAMESPACE(_V1) +} // namespace sycl diff --git a/sycl/include/sycl/backend_types.hpp b/sycl/include/sycl/backend_types.hpp index b74c4828a536a..ce308e3d52d82 100644 --- a/sycl/include/sycl/backend_types.hpp +++ b/sycl/include/sycl/backend_types.hpp @@ -8,8 +8,9 @@ #pragma once -#include -#include +#include + +#include namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { diff --git a/sycl/include/sycl/buffer.hpp b/sycl/include/sycl/buffer.hpp index 18153b33d9c70..bf56a88e760d8 100644 --- a/sycl/include/sycl/buffer.hpp +++ b/sycl/include/sycl/buffer.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/sycl/include/sycl/context.hpp b/sycl/include/sycl/context.hpp index 765896cffae5e..1c4cd91678567 100644 --- a/sycl/include/sycl/context.hpp +++ b/sycl/include/sycl/context.hpp @@ -8,16 +8,11 @@ #pragma once -#include -#include -#include +#include +#include #include #include #include -#include -#include -#include -#include #include // 4.6.2 Context class @@ -27,6 +22,7 @@ __SYCL_INLINE_VER_NAMESPACE(_V1) { // Forward declarations class device; class platform; + namespace detail { class context_impl; } diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index 2f8a65d0216b5..7983baca607ec 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -259,41 +259,6 @@ inline std::string codeToString(pi_int32 code) { namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { namespace detail { - -// Helper function for extracting implementation from SYCL's interface objects. -// Note! This function relies on the fact that all SYCL interface classes -// contain "impl" field that points to implementation object. "impl" field -// should be accessible from this function. -// -// Note that due to a bug in MSVC compilers (including MSVC2019 v19.20), it -// may not recognize the usage of this function in friend member declarations -// if the template parameter name there is not equal to the name used here, -// i.e. 'Obj'. For example, using 'Obj' here and 'T' in such declaration -// would trigger that error in MSVC: -// template -// friend decltype(T::impl) detail::getSyclObjImpl(const T &SyclObject); -template decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject) { - assert(SyclObject.impl && "every constructor should create an impl"); - return SyclObject.impl; -} - -// Returns the raw pointer to the impl object of given face object. The caller -// must make sure the returned pointer is not captured in a field or otherwise -// stored - i.e. must live only as on-stack value. -template -typename std::add_pointer_t -getRawSyclObjImpl(const T &SyclObject) { - return SyclObject.impl.get(); -} - -// Helper function for creation SYCL interface objects from implementations. -// Note! This function relies on the fact that all SYCL interface classes -// contain "impl" field that points to implementation object. "impl" field -// should be accessible from this function. -template T createSyclObjFromImpl(decltype(T::impl) ImplObj) { - return T(ImplObj); -} - // Produces N-dimensional object of type T whose all components are initialized // to given integer value. template class T> struct InitializedVal { diff --git a/sycl/include/sycl/detail/impl_utils.hpp b/sycl/include/sycl/detail/impl_utils.hpp new file mode 100644 index 0000000000000..622d2d540a6fd --- /dev/null +++ b/sycl/include/sycl/detail/impl_utils.hpp @@ -0,0 +1,55 @@ +//===- impl_utils.hpp -----------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include + +#include + +namespace sycl { +__SYCL_INLINE_VER_NAMESPACE(_V1) { +namespace detail { + +// Helper function for extracting implementation from SYCL's interface objects. +// Note! This function relies on the fact that all SYCL interface classes +// contain "impl" field that points to implementation object. "impl" field +// should be accessible from this function. +// +// Note that due to a bug in MSVC compilers (including MSVC2019 v19.20), it +// may not recognize the usage of this function in friend member declarations +// if the template parameter name there is not equal to the name used here, +// i.e. 'Obj'. For example, using 'Obj' here and 'T' in such declaration +// would trigger that error in MSVC: +// template +// friend decltype(T::impl) detail::getSyclObjImpl(const T &SyclObject); +template decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject) { + assert(SyclObject.impl && "every constructor should create an impl"); + return SyclObject.impl; +} + +// Returns the raw pointer to the impl object of given face object. The caller +// must make sure the returned pointer is not captured in a field or otherwise +// stored - i.e. must live only as on-stack value. +template +typename std::add_pointer_t +getRawSyclObjImpl(const T &SyclObject) { + return SyclObject.impl.get(); +} + +// Helper function for creation SYCL interface objects from implementations. +// Note! This function relies on the fact that all SYCL interface classes +// contain "impl" field that points to implementation object. "impl" field +// should be accessible from this function. +template T createSyclObjFromImpl(decltype(T::impl) ImplObj) { + return T(ImplObj); +} + +} // namespace detail +} // __SYCL_INLINE_VER_NAMESPACE(_V1) +} // namespace sycl diff --git a/sycl/include/sycl/detail/info_desc_helpers.hpp b/sycl/include/sycl/detail/info_desc_helpers.hpp index 8eef426a9ae23..b6f652b33520c 100644 --- a/sycl/include/sycl/detail/info_desc_helpers.hpp +++ b/sycl/include/sycl/detail/info_desc_helpers.hpp @@ -9,7 +9,8 @@ #pragma once #include -#include +#include +#include #include namespace sycl { diff --git a/sycl/include/sycl/detail/owner_less_base.hpp b/sycl/include/sycl/detail/owner_less_base.hpp index d082afd954d1c..b810596c1f217 100644 --- a/sycl/include/sycl/detail/owner_less_base.hpp +++ b/sycl/include/sycl/detail/owner_less_base.hpp @@ -8,8 +8,8 @@ #pragma once -#include #include +#include #include namespace sycl { diff --git a/sycl/include/sycl/detail/property_helper.hpp b/sycl/include/sycl/detail/property_helper.hpp index 1ecd9b15e1773..5ada3ee10c4d9 100644 --- a/sycl/include/sycl/detail/property_helper.hpp +++ b/sycl/include/sycl/detail/property_helper.hpp @@ -8,7 +8,7 @@ #pragma once -#include +#include namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { diff --git a/sycl/include/sycl/detail/property_list_base.hpp b/sycl/include/sycl/detail/property_list_base.hpp index e1e5e0d053d24..96ff4aab89a55 100644 --- a/sycl/include/sycl/detail/property_list_base.hpp +++ b/sycl/include/sycl/detail/property_list_base.hpp @@ -8,9 +8,9 @@ #pragma once -#include #include #include +#include #include #include diff --git a/sycl/include/sycl/detail/stl_type_traits.hpp b/sycl/include/sycl/detail/stl_type_traits.hpp index 30261af1eb9f0..747632f649c20 100644 --- a/sycl/include/sycl/detail/stl_type_traits.hpp +++ b/sycl/include/sycl/detail/stl_type_traits.hpp @@ -8,9 +8,9 @@ #pragma once +#include + #include -#include -#include #include namespace sycl { diff --git a/sycl/include/sycl/device_selector.hpp b/sycl/include/sycl/device_selector.hpp index d34ec60f5c0d6..4a23f701d53aa 100644 --- a/sycl/include/sycl/device_selector.hpp +++ b/sycl/include/sycl/device_selector.hpp @@ -21,6 +21,7 @@ __SYCL_INLINE_VER_NAMESPACE(_V1) { // Forward declarations class device; +class context; enum class aspect; namespace ext::oneapi { diff --git a/sycl/include/sycl/exception_list.hpp b/sycl/include/sycl/exception_list.hpp index 8852fd02b0b6f..1aa71c0130019 100644 --- a/sycl/include/sycl/exception_list.hpp +++ b/sycl/include/sycl/exception_list.hpp @@ -10,6 +10,7 @@ // 4.9.2 Exception Class Interface +#include #include #include #include @@ -52,8 +53,6 @@ class __SYCL_EXPORT exception_list { std::vector MList; }; -using async_handler = std::function; - namespace detail { // Default implementation of async_handler used by queue and context when no // user-defined async_handler is specified. diff --git a/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp b/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp index 9dd985e3b3af7..40031dea73a31 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp @@ -1,3 +1,11 @@ +//===- device_architecture.hpp --------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + #pragma once #include diff --git a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp index 368b7733b496b..47031708b9b6d 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/sycl/include/sycl/info/info_desc.hpp b/sycl/include/sycl/info/info_desc.hpp index 90040767f9589..be57a9430ca60 100644 --- a/sycl/include/sycl/info/info_desc.hpp +++ b/sycl/include/sycl/info/info_desc.hpp @@ -9,10 +9,9 @@ #pragma once #include -#include -#include +#include #include -#include +#include namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { @@ -21,6 +20,7 @@ class device; class platform; class kernel_id; enum class memory_scope; +enum class memory_order; // TODO: stop using OpenCL directly, use PI. namespace info { diff --git a/sycl/include/sycl/property_list.hpp b/sycl/include/sycl/property_list.hpp index 367b91e7ff463..9566f9ea8e390 100644 --- a/sycl/include/sycl/property_list.hpp +++ b/sycl/include/sycl/property_list.hpp @@ -8,7 +8,6 @@ #pragma once -#include #include #include diff --git a/sycl/include/sycl/queue.hpp b/sycl/include/sycl/queue.hpp index 66635610b7bd4..e64e9182ec977 100644 --- a/sycl/include/sycl/queue.hpp +++ b/sycl/include/sycl/queue.hpp @@ -9,9 +9,9 @@ #pragma once #include -#include #include #include +#include #include #include diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index 7a21efb515b23..febb5770a5b78 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/sycl/source/detail/posix_pi.cpp b/sycl/source/detail/posix_pi.cpp index decce7bb67083..35abc17bd2e32 100644 --- a/sycl/source/detail/posix_pi.cpp +++ b/sycl/source/detail/posix_pi.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include +#include #include #include diff --git a/sycl/source/detail/sampler_impl.hpp b/sycl/source/detail/sampler_impl.hpp index 32652d6ea5c0f..07a79a21cd64b 100644 --- a/sycl/source/detail/sampler_impl.hpp +++ b/sycl/source/detail/sampler_impl.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/sycl/source/detail/sycl_mem_obj_t.hpp b/sycl/source/detail/sycl_mem_obj_t.hpp index 100fc3c39b766..582c8b652d95d 100644 --- a/sycl/source/detail/sycl_mem_obj_t.hpp +++ b/sycl/source/detail/sycl_mem_obj_t.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include