From 556b15dd1a32e60ea816bdd14cb2b6153d4721d7 Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Tue, 30 Mar 2021 21:43:09 +0300 Subject: [PATCH 1/7] [SYCL] Uplift SYCL runtime standard to C++17 --- sycl/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index 53bec90a35bb6..63ed5aa1582cd 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -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) From 13e0333cafa1c73b508ba1d0418968c5ae56cddf Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Wed, 31 Mar 2021 12:22:56 +0300 Subject: [PATCH 2/7] Fix Windows build --- sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp b/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp index b83e4ed43d316..9b782de6a5b6f 100644 --- a/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp +++ b/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp @@ -193,7 +193,7 @@ class accessor_property_list : protected sycl::detail::PropertyListBase { #if __cplusplus >= 201703L template - static constexpr + constexpr typename detail::enable_if_t::value, bool> has_property() { return ContainsPropertyInstance, @@ -202,8 +202,10 @@ class accessor_property_list : protected sycl::detail::PropertyListBase { template ::value && has_property()>> - static constexpr auto get_property() { + is_compile_time_property::value && + ContainsPropertyInstance, + T::template instance>::value>> + constexpr auto get_property() { return typename GetCompileTimePropertyHelper, T::template instance>::type{}; } From da50eb65c302c61b84366b3fbeb370de18ed28e2 Mon Sep 17 00:00:00 2001 From: Vyacheslav N Klochkov Date: Thu, 1 Apr 2021 16:15:50 -0700 Subject: [PATCH 3/7] Yet another attempt to fix build on Windows Signed-off-by: Vyacheslav N Klochkov --- sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp b/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp index 9b782de6a5b6f..4688cb47f1d38 100644 --- a/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp +++ b/sycl/include/CL/sycl/ONEAPI/accessor_property_list.hpp @@ -193,19 +193,18 @@ class accessor_property_list : protected sycl::detail::PropertyListBase { #if __cplusplus >= 201703L template - constexpr - typename detail::enable_if_t::value, bool> - has_property() { + constexpr std::enable_if_t::value, bool> + has_property() const { return ContainsPropertyInstance, T::template instance>::value; } template ::value && ContainsPropertyInstance, T::template instance>::value>> - constexpr auto get_property() { + constexpr auto get_property() const { return typename GetCompileTimePropertyHelper, T::template instance>::type{}; } From 50982f44d2cb37b95f81ff4ac875f9ad2088684f Mon Sep 17 00:00:00 2001 From: Vyacheslav N Klochkov Date: Thu, 1 Apr 2021 21:55:19 -0700 Subject: [PATCH 4/7] Fix for an error caused by initialization of buffer_location Signed-off-by: Vyacheslav N Klochkov --- sycl/include/CL/sycl/properties/accessor_properties.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/include/CL/sycl/properties/accessor_properties.hpp b/sycl/include/CL/sycl/properties/accessor_properties.hpp index 45e5075b45ae4..d43ee0b621c9f 100644 --- a/sycl/include/CL/sycl/properties/accessor_properties.hpp +++ b/sycl/include/CL/sycl/properties/accessor_properties.hpp @@ -52,7 +52,7 @@ struct buffer_location { } // namespace property #if __cplusplus > 201402L template -inline constexpr property::buffer_location::instance buffer_location; +inline constexpr property::buffer_location::instance buffer_location{}; #endif } // namespace INTEL namespace ONEAPI { From f2c4ed29225eabe9f0be93abacb9a82125e120cd Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Mon, 5 Apr 2021 21:54:09 +0300 Subject: [PATCH 5/7] Update document --- sycl/doc/GetStartedGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index 3dc35d6f18783..123bccf2dd236 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -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. * DPC++ compiler is building apps as C++17 apps by default. ## Known Issues and Limitations From b9f1fa4f0ac697261fb44770997e3f459d39ea58 Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Fri, 9 Apr 2021 21:13:49 +0300 Subject: [PATCH 6/7] Use C++17 for building SYCLUnit tests --- sycl/cmake/modules/AddSYCLUnitTest.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sycl/cmake/modules/AddSYCLUnitTest.cmake b/sycl/cmake/modules/AddSYCLUnitTest.cmake index 37989d16f0ab3..2d50567d2ee0b 100644 --- a/sycl/cmake/modules/AddSYCLUnitTest.cmake +++ b/sycl/cmake/modules/AddSYCLUnitTest.cmake @@ -45,13 +45,6 @@ macro(add_sycl_unittest test_dirname link_variant) -Wno-inconsistent-missing-override ) endif() - # LLVM gtest uses LLVM utilities that require C++-14 - # CXX_STANDARD_REQUIRED makes CXX_STANDARD a hard requirement. - set_target_properties(${test_dirname} - PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON - ) endmacro() macro(add_sycl_unittest_with_device test_dirname link_variant) From ea2cd1d7b6f9ac181f3f641fb2068ca7d66ff5df Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Mon, 12 Apr 2021 17:38:42 +0300 Subject: [PATCH 7/7] Workaround problem in googletest Issue: https://github.com/google/googletest/issues/1616 --- sycl/unittests/scheduler/NoHostUnifiedMemory.cpp | 2 +- sycl/unittests/scheduler/WaitAfterCleanup.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp b/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp index 418d6ca6bf5e1..9dc561295eb86 100644 --- a/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp +++ b/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp @@ -170,7 +170,7 @@ TEST_F(SchedulerTest, NoHostUnifiedMemory) { // Memory movement operations should be omitted for discard access modes. detail::Command *MemoryMove = MS.insertMemoryMove(Record, &DiscardReq, DefaultHostQueue); - EXPECT_EQ(MemoryMove, nullptr); + EXPECT_TRUE(MemoryMove == nullptr); // The current context for the record should still be modified. EXPECT_EQ(Record->MCurContext, DefaultHostQueue->getContextImplPtr()); } diff --git a/sycl/unittests/scheduler/WaitAfterCleanup.cpp b/sycl/unittests/scheduler/WaitAfterCleanup.cpp index 009be9b66258e..1f21dae6ff597 100644 --- a/sycl/unittests/scheduler/WaitAfterCleanup.cpp +++ b/sycl/unittests/scheduler/WaitAfterCleanup.cpp @@ -14,14 +14,14 @@ using namespace cl::sycl; TEST_F(SchedulerTest, WaitAfterCleanup) { auto Cmd = new MockCommand(detail::getSyclObjImpl(MQueue)); auto Event = Cmd->getEvent(); - ASSERT_NE(Event, nullptr) << "Command must have an event\n"; + ASSERT_FALSE(Event == nullptr) << "Command must have an event\n"; detail::Scheduler::getInstance().waitForEvent(Event); ASSERT_EQ(Event->getCommand(), Cmd) << "Command should not have been cleaned up yet\n"; detail::Scheduler::getInstance().cleanupFinishedCommands(Event); - ASSERT_EQ(Event->getCommand(), nullptr) + ASSERT_TRUE(Event->getCommand() == nullptr) << "Command should have been cleaned up\n"; detail::Scheduler::getInstance().waitForEvent(Event);