Skip to content

Commit c103a6a

Browse files
[NFC][SYCL] Remove checks for C++17 (#7687)
This has been the minimally supported version for some time and we have a static_assert to guard for it. No need to conditionally disable parts of the codebase.
1 parent a534b94 commit c103a6a

32 files changed

+31
-220
lines changed

sycl/include/sycl/access/access.hpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,12 @@ template <access_mode mode, target trgt> struct mode_target_tag_t {
6969
explicit mode_target_tag_t() = default;
7070
};
7171

72-
#if __cplusplus >= 201703L
73-
7472
inline constexpr mode_tag_t<access_mode::read> read_only{};
7573
inline constexpr mode_tag_t<access_mode::read_write> read_write{};
7674
inline constexpr mode_tag_t<access_mode::write> write_only{};
7775
inline constexpr mode_target_tag_t<access_mode::read, target::constant_buffer>
7876
read_constant{};
7977

80-
#else
81-
82-
namespace {
83-
84-
constexpr const auto &read_only =
85-
sycl::detail::InlineVariableHelper<mode_tag_t<access_mode::read>>::value;
86-
constexpr const auto &read_write = sycl::detail::InlineVariableHelper<
87-
mode_tag_t<access_mode::read_write>>::value;
88-
constexpr const auto &write_only =
89-
sycl::detail::InlineVariableHelper<mode_tag_t<access_mode::write>>::value;
90-
constexpr const auto &read_constant = sycl::detail::InlineVariableHelper<
91-
mode_target_tag_t<access_mode::read, target::constant_buffer>>::value;
92-
93-
} // namespace
94-
95-
#endif
96-
9778
namespace detail {
9879

9980
constexpr bool isTargetHostAccess(access::target T) {

sycl/include/sycl/accessor.hpp

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,7 @@ struct AccHostDataT {
250250
// To ensure loop unrolling is done when processing dimensions.
251251
template <size_t... Inds, class F>
252252
void dim_loop_impl(std::integer_sequence<size_t, Inds...>, F &&f) {
253-
#if __cplusplus >= 201703L
254253
(f(Inds), ...);
255-
#else
256-
(void)std::initializer_list<int>{((void)(f(Inds)), 0)...};
257-
#endif
258254
}
259255

260256
template <size_t count, class F> void dim_loop(F &&f) {
@@ -375,8 +371,6 @@ class accessor_common {
375371
};
376372
};
377373

378-
#if __cplusplus >= 201703L
379-
380374
template <typename MayBeTag1, typename MayBeTag2>
381375
constexpr access::mode deduceAccessMode() {
382376
// property_list = {} is not properly detected by deduction guide,
@@ -424,8 +418,6 @@ constexpr access::target deduceAccessTarget(access::target defaultTarget) {
424418
return defaultTarget;
425419
}
426420

427-
#endif
428-
429421
template <int Dims> class LocalAccessorBaseDevice {
430422
public:
431423
LocalAccessorBaseDevice(sycl::range<Dims> Size)
@@ -1038,14 +1030,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
10381030
// We've already adjusted for the accessor's offset in the __init, so
10391031
// don't include it here in case of device.
10401032
#ifndef __SYCL_DEVICE_ONLY__
1041-
#if __cplusplus >= 201703L
10421033
if constexpr (!(PropertyListT::template has_property<
10431034
sycl::ext::oneapi::property::no_offset>())) {
10441035
Result += getOffset()[I];
10451036
}
1046-
#else
1047-
Result += getOffset()[I];
1048-
#endif
10491037
#endif // __SYCL_DEVICE_ONLY__
10501038
});
10511039

@@ -1101,14 +1089,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
11011089
range<AdjustedDim> MemRange, id<AdjustedDim> Offset) {
11021090
MData = Ptr;
11031091
detail::dim_loop<AdjustedDim>([&, this](size_t I) {
1104-
#if __cplusplus >= 201703L
11051092
if constexpr (!(PropertyListT::template has_property<
11061093
sycl::ext::oneapi::property::no_offset>())) {
11071094
getOffset()[I] = Offset[I];
11081095
}
1109-
#else
1110-
getOffset()[I] = Offset[I];
1111-
#endif
11121096
getAccessRange()[I] = AccessRange[I];
11131097
getMemoryRange()[I] = MemRange[I];
11141098
});
@@ -1461,8 +1445,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
14611445
}
14621446
#endif
14631447

1464-
#if __cplusplus >= 201703L
1465-
14661448
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
14671449
typename TagT,
14681450
typename = std::enable_if_t<
@@ -1491,7 +1473,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
14911473
: accessor(BufferRef, PropertyList, CodeLoc) {
14921474
adjustAccPropsInBuf(BufferRef);
14931475
}
1494-
#endif
14951476

14961477
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
14971478
typename = std::enable_if_t<
@@ -1559,8 +1540,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
15591540
}
15601541
#endif
15611542

1562-
#if __cplusplus >= 201703L
1563-
15641543
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
15651544
typename TagT,
15661545
typename = std::enable_if_t<
@@ -1591,8 +1570,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
15911570
adjustAccPropsInBuf(BufferRef);
15921571
}
15931572

1594-
#endif
1595-
15961573
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
15971574
typename = std::enable_if_t<
15981575
detail::IsRunTimePropertyListT<PropertyListT>::value &&
@@ -1619,8 +1596,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
16191596
const detail::code_location CodeLoc = detail::code_location::current())
16201597
: accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}
16211598

1622-
#if __cplusplus >= 201703L
1623-
16241599
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
16251600
typename TagT,
16261601
typename = std::enable_if_t<
@@ -1650,7 +1625,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
16501625
: accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
16511626
adjustAccPropsInBuf(BufferRef);
16521627
}
1653-
#endif
16541628

16551629
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
16561630
typename = std::enable_if_t<
@@ -1679,8 +1653,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
16791653
: accessor(BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
16801654
CodeLoc) {}
16811655

1682-
#if __cplusplus >= 201703L
1683-
16841656
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
16851657
typename TagT,
16861658
typename = std::enable_if_t<
@@ -1713,7 +1685,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
17131685
CodeLoc) {
17141686
adjustAccPropsInBuf(BufferRef);
17151687
}
1716-
#endif
17171688

17181689
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
17191690
typename = std::enable_if_t<
@@ -1798,8 +1769,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
17981769
}
17991770
#endif
18001771

1801-
#if __cplusplus >= 201703L
1802-
18031772
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
18041773
typename TagT,
18051774
typename = std::enable_if_t<
@@ -1829,7 +1798,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
18291798
: accessor(BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
18301799
adjustAccPropsInBuf(BufferRef);
18311800
}
1832-
#endif
18331801

18341802
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
18351803
typename = std::enable_if_t<
@@ -1913,8 +1881,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
19131881
}
19141882
#endif
19151883

1916-
#if __cplusplus >= 201703L
1917-
19181884
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
19191885
typename TagT,
19201886
typename = std::enable_if_t<
@@ -1947,7 +1913,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
19471913
PropertyList, CodeLoc) {
19481914
adjustAccPropsInBuf(BufferRef);
19491915
}
1950-
#endif
19511916

19521917
template <typename... NewPropsT>
19531918
accessor(
@@ -2001,12 +1966,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
20011966

20021967
template <int Dims = Dimensions, typename = std::enable_if_t<(Dims > 0)>>
20031968
id<Dimensions> get_offset() const {
2004-
#if __cplusplus >= 201703L
20051969
static_assert(
20061970
!(PropertyListT::template has_property<
20071971
sycl::ext::oneapi::property::no_offset>()),
20081972
"Accessor has no_offset property, get_offset() can not be used");
2009-
#endif
20101973
return detail::convertToArrayOfN<Dimensions, 0>(getOffset());
20111974
}
20121975

@@ -2124,7 +2087,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
21242087
#endif
21252088
}
21262089

2127-
#if __cplusplus >= 201703L
21282090
template <typename Property>
21292091
static constexpr bool has_property(
21302092
typename std::enable_if_t<
@@ -2138,7 +2100,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
21382100
ext::oneapi::is_compile_time_property<Property>::value> * = 0) {
21392101
return PropertyListT::template get_property<Property>();
21402102
}
2141-
#endif
21422103

21432104
bool operator==(const accessor &Rhs) const { return impl == Rhs.impl; }
21442105
bool operator!=(const accessor &Rhs) const { return !(*this == Rhs); }
@@ -2177,14 +2138,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
21772138
size_t TotalOffset = 0;
21782139
detail::dim_loop<Dimensions>([&, this](size_t I) {
21792140
TotalOffset = TotalOffset * impl.MemRange[I];
2180-
#if __cplusplus >= 201703L
21812141
if constexpr (!(PropertyListT::template has_property<
21822142
sycl::ext::oneapi::property::no_offset>())) {
21832143
TotalOffset += impl.Offset[I];
21842144
}
2185-
#else
2186-
TotalOffset += impl.Offset[I];
2187-
#endif
21882145
});
21892146

21902147
return TotalOffset;
@@ -2222,7 +2179,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
22222179
}
22232180
}
22242181

2225-
#if __cplusplus >= 201703L
22262182
template <typename BufT, typename... PropTypes>
22272183
void adjustAccPropsInBuf(BufT &Buffer) {
22282184
if constexpr (PropertyListT::template has_property<
@@ -2242,11 +2198,8 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
22422198
Buffer.deleteAccProps(
22432199
sycl::detail::PropWithDataKind::AccPropBufferLocation);
22442200
}
2245-
#endif
22462201
};
22472202

2248-
#if __cplusplus >= 201703L
2249-
22502203
template <typename DataT, int Dimensions, typename AllocatorT>
22512204
accessor(buffer<DataT, Dimensions, AllocatorT>)
22522205
-> accessor<DataT, Dimensions, access::mode::read_write, target::device,
@@ -2399,7 +2352,6 @@ accessor(buffer<DataT, Dimensions, AllocatorT>, handler &, Type1, Type2, Type3,
23992352
detail::deduceAccessTarget<Type3, Type4>(target::device),
24002353
access::placeholder::false_t,
24012354
ext::oneapi::accessor_property_list<PropsT...>>;
2402-
#endif
24032355

24042356
/// Local accessor
24052357
///
@@ -3003,8 +2955,6 @@ class __SYCL_EBO host_accessor
30032955
const detail::code_location CodeLoc = detail::code_location::current())
30042956
: AccessorT(BufferRef, PropertyList, CodeLoc) {}
30052957

3006-
#if __cplusplus >= 201703L
3007-
30082958
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30092959
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30102960
host_accessor(
@@ -3013,7 +2963,6 @@ class __SYCL_EBO host_accessor
30132963
const detail::code_location CodeLoc = detail::code_location::current())
30142964
: host_accessor(BufferRef, PropertyList, CodeLoc) {}
30152965

3016-
#endif
30172966

30182967
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30192968
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
@@ -3023,8 +2972,6 @@ class __SYCL_EBO host_accessor
30232972
const detail::code_location CodeLoc = detail::code_location::current())
30242973
: AccessorT(BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {}
30252974

3026-
#if __cplusplus >= 201703L
3027-
30282975
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30292976
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30302977
host_accessor(
@@ -3034,8 +2981,6 @@ class __SYCL_EBO host_accessor
30342981
const detail::code_location CodeLoc = detail::code_location::current())
30352982
: host_accessor(BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {}
30362983

3037-
#endif
3038-
30392984
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30402985
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30412986
host_accessor(
@@ -3044,8 +2989,6 @@ class __SYCL_EBO host_accessor
30442989
const detail::code_location CodeLoc = detail::code_location::current())
30452990
: AccessorT(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}
30462991

3047-
#if __cplusplus >= 201703L
3048-
30492992
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30502993
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30512994
host_accessor(
@@ -3055,8 +2998,6 @@ class __SYCL_EBO host_accessor
30552998
const detail::code_location CodeLoc = detail::code_location::current())
30562999
: host_accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}
30573000

3058-
#endif
3059-
30603001
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30613002
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30623003
host_accessor(
@@ -3067,8 +3008,6 @@ class __SYCL_EBO host_accessor
30673008
: AccessorT(BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
30683009
CodeLoc) {}
30693010

3070-
#if __cplusplus >= 201703L
3071-
30723011
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30733012
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30743013
host_accessor(
@@ -3079,8 +3018,6 @@ class __SYCL_EBO host_accessor
30793018
: host_accessor(BufferRef, CommandGroupHandler, AccessRange, {},
30803019
PropertyList, CodeLoc) {}
30813020

3082-
#endif
3083-
30843021
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30853022
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30863023
host_accessor(
@@ -3091,8 +3028,6 @@ class __SYCL_EBO host_accessor
30913028
: AccessorT(BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
30923029
}
30933030

3094-
#if __cplusplus >= 201703L
3095-
30963031
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
30973032
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
30983033
host_accessor(
@@ -3103,8 +3038,6 @@ class __SYCL_EBO host_accessor
31033038
: host_accessor(BufferRef, AccessRange, AccessOffset, PropertyList,
31043039
CodeLoc) {}
31053040

3106-
#endif
3107-
31083041
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
31093042
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
31103043
host_accessor(
@@ -3115,8 +3048,6 @@ class __SYCL_EBO host_accessor
31153048
: AccessorT(BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
31163049
PropertyList, CodeLoc) {}
31173050

3118-
#if __cplusplus >= 201703L
3119-
31203051
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
31213052
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
31223053
host_accessor(
@@ -3127,12 +3058,8 @@ class __SYCL_EBO host_accessor
31273058
const detail::code_location CodeLoc = detail::code_location::current())
31283059
: host_accessor(BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
31293060
PropertyList, CodeLoc) {}
3130-
3131-
#endif
31323061
};
31333062

3134-
#if __cplusplus >= 201703L
3135-
31363063
template <typename DataT, int Dimensions, typename AllocatorT>
31373064
host_accessor(buffer<DataT, Dimensions, AllocatorT>)
31383065
-> host_accessor<DataT, Dimensions, access::mode::read_write>;
@@ -3165,9 +3092,6 @@ template <typename DataT, int Dimensions, typename AllocatorT, typename Type1,
31653092
host_accessor(buffer<DataT, Dimensions, AllocatorT>, Type1, Type2, Type3, Type4,
31663093
Type5) -> host_accessor<DataT, Dimensions,
31673094
detail::deduceAccessMode<Type4, Type5>()>;
3168-
3169-
#endif
3170-
31713095
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
31723096
} // namespace sycl
31733097

0 commit comments

Comments
 (0)