Skip to content

[SYCL] Switch build of SYCL runtime to C++17 #3447

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 8 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)

project(sycl-solution)
# Requirements
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF)
Expand Down
2 changes: 1 addition & 1 deletion sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ which contains all the symbols required.

## C++ standard

* DPC++ runtime and headers require C++14 at least.
* DPC++ runtime and headers require C++17 at least.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladimirlaz, could you confirm that there are no runtime library ABI breaking changes requiring us to increment the library version, please?

Copy link
Contributor

@v-klochkov v-klochkov Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea for a separate PR: It would be good to have a static_assert somewhere in SYCL headers that would check that C++ is 17 or higher.
It would give user-friendly message instead of some unexpected compilation errors due to various reasons (using 'if constexpr', auto in template args, inline vars, etc. with C++14 option)

* DPC++ compiler builds apps as C++17 apps by default. Higher versions of
standard are supported as well.

Expand Down
13 changes: 7 additions & 6 deletions sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,18 @@ class accessor_property_list : protected sycl::detail::PropertyListBase {

#if __cplusplus >= 201703L
template <typename T>
static constexpr
typename detail::enable_if_t<is_compile_time_property<T>::value, bool>
has_property() {
constexpr std::enable_if_t<is_compile_time_property<T>::value, bool>
has_property() const {
return ContainsPropertyInstance<PropertyContainer<PropsT...>,
T::template instance>::value;
}

template <typename T,
typename = typename detail::enable_if_t<
is_compile_time_property<T>::value && has_property<T>()>>
static constexpr auto get_property() {
typename = std::enable_if_t<
is_compile_time_property<T>::value &&
ContainsPropertyInstance<PropertyContainer<PropsT...>,
T::template instance>::value>>
constexpr auto get_property() const {
return typename GetCompileTimePropertyHelper<PropertyContainer<PropsT...>,
T::template instance>::type{};
}
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/properties/accessor_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct buffer_location {
} // namespace property
#if __cplusplus > 201402L
template <int A>
inline constexpr property::buffer_location::instance<A> buffer_location;
inline constexpr property::buffer_location::instance<A> buffer_location{};
#endif
} // namespace INTEL
namespace ONEAPI {
Expand Down