From 9efd43a7eea97161da755a2cebd8cb732e412e07 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 1 Oct 2024 21:39:55 +0200 Subject: [PATCH] [SYCL][NFC] Public headers cleanup (#15536) The main change is that specializations of `UrInfoCode` were moved into library, because they are not used in public headers. Also removed some of unnecessary `#include`s here and there. --- sycl/include/sycl/context.hpp | 1 - .../include/sycl/detail/info_desc_helpers.hpp | 29 +------ sycl/include/sycl/exception.hpp | 1 - sycl/include/sycl/handler.hpp | 1 + sycl/include/sycl/stream.hpp | 1 - sycl/source/detail/context_info.hpp | 1 + sycl/source/detail/device_impl.cpp | 1 + sycl/source/detail/device_info.hpp | 1 + sycl/source/detail/event_info.hpp | 1 + sycl/source/detail/kernel_info.hpp | 1 + sycl/source/detail/platform_impl.cpp | 1 + sycl/source/detail/platform_impl.hpp | 1 + sycl/source/detail/platform_info.hpp | 1 + .../program_manager/program_manager.cpp | 1 + sycl/source/detail/ur_info_code.hpp | 77 +++++++++++++++++++ sycl/source/handler.cpp | 1 + sycl/test/include_deps/sycl_accessor.hpp.cpp | 5 -- sycl/test/include_deps/sycl_buffer.hpp.cpp | 5 -- .../include_deps/sycl_detail_core.hpp.cpp | 10 +-- 19 files changed, 95 insertions(+), 45 deletions(-) create mode 100644 sycl/source/detail/ur_info_code.hpp diff --git a/sycl/include/sycl/context.hpp b/sycl/include/sycl/context.hpp index e517f6c432478..3e113b588c124 100644 --- a/sycl/include/sycl/context.hpp +++ b/sycl/include/sycl/context.hpp @@ -12,7 +12,6 @@ #include // for backend, backend_return_t #include // for __SYCL2020_DEPRECATED #include // for __SYCL_EXPORT -#include // for context_impl #include // for is_context_info_desc #include // for OwnerLessBase #include // for platform diff --git a/sycl/include/sycl/detail/info_desc_helpers.hpp b/sycl/include/sycl/detail/info_desc_helpers.hpp index d3b4bfd977139..60ad8bb007cc3 100644 --- a/sycl/include/sycl/detail/info_desc_helpers.hpp +++ b/sycl/include/sycl/detail/info_desc_helpers.hpp @@ -8,8 +8,6 @@ #pragma once -#include - #include // for true_type // FIXME: .def files included to this file use all sorts of SYCL objects like @@ -22,8 +20,6 @@ namespace sycl { inline namespace _V1 { namespace detail { -template struct PiInfoCode; -template struct UrInfoCode; template struct is_platform_info_desc : std::false_type {}; template struct is_context_info_desc : std::false_type {}; template struct is_device_info_desc : std::false_type {}; @@ -47,10 +43,6 @@ template struct is_backend_info_desc : std::false_type {}; // Similar approach to limit valid get_backend_info template argument #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ - template <> struct UrInfoCode { \ - static constexpr ur_##DescType##_info_t value = \ - static_cast(UrCode); \ - }; \ template <> \ struct is_##DescType##_info_desc : std::true_type { \ using return_type = info::DescType::Desc::return_type; \ @@ -63,9 +55,6 @@ template struct is_backend_info_desc : std::false_type {}; #undef __SYCL_PARAM_TRAITS_SPEC #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ - template <> struct UrInfoCode { \ - static constexpr ur_profiling_info_t value = UrCode; \ - }; \ template <> \ struct is_##DescType##_info_desc : std::true_type { \ using return_type = info::DescType::Desc::return_type; \ @@ -92,25 +81,14 @@ struct IsKernelInfo : std::true_type {}; #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ - template <> struct UrInfoCode { \ - static constexpr typename std::conditional< \ - IsSubGroupInfo::value, \ - ur_kernel_sub_group_info_t, \ - std::conditional::value, \ - ur_kernel_info_t, \ - ur_kernel_group_info_t>::type>::type value = UrCode; \ - }; \ template <> \ struct is_##DescType##_info_desc : std::true_type { \ using return_type = info::DescType::Desc::return_type; \ }; #include #undef __SYCL_PARAM_TRAITS_SPEC + #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ - template <> struct UrInfoCode { \ - static constexpr ur_device_info_t value = \ - static_cast(UrCode); \ - }; \ template <> \ struct is_##DescType##_info_desc : std::true_type { \ using return_type = info::DescType::Desc::return_type; \ @@ -122,11 +100,8 @@ struct IsKernelInfo #undef __SYCL_PARAM_TRAITS_SPEC #undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED + #define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, UrCode) \ - template <> struct UrInfoCode { \ - static constexpr ur_device_info_t value = \ - static_cast(UrCode); \ - }; \ template <> \ struct is_##DescType##_info_desc \ : std::true_type { \ diff --git a/sycl/include/sycl/exception.hpp b/sycl/include/sycl/exception.hpp index 34d58aac9a6fe..95f49a1d5b1b1 100644 --- a/sycl/include/sycl/exception.hpp +++ b/sycl/include/sycl/exception.hpp @@ -10,7 +10,6 @@ // 4.9.2 Exception Class Interface -#include // for cl_int #include // for __SYCL2020_DEPRECATED #include // for __SYCL_EXPORT #include diff --git a/sycl/include/sycl/handler.hpp b/sycl/include/sycl/handler.hpp index a61c1dfff8e28..272cd96ad2e3e 100644 --- a/sycl/include/sycl/handler.hpp +++ b/sycl/include/sycl/handler.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/sycl/include/sycl/stream.hpp b/sycl/include/sycl/stream.hpp index f3c70098a3b18..2b18a8ef4b423 100644 --- a/sycl/include/sycl/stream.hpp +++ b/sycl/include/sycl/stream.hpp @@ -17,7 +17,6 @@ #include // for __SYCL_SPECIAL_CLASS, __S... #include // for __SYCL2020_DEPRECATED #include // for __SYCL_EXPORT -#include // for id, range #include // for OwnerLessBase #include // for bfloat16 #include // for group diff --git a/sycl/source/detail/context_info.hpp b/sycl/source/detail/context_info.hpp index 3d86e7bb54a79..65a123b796029 100644 --- a/sycl/source/detail/context_info.hpp +++ b/sycl/source/detail/context_info.hpp @@ -9,6 +9,7 @@ #pragma once #include +#include #include #include #include diff --git a/sycl/source/detail/device_impl.cpp b/sycl/source/detail/device_impl.cpp index b184c30cad6fd..92b5e01fe00a6 100644 --- a/sycl/source/detail/device_impl.cpp +++ b/sycl/source/detail/device_impl.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index b84bfff755abb..c5570ad5059f9 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/sycl/source/detail/event_info.hpp b/sycl/source/detail/event_info.hpp index ed47e101e08de..e660d5f33c796 100644 --- a/sycl/source/detail/event_info.hpp +++ b/sycl/source/detail/event_info.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/sycl/source/detail/kernel_info.hpp b/sycl/source/detail/kernel_info.hpp index c40af1a728ccd..4ec11d32fd4ac 100644 --- a/sycl/source/detail/kernel_info.hpp +++ b/sycl/source/detail/kernel_info.hpp @@ -9,6 +9,7 @@ #pragma once #include +#include #include #include #include diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index 652e47a5be997..71c61c82c00f4 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index 130018417eebf..bfca613b56827 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/sycl/source/detail/platform_info.hpp b/sycl/source/detail/platform_info.hpp index 429f2024e2bed..55bec44897751 100644 --- a/sycl/source/detail/platform_info.hpp +++ b/sycl/source/detail/platform_info.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 2fa9e75be6f0c..1953855127803 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/sycl/source/detail/ur_info_code.hpp b/sycl/source/detail/ur_info_code.hpp new file mode 100644 index 0000000000000..863515ec469da --- /dev/null +++ b/sycl/source/detail/ur_info_code.hpp @@ -0,0 +1,77 @@ +//==--------------------------- ur_info_code.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 { +inline namespace _V1 { +namespace detail { +template struct UrInfoCode; + +#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ + template <> struct UrInfoCode { \ + static constexpr ur_##DescType##_info_t value = \ + static_cast(UrCode); \ + }; +#include +#include +#include +#include +#include +#undef __SYCL_PARAM_TRAITS_SPEC + +#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ + template <> struct UrInfoCode { \ + static constexpr ur_profiling_info_t value = UrCode; \ + }; +#include +#undef __SYCL_PARAM_TRAITS_SPEC + +#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ + template <> struct UrInfoCode { \ + static constexpr typename std::conditional< \ + IsSubGroupInfo::value, \ + ur_kernel_sub_group_info_t, \ + std::conditional::value, \ + ur_kernel_info_t, \ + ur_kernel_group_info_t>::type>::type value = UrCode; \ + }; +#include +#undef __SYCL_PARAM_TRAITS_SPEC + +#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \ + template <> struct UrInfoCode { \ + static constexpr ur_device_info_t value = \ + static_cast(UrCode); \ + }; +#define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \ + __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) + +#include + +#undef __SYCL_PARAM_TRAITS_SPEC +#undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED + +#define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, UrCode) \ + template <> struct UrInfoCode { \ + static constexpr ur_device_info_t value = \ + static_cast(UrCode); \ + }; + +#include +#include +#include +#undef __SYCL_PARAM_TRAITS_SPEC + +} // namespace detail +} // namespace _V1 +} // namespace sycl diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 3cf52728f4d06..980eb8ee52301 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/sycl/test/include_deps/sycl_accessor.hpp.cpp b/sycl/test/include_deps/sycl_accessor.hpp.cpp index ae896a3987e85..842688bae3018 100644 --- a/sycl/test/include_deps/sycl_accessor.hpp.cpp +++ b/sycl/test/include_deps/sycl_accessor.hpp.cpp @@ -59,11 +59,6 @@ // CHECK-NEXT: backend_types.hpp // CHECK-NEXT: detail/array.hpp // CHECK-NEXT: exception.hpp -// CHECK-NEXT: detail/cl.h -// CHECK-NEXT: CL/cl.h -// CHECK-NEXT: CL/cl_version.h -// CHECK-NEXT: CL/cl_platform.h -// CHECK-NEXT: CL/cl_ext.h // CHECK-NEXT: detail/string.hpp // CHECK-NEXT: ur_api.h // CHECK-NEXT: detail/common.hpp diff --git a/sycl/test/include_deps/sycl_buffer.hpp.cpp b/sycl/test/include_deps/sycl_buffer.hpp.cpp index 7002e5b07c60f..cb193129254b5 100644 --- a/sycl/test/include_deps/sycl_buffer.hpp.cpp +++ b/sycl/test/include_deps/sycl_buffer.hpp.cpp @@ -14,11 +14,6 @@ // CHECK-NEXT: backend_types.hpp // CHECK-NEXT: detail/array.hpp // CHECK-NEXT: exception.hpp -// CHECK-NEXT: detail/cl.h -// CHECK-NEXT: CL/cl.h -// CHECK-NEXT: CL/cl_version.h -// CHECK-NEXT: CL/cl_platform.h -// CHECK-NEXT: CL/cl_ext.h // CHECK-NEXT: detail/string.hpp // CHECK-NEXT: ur_api.h // CHECK-NEXT: detail/common.hpp diff --git a/sycl/test/include_deps/sycl_detail_core.hpp.cpp b/sycl/test/include_deps/sycl_detail_core.hpp.cpp index 6ed467969333d..d2bf55f3c2169 100644 --- a/sycl/test/include_deps/sycl_detail_core.hpp.cpp +++ b/sycl/test/include_deps/sycl_detail_core.hpp.cpp @@ -60,11 +60,6 @@ // CHECK-NEXT: backend_types.hpp // CHECK-NEXT: detail/array.hpp // CHECK-NEXT: exception.hpp -// CHECK-NEXT: detail/cl.h -// CHECK-NEXT: CL/cl.h -// CHECK-NEXT: CL/cl_version.h -// CHECK-NEXT: CL/cl_platform.h -// CHECK-NEXT: CL/cl_ext.h // CHECK-NEXT: detail/string.hpp // CHECK-NEXT: ur_api.h // CHECK-NEXT: detail/common.hpp @@ -143,6 +138,11 @@ // CHECK-NEXT: ext/oneapi/properties/properties.hpp // CHECK-NEXT: ext/oneapi/experimental/graph.hpp // CHECK-NEXT: handler.hpp +// CHECK-NEXT: detail/cl.h +// CHECK-NEXT: CL/cl.h +// CHECK-NEXT: CL/cl_version.h +// CHECK-NEXT: CL/cl_platform.h +// CHECK-NEXT: CL/cl_ext.h // CHECK-NEXT: detail/reduction_forward.hpp // CHECK-NEXT: detail/ur.hpp // CHECK-NEXT: ur_api_funcs.def