From 4c27e44830822eb85d69c7752c8f69b4a544fdcf Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Mon, 26 Feb 2024 12:26:45 -0800 Subject: [PATCH 1/3] [NFC][SYCL] Use std::make_unique instead of make_unique_ptr --- sycl/include/sycl/buffer.hpp | 58 +++++++++-------- .../sycl/detail/defines_elementary.hpp | 23 +++++++ sycl/include/sycl/ext/intel/fpga_utils.hpp | 1 - sycl/include/sycl/image.hpp | 65 +++++++++---------- sycl/include/sycl/stl.hpp | 48 -------------- .../program_manager/program_manager.cpp | 4 +- .../scheduler/NoHostUnifiedMemory.cpp | 2 +- 7 files changed, 88 insertions(+), 113 deletions(-) delete mode 100644 sycl/include/sycl/stl.hpp diff --git a/sycl/include/sycl/buffer.hpp b/sycl/include/sycl/buffer.hpp index 0ef5494088e3a..3fcd0a387992c 100644 --- a/sycl/include/sycl/buffer.hpp +++ b/sycl/include/sycl/buffer.hpp @@ -29,7 +29,6 @@ #include // for id #include // for property_list #include // for range, rangeTo... -#include // for make_unique_ptr #include // for is_device_copyable #include // for size_t, nullptr_t @@ -203,7 +202,7 @@ class buffer : public detail::buffer_plain, const property_list &propList = {}, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain(bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>()), Range(bufferRange) { buffer_plain::constructorNotification( @@ -216,7 +215,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain( bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator)), Range(bufferRange) { buffer_plain::constructorNotification( @@ -229,7 +228,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain(hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>()), Range(bufferRange) { buffer_plain::constructorNotification( @@ -242,7 +241,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain( hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator)), Range(bufferRange) { buffer_plain::constructorNotification( @@ -257,7 +256,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain(hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>()), Range(bufferRange) { buffer_plain::constructorNotification( @@ -272,7 +271,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain( hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator)), Range(bufferRange) { buffer_plain::constructorNotification( @@ -286,7 +285,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain( hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator), std::is_const::value), Range(bufferRange) { @@ -302,7 +301,7 @@ class buffer : public detail::buffer_plain, const detail::code_location CodeLoc = detail::code_location::current()) : buffer_plain( hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator), std::is_const::value), Range(bufferRange) { @@ -316,10 +315,11 @@ class buffer : public detail::buffer_plain, const range &bufferRange, const property_list &propList = {}, const detail::code_location CodeLoc = detail::code_location::current()) - : buffer_plain( - hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>(), - std::is_const::value), + : buffer_plain(hostData, bufferRange.size() * sizeof(T), alignof(T), + propList, + std::make_unique< + detail::SYCLMemObjAllocatorHolder>(), + std::is_const::value), Range(bufferRange) { buffer_plain::constructorNotification( CodeLoc, (void *)impl.get(), (void *)hostData.get(), @@ -331,10 +331,11 @@ class buffer : public detail::buffer_plain, const range &bufferRange, const property_list &propList = {}, const detail::code_location CodeLoc = detail::code_location::current()) - : buffer_plain( - hostData, bufferRange.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>(), - std::is_const::value), + : buffer_plain(hostData, bufferRange.size() * sizeof(T), alignof(T), + propList, + std::make_unique< + detail::SYCLMemObjAllocatorHolder>(), + std::is_const::value), Range(bufferRange) { buffer_plain::constructorNotification( CodeLoc, (void *)impl.get(), (void *)hostData.get(), @@ -364,7 +365,7 @@ class buffer : public detail::buffer_plain, static_cast(ToPtr)); }, std::distance(first, last) * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator), detail::iterator_to_const_type_t::value), Range(range<1>(std::distance(first, last))) { @@ -396,7 +397,8 @@ class buffer : public detail::buffer_plain, static_cast(ToPtr)); }, std::distance(first, last) * sizeof(T), alignof(T), propList, - make_unique_ptr>(), + std::make_unique< + detail::SYCLMemObjAllocatorHolder>(), detail::iterator_to_const_type_t::value), Range(range<1>(std::distance(first, last))) { size_t r[3] = {Range[0], 0, 0}; @@ -415,7 +417,7 @@ class buffer : public detail::buffer_plain, : buffer_plain( container.data(), container.size() * sizeof(T), alignof(T), propList, - make_unique_ptr>( + std::make_unique>( allocator)), Range(range<1>(container.size())) { size_t r[3] = {Range[0], 0, 0}; @@ -746,10 +748,10 @@ class buffer : public detail::buffer_plain, buffer(pi_native_handle MemObject, const context &SyclContext, bool OwnNativeHandle, event AvailableEvent = {}, const detail::code_location CodeLoc = detail::code_location::current()) - : buffer_plain( - MemObject, SyclContext, - make_unique_ptr>(), - OwnNativeHandle, std::move(AvailableEvent)), + : buffer_plain(MemObject, SyclContext, + std::make_unique< + detail::SYCLMemObjAllocatorHolder>(), + OwnNativeHandle, std::move(AvailableEvent)), Range{0} { Range[0] = buffer_plain::getSize() / sizeof(T); @@ -846,14 +848,14 @@ template buffer(Container &, AllocatorT, const property_list & = {}) -> buffer; template -buffer(Container &, const property_list & = {}) - -> buffer; +buffer(Container &, + const property_list & = {}) -> buffer; template buffer(const T *, const range &, AllocatorT, const property_list & = {}) -> buffer; template -buffer(const T *, const range &, const property_list & = {}) - -> buffer; +buffer(const T *, const range &, + const property_list & = {}) -> buffer; #endif // __cpp_deduction_guides } // namespace _V1 diff --git a/sycl/include/sycl/detail/defines_elementary.hpp b/sycl/include/sycl/detail/defines_elementary.hpp index 999a103c00f97..eb01a111d2614 100644 --- a/sycl/include/sycl/detail/defines_elementary.hpp +++ b/sycl/include/sycl/detail/defines_elementary.hpp @@ -80,3 +80,26 @@ static_assert(__cplusplus >= 201703L, "DPCPP does not support C++ version earlier than C++17."); + +#if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) +// SYCL library is designed such a way that STL objects cross DLL boundary, +// which is guaranteed to work properly only when the application uses the same +// C++ runtime that SYCL library uses. +// The appplications using sycl.dll must be linked with dynamic/release C++ MSVC +// runtime, i.e. be compiled with /MD switch. Similarly, the applications using +// sycld.dll must be linked with dynamic/debug C++ runtime and be compiled with +// /MDd switch. +// Compiler automatically adds /MD or /MDd when -fsycl switch is used. +// The options /MD and /MDd that make the code to use dynamic runtime also +// define the _DLL macro. +#if defined(_MSC_VER) +#pragma message( \ + "SYCL library is designed to work safely with dynamic C++ runtime." \ + "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \ + "or -fsycl switch to set C++ runtime automatically.") +#else +#warning "SYCL library is designed to work safely with dynamic C++ runtime."\ + "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, "\ + "or -fsycl switch to set C++ runtime automatically." +#endif +#endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) diff --git a/sycl/include/sycl/ext/intel/fpga_utils.hpp b/sycl/include/sycl/ext/intel/fpga_utils.hpp index 56b9c8fdcf251..dcb1169289a14 100644 --- a/sycl/include/sycl/ext/intel/fpga_utils.hpp +++ b/sycl/include/sycl/ext/intel/fpga_utils.hpp @@ -10,7 +10,6 @@ #include #include -#include namespace sycl { inline namespace _V1 { diff --git a/sycl/include/sycl/image.hpp b/sycl/include/sycl/image.hpp index 20c11b892d1f5..1239f65cdd259 100644 --- a/sycl/include/sycl/image.hpp +++ b/sycl/include/sycl/image.hpp @@ -30,7 +30,6 @@ #include // for property_list #include // for range, rangeTo... #include // for image_sampler -#include // for make_unique_ptr #include // for vec #include // for size_t, nullptr_t @@ -450,7 +449,7 @@ class image : public detail::unsampled_image_common { image(image_channel_order Order, image_channel_type Type, const range &Range, const property_list &PropList = {}) : common_base(Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) {} @@ -459,7 +458,7 @@ class image : public detail::unsampled_image_common { const property_list &PropList = {}) : common_base( Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) {} @@ -471,7 +470,7 @@ class image : public detail::unsampled_image_common { const property_list &PropList = {}) : common_base(Order, Type, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) {} @@ -484,7 +483,7 @@ class image : public detail::unsampled_image_common { : common_base( Order, Type, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) {} @@ -492,7 +491,7 @@ class image : public detail::unsampled_image_common { const range &Range, const property_list &PropList = {}) : common_base(HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) {} @@ -501,7 +500,7 @@ class image : public detail::unsampled_image_common { const property_list &PropList = {}) : common_base( HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) {} @@ -510,7 +509,7 @@ class image : public detail::unsampled_image_common { const property_list &PropList = {}) : common_base(HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) {} @@ -519,7 +518,7 @@ class image : public detail::unsampled_image_common { AllocatorT Allocator, const property_list &PropList = {}) : common_base( HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) {} @@ -532,7 +531,7 @@ class image : public detail::unsampled_image_common { : common_base(HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) {} @@ -545,7 +544,7 @@ class image : public detail::unsampled_image_common { : common_base( HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) {} @@ -554,7 +553,7 @@ class image : public detail::unsampled_image_common { const property_list &PropList = {}) : common_base(HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList, /*IsConstPtr*/ false) {} @@ -563,7 +562,7 @@ class image : public detail::unsampled_image_common { AllocatorT Allocator, const property_list &PropList = {}) : common_base( HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList, /*IsConstPtr*/ false) {} @@ -576,7 +575,7 @@ class image : public detail::unsampled_image_common { : common_base(HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList, /*IsConstPtr*/ false) {} @@ -589,7 +588,7 @@ class image : public detail::unsampled_image_common { : common_base( HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList, /*IsConstPtr*/ false) {} @@ -597,7 +596,7 @@ class image : public detail::unsampled_image_common { image(cl_mem ClMemObject, const context &SyclContext, event AvailableEvent = {}) : common_base(ClMemObject, SyclContext, AvailableEvent, - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions) {} #endif @@ -671,7 +670,7 @@ class image : public detail::unsampled_image_common { event AvailableEvent, image_channel_order Order, image_channel_type Type, bool OwnNativeHandle, range Range) : common_base(MemObject, SyclContext, AvailableEvent, - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, Order, Type, OwnNativeHandle, detail::convertToArrayOfN<3, 1>(Range)) {} @@ -742,7 +741,7 @@ class unsampled_image : common_base(detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -758,7 +757,7 @@ class unsampled_image detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -776,7 +775,7 @@ class unsampled_image detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -796,7 +795,7 @@ class unsampled_image detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -811,7 +810,7 @@ class unsampled_image : common_base(HostPointer, detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -827,7 +826,7 @@ class unsampled_image HostPointer, detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -845,7 +844,7 @@ class unsampled_image detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -865,7 +864,7 @@ class unsampled_image detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList) { common_base::unsampledImageConstructorNotification( @@ -880,7 +879,7 @@ class unsampled_image : common_base(HostPointer, detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList, /*IsConstPtr*/ false) { common_base::unsampledImageConstructorNotification( @@ -897,7 +896,7 @@ class unsampled_image HostPointer, detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList, /*IsConstPtr*/ false) { common_base::unsampledImageConstructorNotification( @@ -916,7 +915,7 @@ class unsampled_image detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList, /*IsConstPtr*/ false) { common_base::unsampledImageConstructorNotification( @@ -936,7 +935,7 @@ class unsampled_image detail::FormatChannelType(Format), detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(Allocator), Dimensions, PropList, /*IsConstPtr*/ false) { common_base::unsampledImageConstructorNotification( @@ -1023,7 +1022,7 @@ class sampled_image : common_base(HostPointer, detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), Sampler, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::sampledImageConstructorNotification( @@ -1042,7 +1041,7 @@ class sampled_image detail::FormatChannelType(Format), Sampler, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::sampledImageConstructorNotification( @@ -1058,7 +1057,7 @@ class sampled_image : common_base(HostPointer, detail::FormatChannelOrder(Format), detail::FormatChannelType(Format), Sampler, detail::convertToArrayOfN<3, 1>(Range), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::sampledImageConstructorNotification( @@ -1077,7 +1076,7 @@ class sampled_image detail::FormatChannelType(Format), Sampler, detail::convertToArrayOfN<3, 1>(Range), detail::convertToArrayOfN<2, 0>(Pitch), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder>(), Dimensions, PropList) { common_base::sampledImageConstructorNotification( diff --git a/sycl/include/sycl/stl.hpp b/sycl/include/sycl/stl.hpp deleted file mode 100644 index 69415477b84e4..0000000000000 --- a/sycl/include/sycl/stl.hpp +++ /dev/null @@ -1,48 +0,0 @@ -//==----------- stl.hpp - basic STL implementation -------------------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#pragma once - -// 4.5 C++ Standard library classes required for the interface - -#include // for unique_ptr -#include // for forward - -namespace sycl { -inline namespace _V1 { - -#if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) -// SYCL library is designed such a way that STL objects cross DLL boundary, -// which is guaranteed to work properly only when the application uses the same -// C++ runtime that SYCL library uses. -// The appplications using sycl.dll must be linked with dynamic/release C++ MSVC -// runtime, i.e. be compiled with /MD switch. Similarly, the applications using -// sycld.dll must be linked with dynamic/debug C++ runtime and be compiled with -// /MDd switch. -// Compiler automatically adds /MD or /MDd when -fsycl switch is used. -// The options /MD and /MDd that make the code to use dynamic runtime also -// define the _DLL macro. -#if defined(_MSC_VER) -#pragma message( \ - "SYCL library is designed to work safely with dynamic C++ runtime." \ - "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \ - "or -fsycl switch to set C++ runtime automatically.") -#else -#warning "SYCL library is designed to work safely with dynamic C++ runtime."\ - "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, "\ - "or -fsycl switch to set C++ runtime automatically." -#endif -#endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) - -template -std::unique_ptr make_unique_ptr(ArgsT &&...Args) { - return std::unique_ptr(new T(std::forward(Args)...)); -} - -} // namespace _V1 -} // namespace sycl diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 961a2ae394f94..a362625e43977 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -944,7 +944,7 @@ ProgramManager::ProgramManager() : m_AsanFoundInImage(false) { // blocked until the construction of the ProgramManager singleton is // finished. m_SpvFileImage = - make_unique_ptr(std::move(Data), Size); + std::make_unique(std::move(Data), Size); if (DbgProgMgr > 0) { std::cerr << "loaded device image binary from " << SpvFile << "\n"; @@ -1263,7 +1263,7 @@ void ProgramManager::addImages(pi_device_binaries DeviceBinary) { if (EntriesB == EntriesE) continue; - auto Img = make_unique_ptr(RawImg); + auto Img = std::make_unique(RawImg); static uint32_t SequenceID = 0; // Fill the kernel argument mask map diff --git a/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp b/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp index f555c44cfc5a3..635a8e9c3389c 100644 --- a/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp +++ b/sycl/unittests/scheduler/NoHostUnifiedMemory.cpp @@ -211,7 +211,7 @@ TEST_F(SchedulerTest, NoHostUnifiedMemory) { InteropPiContext = detail::getSyclObjImpl(InteropContext)->getHandleRef(); auto BufI = std::make_shared( detail::pi::cast(MockInteropBuffer), Q.get_context(), - make_unique_ptr< + std::make_unique< detail::SYCLMemObjAllocatorHolder, char>>(), /* OwnNativeHandle */ true, event()); From ffce7f7291617486a413f3d053d0c5e4395ab2b1 Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Tue, 27 Feb 2024 14:31:43 -0800 Subject: [PATCH 2/3] Restore the API to avoid the break Mark it as deprecated though --- sycl/include/sycl/sycl.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sycl/include/sycl/sycl.hpp b/sycl/include/sycl/sycl.hpp index 11c69ded8e798..480162d408481 100644 --- a/sycl/include/sycl/sycl.hpp +++ b/sycl/include/sycl/sycl.hpp @@ -109,3 +109,19 @@ #include #include #endif + +#if !defined(__INTEL_PREVIEW_BREAKING_CHANGES) +namespace sycl { +inline namespace _V1 { +// This wasn't put into "detail" so we can't just drop it outsdie ABI-breaking +// window. DO NOT USE. +template +__SYCL_DEPRECATED( + "sycl::make_unique_ptr was never supposed to be anything other than " + "an implementation detail. Use std::make_unique instead.") +std::unique_ptr make_unique_ptr(ArgsT &&...Args) { + return std::unique_ptr(new T(std::forward(Args)...)); +} +} // namespace _V1 +} // namespace sycl +#endif From fe1a824bb06a1ba9d52892bd5c35918536c92e58 Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Tue, 27 Feb 2024 14:32:15 -0800 Subject: [PATCH 3/3] Remove #include references Didn't notice locally because the copy was left in build directory --- sycl/source/context.cpp | 1 - sycl/source/detail/accessor_impl.hpp | 1 - sycl/source/detail/buffer_impl.hpp | 1 - sycl/source/detail/context_impl.cpp | 1 - sycl/source/detail/context_impl.hpp | 1 - sycl/source/detail/device_impl.hpp | 1 - sycl/source/detail/event_impl.hpp | 1 - sycl/source/detail/filter_selector_impl.cpp | 1 - sycl/source/detail/image_impl.hpp | 1 - sycl/source/detail/platform_impl.hpp | 1 - sycl/source/detail/plugin.hpp | 1 - sycl/source/detail/program_impl.hpp | 1 - sycl/source/detail/program_manager/program_manager.cpp | 1 - sycl/source/detail/program_manager/program_manager.hpp | 1 - sycl/source/detail/queue_impl.hpp | 1 - sycl/source/detail/spec_constant_impl.hpp | 1 - sycl/source/detail/sycl_mem_obj_i.hpp | 1 - sycl/source/device_selector.cpp | 1 - sycl/source/event.cpp | 1 - sycl/source/queue.cpp | 1 - sycl/source/queue_v3.cpp | 1 - 21 files changed, 21 deletions(-) diff --git a/sycl/source/context.cpp b/sycl/source/context.cpp index 065c5af414b05..5ae0bba6dadcc 100644 --- a/sycl/source/context.cpp +++ b/sycl/source/context.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/accessor_impl.hpp b/sycl/source/detail/accessor_impl.hpp index 8efe97e348491..1a26733b1d00d 100644 --- a/sycl/source/detail/accessor_impl.hpp +++ b/sycl/source/detail/accessor_impl.hpp @@ -14,7 +14,6 @@ #include #include #include -#include namespace sycl { inline namespace _V1 { diff --git a/sycl/source/detail/buffer_impl.hpp b/sycl/source/detail/buffer_impl.hpp index e949edad3da9e..af4da07ffd198 100644 --- a/sycl/source/detail/buffer_impl.hpp +++ b/sycl/source/detail/buffer_impl.hpp @@ -17,7 +17,6 @@ #include #include // for iterator_to_const_type_t #include -#include #include #include diff --git a/sycl/source/detail/context_impl.cpp b/sycl/source/detail/context_impl.cpp index 46894a6d9e650..3f397e4f29794 100644 --- a/sycl/source/detail/context_impl.cpp +++ b/sycl/source/detail/context_impl.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include diff --git a/sycl/source/detail/context_impl.hpp b/sycl/source/detail/context_impl.hpp index 89b3f4fc382e1..d3d84cce8c28b 100644 --- a/sycl/source/detail/context_impl.hpp +++ b/sycl/source/detail/context_impl.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/device_impl.hpp b/sycl/source/detail/device_impl.hpp index 8ecaa6a2bfc62..f6b4a27b61232 100644 --- a/sycl/source/detail/device_impl.hpp +++ b/sycl/source/detail/device_impl.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/event_impl.hpp b/sycl/source/detail/event_impl.hpp index feb65cfc88946..db268539136f9 100644 --- a/sycl/source/detail/event_impl.hpp +++ b/sycl/source/detail/event_impl.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/filter_selector_impl.cpp b/sycl/source/detail/filter_selector_impl.cpp index 881a1c25a2e04..4b5f8e836ee6d 100644 --- a/sycl/source/detail/filter_selector_impl.cpp +++ b/sycl/source/detail/filter_selector_impl.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/image_impl.hpp b/sycl/source/detail/image_impl.hpp index 4505517064938..386a4636b5fe5 100644 --- a/sycl/source/detail/image_impl.hpp +++ b/sycl/source/detail/image_impl.hpp @@ -19,7 +19,6 @@ #include #include #include -#include namespace sycl { inline namespace _V1 { diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index 3b08d39ad3738..bc62ecea21c95 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -16,7 +16,6 @@ #include #include #include -#include namespace sycl { inline namespace _V1 { diff --git a/sycl/source/detail/plugin.hpp b/sycl/source/detail/plugin.hpp index fc7eed16ac13f..71eba2ffc3845 100644 --- a/sycl/source/detail/plugin.hpp +++ b/sycl/source/detail/plugin.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #ifdef XPTI_ENABLE_INSTRUMENTATION // Include the headers necessary for emitting traces using the trace framework diff --git a/sycl/source/detail/program_impl.hpp b/sycl/source/detail/program_impl.hpp index f7bdec02517ba..80fc9cf9811a8 100644 --- a/sycl/source/detail/program_impl.hpp +++ b/sycl/source/detail/program_impl.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index a362625e43977..c4688236a77b9 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include diff --git a/sycl/source/detail/program_manager/program_manager.hpp b/sycl/source/detail/program_manager/program_manager.hpp index 20613cf69212f..573e4ddfed284 100644 --- a/sycl/source/detail/program_manager/program_manager.hpp +++ b/sycl/source/detail/program_manager/program_manager.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index 12f440c5fc9c9..c6b7be77803c7 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include "detail/graph_impl.hpp" diff --git a/sycl/source/detail/spec_constant_impl.hpp b/sycl/source/detail/spec_constant_impl.hpp index b576cc243b542..b01e2e5112ab3 100644 --- a/sycl/source/detail/spec_constant_impl.hpp +++ b/sycl/source/detail/spec_constant_impl.hpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/detail/sycl_mem_obj_i.hpp b/sycl/source/detail/sycl_mem_obj_i.hpp index 061429a069549..d73775b2ee70e 100644 --- a/sycl/source/detail/sycl_mem_obj_i.hpp +++ b/sycl/source/detail/sycl_mem_obj_i.hpp @@ -9,7 +9,6 @@ #pragma once #include -#include namespace sycl { inline namespace _V1 { diff --git a/sycl/source/device_selector.cpp b/sycl/source/device_selector.cpp index 55ee7b1a860b9..2716ae920c1e1 100644 --- a/sycl/source/device_selector.cpp +++ b/sycl/source/device_selector.cpp @@ -17,7 +17,6 @@ #include #include #include -#include // 4.6.1 Device selection class #include diff --git a/sycl/source/event.cpp b/sycl/source/event.cpp index c8f170e68cf84..897c48ca7e890 100644 --- a/sycl/source/event.cpp +++ b/sycl/source/event.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 2dd794dcd40ea..579782950d4e1 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include diff --git a/sycl/source/queue_v3.cpp b/sycl/source/queue_v3.cpp index 249bd37f69015..7b7fc9204352b 100644 --- a/sycl/source/queue_v3.cpp +++ b/sycl/source/queue_v3.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include