Skip to content

Commit f13f10c

Browse files
[SYCL][NFC] Cleanup public headers (#18974)
There are helper function templates which are only used within `source/` directory, so they were moved in there to reduce the size and complexity of our public headers. Some legacy dead code have been removed along the way as well.
1 parent ef2179b commit f13f10c

File tree

5 files changed

+57
-82
lines changed

5 files changed

+57
-82
lines changed

sycl/include/sycl/detail/info_desc_helpers.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,6 @@ template <typename T> struct is_backend_info_desc : std::false_type {};
6262
#include <sycl/info/event_profiling_traits.def>
6363
#undef __SYCL_PARAM_TRAITS_SPEC
6464

65-
template <typename Param> struct IsSubGroupInfo : std::false_type {};
66-
template <>
67-
struct IsSubGroupInfo<info::kernel_device_specific::max_num_sub_groups>
68-
: std::true_type {};
69-
template <>
70-
struct IsSubGroupInfo<info::kernel_device_specific::compile_num_sub_groups>
71-
: std::true_type {};
72-
template <>
73-
struct IsSubGroupInfo<info::kernel_device_specific::max_sub_group_size>
74-
: std::true_type {};
75-
template <>
76-
struct IsSubGroupInfo<info::kernel_device_specific::compile_sub_group_size>
77-
: std::true_type {};
78-
template <typename Param> struct IsKernelInfo : std::false_type {};
79-
template <>
80-
struct IsKernelInfo<info::kernel_device_specific::ext_codeplay_num_regs>
81-
: std::true_type {};
82-
8365
#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \
8466
template <> \
8567
struct is_##DescType##_info_desc<info::DescType::Desc> : std::true_type { \

sycl/include/sycl/device.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,6 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
208208
/// Queries this SYCL device for information requested by the template
209209
/// parameter param
210210
///
211-
/// Specializations of info::param_traits must be defined in accordance with
212-
/// the info parameters in Table 4.20 of SYCL Spec to facilitate returning the
213-
/// type associated with the param parameter.
214-
///
215211
/// \return device info of type described in Table 4.20.
216212
template <typename Param>
217213
typename detail::is_device_info_desc<Param>::return_type get_info() const {

sycl/include/sycl/info/info_desc.hpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,6 @@ enum class partition_property : intptr_t {
7474
ext_intel_partition_by_cslice = UR_DEVICE_PARTITION_BY_CSLICE
7575
};
7676

77-
// FIXME: maybe this should live elsewhere, maybe it should be implemented
78-
// differently
79-
inline partition_property
80-
ConvertPartitionProperty(const ur_device_partition_t &Partition) {
81-
switch (Partition) {
82-
case UR_DEVICE_PARTITION_EQUALLY:
83-
return partition_property::partition_equally;
84-
case UR_DEVICE_PARTITION_BY_COUNTS:
85-
return partition_property::partition_by_counts;
86-
case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
87-
return partition_property::partition_by_affinity_domain;
88-
case UR_DEVICE_PARTITION_BY_CSLICE:
89-
return partition_property::ext_intel_partition_by_cslice;
90-
default:
91-
return partition_property::no_partition;
92-
}
93-
}
94-
9577
enum class partition_affinity_domain : intptr_t {
9678
not_applicable = 0,
9779
numa = UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA,
@@ -102,24 +84,6 @@ enum class partition_affinity_domain : intptr_t {
10284
next_partitionable = UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE
10385
};
10486

105-
inline partition_affinity_domain
106-
ConvertAffinityDomain(const ur_device_affinity_domain_flags_t Domain) {
107-
switch (Domain) {
108-
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA:
109-
return partition_affinity_domain::numa;
110-
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE:
111-
return partition_affinity_domain::L1_cache;
112-
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE:
113-
return partition_affinity_domain::L2_cache;
114-
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE:
115-
return partition_affinity_domain::L3_cache;
116-
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE:
117-
return partition_affinity_domain::L4_cache;
118-
default:
119-
return info::partition_affinity_domain::not_applicable;
120-
}
121-
}
122-
12387
enum class local_mem_type : int { none, local, global };
12488

12589
enum class fp_config : uint32_t {
@@ -141,12 +105,6 @@ enum class execution_capability : unsigned int {
141105
};
142106

143107
namespace device {
144-
// TODO implement the following SYCL 2020 device info descriptors:
145-
// atomic_fence_order_capabilities, atomic_fence_scope_capabilities, aspects,
146-
// il_version.
147-
148-
struct atomic_fence_order_capabilities;
149-
struct atomic_fence_scope_capabilities;
150108

151109
#define __SYCL_PARAM_TRAITS_DEPRECATED(Desc, Message) \
152110
struct __SYCL2020_DEPRECATED(Message) Desc;
@@ -203,17 +161,6 @@ namespace event_profiling {
203161
} // namespace event_profiling
204162
#undef __SYCL_PARAM_TRAITS_SPEC
205163

206-
// Provide an alias to the return type for each of the info parameters
207-
template <typename T, T param> class param_traits {};
208-
209-
template <typename T, T param> struct compatibility_param_traits {};
210-
211-
#define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \
212-
template <> class param_traits<param_type, param_type::param> { \
213-
public: \
214-
using return_type = ret_type; \
215-
};
216-
#undef __SYCL_PARAM_TRAITS_SPEC
217164
} // namespace info
218165

219166
#define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, UrCode) \

sycl/source/detail/device_impl.hpp

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <sycl/detail/ur.hpp>
1616
#include <sycl/ext/oneapi/experimental/device_architecture.hpp>
1717
#include <sycl/ext/oneapi/experimental/forward_progress.hpp>
18+
#include <sycl/info/info_desc.hpp>
1819
#include <sycl/kernel_bundle.hpp>
1920
#include <sycl/platform.hpp>
2021

@@ -28,6 +29,40 @@ inline namespace _V1 {
2829

2930
namespace detail {
3031

32+
inline info::partition_property
33+
ConvertPartitionProperty(const ur_device_partition_t &Partition) {
34+
switch (Partition) {
35+
case UR_DEVICE_PARTITION_EQUALLY:
36+
return info::partition_property::partition_equally;
37+
case UR_DEVICE_PARTITION_BY_COUNTS:
38+
return info::partition_property::partition_by_counts;
39+
case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
40+
return info::partition_property::partition_by_affinity_domain;
41+
case UR_DEVICE_PARTITION_BY_CSLICE:
42+
return info::partition_property::ext_intel_partition_by_cslice;
43+
default:
44+
return info::partition_property::no_partition;
45+
}
46+
}
47+
48+
inline info::partition_affinity_domain
49+
ConvertAffinityDomain(const ur_device_affinity_domain_flags_t Domain) {
50+
switch (Domain) {
51+
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA:
52+
return info::partition_affinity_domain::numa;
53+
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE:
54+
return info::partition_affinity_domain::L1_cache;
55+
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE:
56+
return info::partition_affinity_domain::L2_cache;
57+
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE:
58+
return info::partition_affinity_domain::L3_cache;
59+
case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE:
60+
return info::partition_affinity_domain::L4_cache;
61+
default:
62+
return info::partition_affinity_domain::not_applicable;
63+
}
64+
}
65+
3166
// Note that UR's enums have weird *_FORCE_UINT32 values, we ignore them in the
3267
// callers. But we also can't write a fully-covered switch without mentioning it
3368
// there, which wouldn't make any sense. As such, ensure that "real" values
@@ -503,10 +538,6 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
503538
/// Queries this SYCL device for information requested by the template
504539
/// parameter param
505540
///
506-
/// Specializations of info::param_traits must be defined in accordance
507-
/// with the info parameters in Table 4.20 of SYCL Spec to facilitate
508-
/// returning the type associated with the param parameter.
509-
///
510541
/// \return device info of type described in Table 4.20.
511542

512543
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
@@ -728,7 +759,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
728759
for (auto &entry : ur_dev_partitions) {
729760
// OpenCL extensions may have partition_properties that
730761
// are not yet defined for SYCL (eg. CL_DEVICE_PARTITION_BY_NAMES_INTEL)
731-
info::partition_property pp(info::ConvertPartitionProperty(entry));
762+
info::partition_property pp(detail::ConvertPartitionProperty(entry));
732763
switch (pp) {
733764
case info::partition_property::no_partition:
734765
case info::partition_property::partition_equally:
@@ -767,7 +798,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
767798
return info::partition_property::no_partition;
768799
// The old UR implementation also just checked the first element, is that
769800
// correct?
770-
return info::ConvertPartitionProperty(PartitionProperties[0].type);
801+
return detail::ConvertPartitionProperty(PartitionProperties[0].type);
771802
}
772803
CASE(info::device::partition_type_affinity_domain) {
773804
std::vector<ur_device_partition_property_t> PartitionProperties =
@@ -776,7 +807,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
776807
return info::partition_affinity_domain::not_applicable;
777808
for (const auto &PartitionProp : PartitionProperties) {
778809
if (PartitionProp.type == UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN)
779-
return info::ConvertAffinityDomain(
810+
return detail::ConvertAffinityDomain(
780811
PartitionProp.value.affinity_domain);
781812
}
782813

sycl/source/detail/kernel_info.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ namespace sycl {
2222
inline namespace _V1 {
2323
namespace detail {
2424

25+
template <typename Param> struct IsSubGroupInfo : std::false_type {};
26+
template <>
27+
struct IsSubGroupInfo<info::kernel_device_specific::max_num_sub_groups>
28+
: std::true_type {};
29+
template <>
30+
struct IsSubGroupInfo<info::kernel_device_specific::compile_num_sub_groups>
31+
: std::true_type {};
32+
template <>
33+
struct IsSubGroupInfo<info::kernel_device_specific::max_sub_group_size>
34+
: std::true_type {};
35+
template <>
36+
struct IsSubGroupInfo<info::kernel_device_specific::compile_sub_group_size>
37+
: std::true_type {};
38+
39+
template <typename Param> struct IsKernelInfo : std::false_type {};
40+
template <>
41+
struct IsKernelInfo<info::kernel_device_specific::ext_codeplay_num_regs>
42+
: std::true_type {};
43+
2544
template <typename Param>
2645
typename std::enable_if<
2746
std::is_same<typename Param::return_type, std::string>::value,

0 commit comments

Comments
 (0)