Skip to content

Commit 63998b1

Browse files
authored
[SYCL] Switch build of SYCL runtime to C++17 (#3447)
* switch build of SYCL RT and SYCL unit tests to use C++17 standard; * fix build issues exposed by build with VS 2017 compiler; * workaround problem in googletest (google/googletest#1616); * update documentation accordingly.
1 parent 7d3e836 commit 63998b1

File tree

7 files changed

+13
-19
lines changed

7 files changed

+13
-19
lines changed

sycl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
22

33
project(sycl-solution)
44
# Requirements
5-
set(CMAKE_CXX_STANDARD 14)
5+
set(CMAKE_CXX_STANDARD 17)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77
set(CMAKE_CXX_EXTENSIONS OFF)
88
option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF)

sycl/cmake/modules/AddSYCLUnitTest.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ macro(add_sycl_unittest test_dirname link_variant)
4545
-Wno-inconsistent-missing-override
4646
)
4747
endif()
48-
# LLVM gtest uses LLVM utilities that require C++-14
49-
# CXX_STANDARD_REQUIRED makes CXX_STANDARD a hard requirement.
50-
set_target_properties(${test_dirname}
51-
PROPERTIES
52-
CXX_STANDARD 14
53-
CXX_STANDARD_REQUIRED ON
54-
)
5548
endmacro()
5649

5750
macro(add_sycl_unittest_with_device test_dirname link_variant)

sycl/doc/GetStartedGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ which contains all the symbols required.
639639
640640
## C++ standard
641641
642-
* DPC++ runtime and headers require C++14 at least.
642+
* DPC++ runtime and headers require C++17 at least.
643643
* DPC++ compiler builds apps as C++17 apps by default. Higher versions of
644644
standard are supported as well.
645645

sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,18 @@ class accessor_property_list : protected sycl::detail::PropertyListBase {
193193

194194
#if __cplusplus >= 201703L
195195
template <typename T>
196-
static constexpr
197-
typename detail::enable_if_t<is_compile_time_property<T>::value, bool>
198-
has_property() {
196+
constexpr std::enable_if_t<is_compile_time_property<T>::value, bool>
197+
has_property() const {
199198
return ContainsPropertyInstance<PropertyContainer<PropsT...>,
200199
T::template instance>::value;
201200
}
202201

203202
template <typename T,
204-
typename = typename detail::enable_if_t<
205-
is_compile_time_property<T>::value && has_property<T>()>>
206-
static constexpr auto get_property() {
203+
typename = std::enable_if_t<
204+
is_compile_time_property<T>::value &&
205+
ContainsPropertyInstance<PropertyContainer<PropsT...>,
206+
T::template instance>::value>>
207+
constexpr auto get_property() const {
207208
return typename GetCompileTimePropertyHelper<PropertyContainer<PropsT...>,
208209
T::template instance>::type{};
209210
}

sycl/include/CL/sycl/properties/accessor_properties.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct buffer_location {
5252
} // namespace property
5353
#if __cplusplus > 201402L
5454
template <int A>
55-
inline constexpr property::buffer_location::instance<A> buffer_location;
55+
inline constexpr property::buffer_location::instance<A> buffer_location{};
5656
#endif
5757
} // namespace INTEL
5858
namespace ONEAPI {

sycl/unittests/scheduler/NoHostUnifiedMemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ TEST_F(SchedulerTest, NoHostUnifiedMemory) {
170170
// Memory movement operations should be omitted for discard access modes.
171171
detail::Command *MemoryMove =
172172
MS.insertMemoryMove(Record, &DiscardReq, DefaultHostQueue);
173-
EXPECT_EQ(MemoryMove, nullptr);
173+
EXPECT_TRUE(MemoryMove == nullptr);
174174
// The current context for the record should still be modified.
175175
EXPECT_EQ(Record->MCurContext, DefaultHostQueue->getContextImplPtr());
176176
}

sycl/unittests/scheduler/WaitAfterCleanup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ using namespace cl::sycl;
1414
TEST_F(SchedulerTest, WaitAfterCleanup) {
1515
auto Cmd = new MockCommand(detail::getSyclObjImpl(MQueue));
1616
auto Event = Cmd->getEvent();
17-
ASSERT_NE(Event, nullptr) << "Command must have an event\n";
17+
ASSERT_FALSE(Event == nullptr) << "Command must have an event\n";
1818

1919
detail::Scheduler::getInstance().waitForEvent(Event);
2020
ASSERT_EQ(Event->getCommand(), Cmd)
2121
<< "Command should not have been cleaned up yet\n";
2222

2323
detail::Scheduler::getInstance().cleanupFinishedCommands(Event);
24-
ASSERT_EQ(Event->getCommand(), nullptr)
24+
ASSERT_TRUE(Event->getCommand() == nullptr)
2525
<< "Command should have been cleaned up\n";
2626

2727
detail::Scheduler::getInstance().waitForEvent(Event);

0 commit comments

Comments
 (0)