Skip to content
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

[SYCL][NFC] Refactor #includes #16030

Open
wants to merge 11 commits into
base: sycl
Choose a base branch
from
2 changes: 1 addition & 1 deletion libdevice/nativecpu_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "device.h"
#include <cstdint>
#include <sycl/__spirv/spirv_ops.hpp>
#include <sycl/types.hpp>
#include <sycl/vector.hpp>

// including state definition from Native CPU UR adapter
#include "nativecpu_state.hpp"
Expand Down
1 change: 0 additions & 1 deletion sycl/include/sycl/aliases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#pragma once

#include <sycl/detail/defines_elementary.hpp> // for __SYCL2020_DEPRECATED
#include <sycl/half_type.hpp> // for half

#include <cstdint> // for uint8_t, int16_t, int32_t

Expand Down
17 changes: 2 additions & 15 deletions sycl/include/sycl/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@
#include <sycl/buffer.hpp> // for buffer_allocator
#include <sycl/context.hpp> // for context, get_na...
#include <sycl/detail/backend_traits.hpp> // for InteropFeatureS...
#include <sycl/detail/cl.h> // for _cl_event
#include <sycl/detail/defines_elementary.hpp> // for __SYCL_DEPRECATED
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
#include <sycl/detail/impl_utils.hpp> // for createSyclObjFr...
#include <sycl/device.hpp> // for device, get_native
#include <sycl/event.hpp> // for event, get_native
#include <sycl/exception.hpp> // for make_error_code
#include <sycl/feature_test.hpp> // for SYCL_BACKEND_OP...
#include <sycl/handler.hpp> // for buffer
#include <sycl/image.hpp> // for image, image_al...
#include <sycl/kernel.hpp> // for kernel, get_native
#include <sycl/kernel_bundle.hpp> // for kernel_bundle
#include <sycl/kernel_bundle_enums.hpp> // for bundle_state
#include <sycl/platform.hpp> // for platform, get_n...
#include <sycl/property_list.hpp> // for property_list
#include <sycl/queue.hpp> // for queue, get_native
#include <ur_api.h> // for ur_native_handle_t

Expand Down Expand Up @@ -60,13 +56,12 @@
namespace sycl {
inline namespace _V1 {

class property_list;

namespace detail {
// TODO each backend can have its own custom errc enumeration
// but the details for this are not fully specified yet
enum class backend_errc : unsigned int {};

// Convert from UR backend to SYCL backend enum
backend convertUrBackend(ur_platform_backend_t UrBackend);
} // namespace detail

template <backend Backend> class backend_traits {
Expand All @@ -78,14 +73,6 @@ template <backend Backend> class backend_traits {
using return_type = typename detail::BackendReturn<Backend, T>::type;
};

template <backend Backend, typename SyclType>
using backend_input_t =
typename backend_traits<Backend>::template input_type<SyclType>;

template <backend Backend, typename SyclType>
using backend_return_t =
typename backend_traits<Backend>::template return_type<SyclType>;

namespace detail {
template <backend Backend, typename DataT, int Dimensions, typename AllocatorT>
struct BufferInterop {
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/builtins_esimd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <sycl/detail/common.hpp>
#include <sycl/detail/generic_type_traits.hpp>
#include <sycl/ext/intel/esimd/detail/math_intrin.hpp>
#include <sycl/types.hpp>
#include <sycl/vector.hpp>

// TODO Decide whether to mark functions with this attribute.
#define __NOEXC /*noexcept*/
Expand Down
3 changes: 2 additions & 1 deletion sycl/include/sycl/builtins_utils_vec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#include <sycl/builtins_utils_scalar.hpp>

#include <sycl/detail/type_traits.hpp>
#include <sycl/detail/vector_convert.hpp>
#include <sycl/marray.hpp> // for marray
#include <sycl/types.hpp> // for vec
#include <sycl/vector.hpp> // for vec

namespace sycl {
inline namespace _V1 {
Expand Down
3 changes: 1 addition & 2 deletions sycl/include/sycl/detail/backend_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

#pragma once

#include <sycl/backend_types.hpp>

namespace sycl {
inline namespace _V1 {
enum class backend : char;
namespace detail {

template <backend Backend, typename SYCLObjectT> struct interop;
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/detail/device_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

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

Expand All @@ -18,6 +17,7 @@

namespace sycl {
inline namespace _V1 {
enum class backend : char;
namespace detail {

// ---------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/detail/image_accessor_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <sycl/image.hpp> // for image_channel_type
#include <sycl/range.hpp> // for range
#include <sycl/sampler.hpp> // for addressing_mode, coor...
#include <sycl/types.hpp> // for vec, operator*, round...
#include <sycl/vector.hpp> // for vec, operator*, round...

#include <cstdint> // for int32_t, uint16_t
#include <stddef.h> // for size_t
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/detail/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#pragma once

#include <sycl/backend_types.hpp>
#include <sycl/detail/export.hpp>
#include <sycl/detail/os_util.hpp>
#include <ur_api.h>
Expand Down Expand Up @@ -42,6 +41,7 @@ struct trace_event_data_t;
namespace sycl {
inline namespace _V1 {

enum class backend : char;
class context;

namespace detail {
Expand Down
37 changes: 37 additions & 0 deletions sycl/include/sycl/detail/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

#include <cstring>
#include <mutex>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

namespace sycl {
Expand Down Expand Up @@ -83,6 +86,40 @@ template <> struct ABINeutralT<std::vector<std::string>> {
};

template <typename T> using ABINeutralT_t = typename ABINeutralT<T>::type;

template <typename ParamT> auto convert_to_abi_neutral(ParamT &&Info) {
using ParamNoRef = std::remove_reference_t<ParamT>;
if constexpr (std::is_same_v<ParamNoRef, std::string>) {
return detail::string{Info};
} else if constexpr (std::is_same_v<ParamNoRef, std::vector<std::string>>) {
std::vector<detail::string> Res;
Res.reserve(Info.size());
for (std::string &Str : Info) {
Res.push_back(detail::string{Str});
}
return Res;
} else {
return std::forward<ParamT>(Info);
}
}

template <typename ParamT> auto convert_from_abi_neutral(ParamT &&Info) {
using ParamNoRef = std::remove_reference_t<ParamT>;
if constexpr (std::is_same_v<ParamNoRef, detail::string>) {
return Info.c_str();
} else if constexpr (std::is_same_v<ParamNoRef,
std::vector<detail::string>>) {
std::vector<std::string> Res;
Res.reserve(Info.size());
for (detail::string &Str : Info) {
Res.push_back(Str.c_str());
}
return Res;
} else {
return std::forward<ParamT>(Info);
}
}

} // namespace detail
} // namespace _V1
} // namespace sycl
Expand Down
8 changes: 5 additions & 3 deletions sycl/include/sycl/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

#include <sycl/aspects.hpp>
#include <sycl/backend_types.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/export.hpp>
Expand All @@ -21,9 +20,12 @@
#include <sycl/ext/oneapi/experimental/device_architecture.hpp>
#include <sycl/info/info_desc.hpp>
#include <sycl/kernel_bundle_enums.hpp>
#include <sycl/platform.hpp>
#include <ur_api.h>

#ifdef __SYCL_INTERNAL_API
#include <sycl/detail/cl.h>
#endif

#include <cstddef>
#include <memory>
#include <string>
Expand All @@ -35,7 +37,7 @@
namespace sycl {
inline namespace _V1 {
// Forward declarations
class device_selector;
class platform;
template <backend BackendName, class SyclObjectT>
auto get_native(const SyclObjectT &Obj)
-> backend_return_t<BackendName, SyclObjectT>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <sycl/ext/intel/esimd/common.hpp>
#include <sycl/ext/intel/esimd/detail/types.hpp>
#include <sycl/ext/intel/esimd/detail/util.hpp>
#include <sycl/types.hpp>
#include <sycl/vector.hpp>

#include <cstdint>

Expand Down
1 change: 1 addition & 0 deletions sycl/include/sycl/ext/intel/fpga_device_selector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <sycl/device.hpp>
#include <sycl/device_selector.hpp>
#include <sycl/platform.hpp>

#include <string>
#include <string_view>
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/ext/oneapi/backend/hip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <sycl/backend.hpp>
#include <sycl/backend_types.hpp>
#include <sycl/detail/backend_traits_hip.hpp>

namespace sycl {
Expand Down
3 changes: 1 addition & 2 deletions sycl/include/sycl/ext/oneapi/backend/level_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#pragma once

#include <sycl/async_handler.hpp> // for async_han...
#include <sycl/backend.hpp> // for backend_i...
#include <sycl/backend_types.hpp> // for backend
#include <sycl/backend.hpp> // for backend
#include <sycl/buffer.hpp> // for buffer_al...
#include <sycl/buffer.hpp> // for buffer
#include <sycl/context.hpp> // for context
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/ext/oneapi/dot_product.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma once

#include <sycl/detail/defines_elementary.hpp>
#include <sycl/types.hpp>
#include <sycl/vector.hpp>

namespace sycl {
inline namespace _V1 {
Expand Down
7 changes: 4 additions & 3 deletions sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

#pragma once

#include <sycl/builtins.hpp> // for ceil, cos, exp, exp10, exp2
#include <sycl/builtins_utils_vec.hpp> // For simplify_if_swizzle, is_swizzle
#include <sycl/detail/memcpy.hpp> // sycl::detail::memcpy
#include <sycl/builtins.hpp> // for ceil, cos, exp, exp10, exp2
#include <sycl/builtins_utils_vec.hpp> // For simplify_if_swizzle, is_swizzle
#include <sycl/detail/memcpy.hpp> // sycl::detail::memcpy
#include <sycl/detail/vector_convert.hpp>
#include <sycl/ext/oneapi/bfloat16.hpp> // for bfloat16, bfloat16ToBits
#include <sycl/marray.hpp> // for marray

Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/ext/oneapi/experimental/builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <sycl/detail/generic_type_traits.hpp> // for is_svgenfloath, is_sv...
#include <sycl/detail/memcpy.hpp> // detail::memcpy
#include <sycl/marray.hpp> // for marray
#include <sycl/types.hpp> // for vec
#include <sycl/vector.hpp> // for vec

#include <cstring> // for size_t
#include <stdio.h> // for printf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#define SYCL_EXT_ONEAPI_CUDA_TEX_CACHE_READ 1

#include <sycl/types.hpp>
#include <sycl/vector.hpp>

#if defined(_WIN32) || defined(_WIN64)
#define ATTRIBUTE_EXT_VEC_TYPE(N) __declspec(ext_vector_type(N))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <sycl/ext/oneapi/sub_group_mask.hpp> // for sub_group_mask
#include <sycl/marray.hpp> // for marray
#include <sycl/types.hpp> // for vec
#include <sycl/vector.hpp> // for vec

#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/ext/oneapi/experimental/prefetch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <sycl/__spirv/spirv_ops.hpp>
#include <sycl/ext/oneapi/properties/properties.hpp>
#include <sycl/types.hpp>
#include <sycl/vector.hpp>

namespace sycl {
inline namespace _V1 {
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/ext/oneapi/sub_group_mask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <sycl/feature_test.hpp> // for SYCL_EXT_ONEAPI_SUB_GROUP_MASK
#include <sycl/id.hpp> // for id
#include <sycl/marray.hpp> // for marray
#include <sycl/types.hpp> // for vec
#include <sycl/vector.hpp> // for vec

#include <assert.h> // for assert
#include <climits> // for CHAR_BIT
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/group_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <sycl/known_identity.hpp> // for known_identity_v
#include <sycl/nd_item.hpp> // for nd_item
#include <sycl/range.hpp> // for range
#include <sycl/types.hpp> // for vec
#include <sycl/vector.hpp> // for vec

#ifdef __SYCL_DEVICE_ONLY__
#include <sycl/ext/oneapi/functional.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <sycl/property_list.hpp> // for property_list
#include <sycl/range.hpp> // for range, rangeTo...
#include <sycl/sampler.hpp> // for image_sampler
#include <sycl/types.hpp> // for vec
#include <sycl/vector.hpp> // for vec
#include <ur_api.h> // for ur_native_hand...

#include <cstddef> // for size_t, nullptr_t
Expand Down
6 changes: 1 addition & 5 deletions sycl/include/sycl/interop_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
#include <sycl/access/access.hpp> // for target, mode, place...
#include <sycl/accessor.hpp> // for AccessorBaseHost
#include <sycl/backend_types.hpp> // for backend, backend_re...
#include <sycl/context.hpp> // for context
#include <sycl/buffer.hpp> // for buffer
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
#include <sycl/detail/helpers.hpp> // for context_impl
#include <sycl/detail/impl_utils.hpp> // for getSyclObjImpl
#include <sycl/device.hpp> // for device, device_impl
#include <sycl/exception.hpp>
#include <sycl/exception_list.hpp> // for queue_impl
#include <sycl/ext/oneapi/accessor_property_list.hpp> // for accessor_property_list
#include <sycl/image.hpp> // for image
#include <sycl/properties/buffer_properties.hpp> // for buffer
#include <ur_api.h> // for ur_mem_handle_t, ur...

#include <memory> // for shared_ptr
Expand Down
14 changes: 6 additions & 8 deletions sycl/include/sycl/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@

#pragma once

#include <cstddef> // for size_t
#include <memory> // for shared_ptr, hash, opera...
#include <sycl/backend_types.hpp> // for backend, backend_return_t
#include <sycl/context.hpp> // for context
#include <sycl/detail/defines_elementary.hpp> // for __SYCL2020_DEPRECATED
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
#include <sycl/detail/info_desc_helpers.hpp> // for is_kernel_device_specif...
#include <sycl/detail/owner_less_base.hpp> // for OwnerLessBase
#include <sycl/detail/string.hpp>
#include <sycl/detail/string_view.hpp>
#include <sycl/detail/util.hpp>
#include <sycl/device.hpp> // for device
#include <sycl/kernel_bundle_enums.hpp> // for bundle_state
#include <sycl/range.hpp> // for range
#include <ur_api.h> // for ur_native_handle_t
#include <variant> // for hash

#include <cstddef> // for size_t
#include <memory> // for shared_ptr, hash, opera...
#include <variant> // for hash

namespace sycl {
inline namespace _V1 {
// Forward declaration
class context;
class queue;
class device;
template <int Dimensions> class range;
template <backend Backend> class backend_traits;
template <bundle_state State> class kernel_bundle;
template <backend BackendName, class SyclObjectT>
Expand Down
Loading
Loading