Skip to content

[NFC][SYCL] Remove checks for C++17 #7687

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

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions sycl/include/sycl/access/access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,12 @@ template <access_mode mode, target trgt> struct mode_target_tag_t {
explicit mode_target_tag_t() = default;
};

#if __cplusplus >= 201703L

inline constexpr mode_tag_t<access_mode::read> read_only{};
inline constexpr mode_tag_t<access_mode::read_write> read_write{};
inline constexpr mode_tag_t<access_mode::write> write_only{};
inline constexpr mode_target_tag_t<access_mode::read, target::constant_buffer>
read_constant{};

#else

namespace {

constexpr const auto &read_only =
sycl::detail::InlineVariableHelper<mode_tag_t<access_mode::read>>::value;
constexpr const auto &read_write = sycl::detail::InlineVariableHelper<
mode_tag_t<access_mode::read_write>>::value;
constexpr const auto &write_only =
sycl::detail::InlineVariableHelper<mode_tag_t<access_mode::write>>::value;
constexpr const auto &read_constant = sycl::detail::InlineVariableHelper<
mode_target_tag_t<access_mode::read, target::constant_buffer>>::value;

} // namespace

#endif

namespace detail {

constexpr bool isTargetHostAccess(access::target T) {
Expand Down
76 changes: 0 additions & 76 deletions sycl/include/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,7 @@ struct AccHostDataT {
// To ensure loop unrolling is done when processing dimensions.
template <size_t... Inds, class F>
void dim_loop_impl(std::integer_sequence<size_t, Inds...>, F &&f) {
#if __cplusplus >= 201703L
(f(Inds), ...);
#else
(void)std::initializer_list<int>{((void)(f(Inds)), 0)...};
#endif
}

template <size_t count, class F> void dim_loop(F &&f) {
Expand Down Expand Up @@ -375,8 +371,6 @@ class accessor_common {
};
};

#if __cplusplus >= 201703L

template <typename MayBeTag1, typename MayBeTag2>
constexpr access::mode deduceAccessMode() {
// property_list = {} is not properly detected by deduction guide,
Expand Down Expand Up @@ -424,8 +418,6 @@ constexpr access::target deduceAccessTarget(access::target defaultTarget) {
return defaultTarget;
}

#endif

template <int Dims> class LocalAccessorBaseDevice {
public:
LocalAccessorBaseDevice(sycl::range<Dims> Size)
Expand Down Expand Up @@ -1038,14 +1030,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
// We've already adjusted for the accessor's offset in the __init, so
// don't include it here in case of device.
#ifndef __SYCL_DEVICE_ONLY__
#if __cplusplus >= 201703L
if constexpr (!(PropertyListT::template has_property<
sycl::ext::oneapi::property::no_offset>())) {
Result += getOffset()[I];
}
#else
Result += getOffset()[I];
#endif
#endif // __SYCL_DEVICE_ONLY__
});

Expand Down Expand Up @@ -1101,14 +1089,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
range<AdjustedDim> MemRange, id<AdjustedDim> Offset) {
MData = Ptr;
detail::dim_loop<AdjustedDim>([&, this](size_t I) {
#if __cplusplus >= 201703L
if constexpr (!(PropertyListT::template has_property<
sycl::ext::oneapi::property::no_offset>())) {
getOffset()[I] = Offset[I];
}
#else
getOffset()[I] = Offset[I];
#endif
getAccessRange()[I] = AccessRange[I];
getMemoryRange()[I] = MemRange[I];
});
Expand Down Expand Up @@ -1461,8 +1445,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
}
#endif

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename TagT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1491,7 +1473,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
: accessor(BufferRef, PropertyList, CodeLoc) {
adjustAccPropsInBuf(BufferRef);
}
#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1559,8 +1540,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
}
#endif

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename TagT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1591,8 +1570,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
adjustAccPropsInBuf(BufferRef);
}

#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<
detail::IsRunTimePropertyListT<PropertyListT>::value &&
Expand All @@ -1619,8 +1596,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
const detail::code_location CodeLoc = detail::code_location::current())
: accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename TagT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1650,7 +1625,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
: accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
adjustAccPropsInBuf(BufferRef);
}
#endif

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

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename TagT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1713,7 +1685,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
CodeLoc) {
adjustAccPropsInBuf(BufferRef);
}
#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1798,8 +1769,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
}
#endif

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename TagT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1829,7 +1798,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
: accessor(BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
adjustAccPropsInBuf(BufferRef);
}
#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1913,8 +1881,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
}
#endif

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename TagT,
typename = std::enable_if_t<
Expand Down Expand Up @@ -1947,7 +1913,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
PropertyList, CodeLoc) {
adjustAccPropsInBuf(BufferRef);
}
#endif

template <typename... NewPropsT>
accessor(
Expand Down Expand Up @@ -2001,12 +1966,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :

template <int Dims = Dimensions, typename = std::enable_if_t<(Dims > 0)>>
id<Dimensions> get_offset() const {
#if __cplusplus >= 201703L
static_assert(
!(PropertyListT::template has_property<
sycl::ext::oneapi::property::no_offset>()),
"Accessor has no_offset property, get_offset() can not be used");
#endif
return detail::convertToArrayOfN<Dimensions, 0>(getOffset());
}

Expand Down Expand Up @@ -2124,7 +2087,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
#endif
}

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

bool operator==(const accessor &Rhs) const { return impl == Rhs.impl; }
bool operator!=(const accessor &Rhs) const { return !(*this == Rhs); }
Expand Down Expand Up @@ -2177,14 +2138,10 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
size_t TotalOffset = 0;
detail::dim_loop<Dimensions>([&, this](size_t I) {
TotalOffset = TotalOffset * impl.MemRange[I];
#if __cplusplus >= 201703L
if constexpr (!(PropertyListT::template has_property<
sycl::ext::oneapi::property::no_offset>())) {
TotalOffset += impl.Offset[I];
}
#else
TotalOffset += impl.Offset[I];
#endif
});

return TotalOffset;
Expand Down Expand Up @@ -2222,7 +2179,6 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
}
}

#if __cplusplus >= 201703L
template <typename BufT, typename... PropTypes>
void adjustAccPropsInBuf(BufT &Buffer) {
if constexpr (PropertyListT::template has_property<
Expand All @@ -2242,11 +2198,8 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
Buffer.deleteAccProps(
sycl::detail::PropWithDataKind::AccPropBufferLocation);
}
#endif
};

#if __cplusplus >= 201703L

template <typename DataT, int Dimensions, typename AllocatorT>
accessor(buffer<DataT, Dimensions, AllocatorT>)
-> accessor<DataT, Dimensions, access::mode::read_write, target::device,
Expand Down Expand Up @@ -2399,7 +2352,6 @@ accessor(buffer<DataT, Dimensions, AllocatorT>, handler &, Type1, Type2, Type3,
detail::deduceAccessTarget<Type3, Type4>(target::device),
access::placeholder::false_t,
ext::oneapi::accessor_property_list<PropsT...>>;
#endif

/// Local accessor
///
Expand Down Expand Up @@ -3003,8 +2955,6 @@ class __SYCL_EBO host_accessor
const detail::code_location CodeLoc = detail::code_location::current())
: AccessorT(BufferRef, PropertyList, CodeLoc) {}

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3013,7 +2963,6 @@ class __SYCL_EBO host_accessor
const detail::code_location CodeLoc = detail::code_location::current())
: host_accessor(BufferRef, PropertyList, CodeLoc) {}

#endif

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

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3034,8 +2981,6 @@ class __SYCL_EBO host_accessor
const detail::code_location CodeLoc = detail::code_location::current())
: host_accessor(BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {}

#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3044,8 +2989,6 @@ class __SYCL_EBO host_accessor
const detail::code_location CodeLoc = detail::code_location::current())
: AccessorT(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3055,8 +2998,6 @@ class __SYCL_EBO host_accessor
const detail::code_location CodeLoc = detail::code_location::current())
: host_accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}

#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3067,8 +3008,6 @@ class __SYCL_EBO host_accessor
: AccessorT(BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
CodeLoc) {}

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3079,8 +3018,6 @@ class __SYCL_EBO host_accessor
: host_accessor(BufferRef, CommandGroupHandler, AccessRange, {},
PropertyList, CodeLoc) {}

#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3091,8 +3028,6 @@ class __SYCL_EBO host_accessor
: AccessorT(BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
}

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3103,8 +3038,6 @@ class __SYCL_EBO host_accessor
: host_accessor(BufferRef, AccessRange, AccessOffset, PropertyList,
CodeLoc) {}

#endif

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3115,8 +3048,6 @@ class __SYCL_EBO host_accessor
: AccessorT(BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
PropertyList, CodeLoc) {}

#if __cplusplus >= 201703L

template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
typename = std::enable_if_t<IsSameAsBuffer<T, Dims>::value>>
host_accessor(
Expand All @@ -3127,12 +3058,8 @@ class __SYCL_EBO host_accessor
const detail::code_location CodeLoc = detail::code_location::current())
: host_accessor(BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
PropertyList, CodeLoc) {}

#endif
};

#if __cplusplus >= 201703L

template <typename DataT, int Dimensions, typename AllocatorT>
host_accessor(buffer<DataT, Dimensions, AllocatorT>)
-> host_accessor<DataT, Dimensions, access::mode::read_write>;
Expand Down Expand Up @@ -3165,9 +3092,6 @@ template <typename DataT, int Dimensions, typename AllocatorT, typename Type1,
host_accessor(buffer<DataT, Dimensions, AllocatorT>, Type1, Type2, Type3, Type4,
Type5) -> host_accessor<DataT, Dimensions,
detail::deduceAccessMode<Type4, Type5>()>;

#endif

} // __SYCL_INLINE_VER_NAMESPACE(_V1)
} // namespace sycl

Expand Down
Loading