Skip to content

Commit 51c747d

Browse files
author
Alexander Batashev
authored
[SYCL] Deprecate some SYCL 1.2.1 APIs in SYCL2020 mode (#3954)
Also cleanup use of deprecated APIs in runtime source code.
1 parent 9778952 commit 51c747d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+743
-702
lines changed

sycl/include/CL/sycl/INTEL/online_compiler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class device_arch {
6161
class online_compile_error : public sycl::exception {
6262
public:
6363
online_compile_error() = default;
64-
online_compile_error(const string_class &Msg) : sycl::exception(Msg) {}
64+
online_compile_error(const std::string &Msg) : sycl::exception(Msg) {}
6565
};
6666

6767
/// Designates a source language for the online compiler.

sycl/include/CL/sycl/ONEAPI/reduction.hpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ template <typename... Ts> ReduTupleT<Ts...> makeReduTupleT(Ts... Elements) {
8080
return sycl::detail::make_tuple(Elements...);
8181
}
8282

83-
__SYCL_EXPORT size_t reduGetMaxWGSize(shared_ptr_class<queue_impl> Queue,
83+
__SYCL_EXPORT size_t reduGetMaxWGSize(std::shared_ptr<queue_impl> Queue,
8484
size_t LocalMemBytesPerWorkItem);
8585
__SYCL_EXPORT size_t reduComputeWGSize(size_t NWorkItems, size_t MaxWGSize,
8686
size_t &NWorkGroups);
@@ -698,10 +698,10 @@ class reduction_impl : private reduction_impl_base {
698698
const T MIdentity;
699699

700700
/// User's accessor to where the reduction must be written.
701-
shared_ptr_class<rw_accessor_type> MRWAcc;
702-
shared_ptr_class<dw_accessor_type> MDWAcc;
701+
std::shared_ptr<rw_accessor_type> MRWAcc;
702+
std::shared_ptr<dw_accessor_type> MDWAcc;
703703

704-
shared_ptr_class<buffer<T, buffer_dim>> MOutBufPtr;
704+
std::shared_ptr<buffer<T, buffer_dim>> MOutBufPtr;
705705

706706
/// USM pointer referencing the memory to where the result of the reduction
707707
/// must be written. Applicable/used only for USM reductions.
@@ -1584,13 +1584,14 @@ size_t reduAuxCGFunc(handler &CGH, size_t NWorkItems, size_t MaxWGSize,
15841584
return NWorkGroups;
15851585
}
15861586

1587-
inline void reduSaveFinalResultToUserMemHelper(
1588-
std::vector<event> &, shared_ptr_class<detail::queue_impl>, bool) {}
1587+
inline void
1588+
reduSaveFinalResultToUserMemHelper(std::vector<event> &,
1589+
std::shared_ptr<detail::queue_impl>, bool) {}
15891590

15901591
template <typename Reduction, typename... RestT>
15911592
std::enable_if_t<Reduction::is_usm>
15921593
reduSaveFinalResultToUserMemHelper(std::vector<event> &Events,
1593-
shared_ptr_class<detail::queue_impl> Queue,
1594+
std::shared_ptr<detail::queue_impl> Queue,
15941595
bool IsHost, Reduction &, RestT... Rest) {
15951596
// Reductions initialized with USM pointer currently do not require copying
15961597
// because the last kernel write directly to USM memory.
@@ -1599,7 +1600,7 @@ reduSaveFinalResultToUserMemHelper(std::vector<event> &Events,
15991600

16001601
template <typename Reduction, typename... RestT>
16011602
std::enable_if_t<!Reduction::is_usm> reduSaveFinalResultToUserMemHelper(
1602-
std::vector<event> &Events, shared_ptr_class<detail::queue_impl> Queue,
1603+
std::vector<event> &Events, std::shared_ptr<detail::queue_impl> Queue,
16031604
bool IsHost, Reduction &Redu, RestT... Rest) {
16041605
if (Redu.hasUserDiscardWriteAccessor()) {
16051606
handler CopyHandler(Queue, IsHost);
@@ -1620,16 +1621,16 @@ std::enable_if_t<!Reduction::is_usm> reduSaveFinalResultToUserMemHelper(
16201621
/// Returns the event to the last kernel copying data or nullptr if no
16211622
/// additional kernels created.
16221623
template <typename... Reduction, size_t... Is>
1623-
shared_ptr_class<event>
1624-
reduSaveFinalResultToUserMem(shared_ptr_class<detail::queue_impl> Queue,
1624+
std::shared_ptr<event>
1625+
reduSaveFinalResultToUserMem(std::shared_ptr<detail::queue_impl> Queue,
16251626
bool IsHost, std::tuple<Reduction...> &ReduTuple,
16261627
std::index_sequence<Is...>) {
16271628
std::vector<event> Events;
16281629
reduSaveFinalResultToUserMemHelper(Events, Queue, IsHost,
16291630
std::get<Is>(ReduTuple)...);
16301631
if (!Events.empty())
16311632
return std::make_shared<event>(Events.back());
1632-
return shared_ptr_class<event>();
1633+
return std::shared_ptr<event>();
16331634
}
16341635

16351636
template <typename Reduction> size_t reduGetMemPerWorkItemHelper(Reduction &) {

sycl/include/CL/sycl/aliases.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ using half = cl::sycl::detail::half_impl::half;
7171

7272
__SYCL_INLINE_NAMESPACE(cl) {
7373
namespace sycl {
74-
using byte = std::uint8_t;
74+
using byte __SYCL2020_DEPRECATED("use std::byte instead") = std::uint8_t;
7575
using schar = signed char;
7676
using uchar = unsigned char;
7777
using ushort = unsigned short;

sycl/include/CL/sycl/backend/level_zero.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ enum class ownership { transfer, keep };
8686
__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle);
8787
__SYCL_EXPORT device make_device(const platform &Platform,
8888
pi_native_handle NativeHandle);
89-
__SYCL_EXPORT context make_context(const vector_class<device> &DeviceList,
89+
__SYCL_EXPORT context make_context(const std::vector<device> &DeviceList,
9090
pi_native_handle NativeHandle,
9191
bool keep_ownership = false);
9292
__SYCL_EXPORT program make_program(const context &Context,
@@ -120,7 +120,7 @@ T make(const platform &Platform,
120120
///
121121
template <typename T, typename std::enable_if<
122122
std::is_same<T, context>::value>::type * = nullptr>
123-
T make(const vector_class<device> &DeviceList,
123+
T make(const std::vector<device> &DeviceList,
124124
typename interop<backend::level_zero, T>::type Interop,
125125
ownership Ownership = ownership::transfer) {
126126
return make_context(DeviceList, detail::pi::cast<pi_native_handle>(Interop),

sycl/include/CL/sycl/buffer.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class buffer {
118118
allocator));
119119
}
120120

121-
buffer(const shared_ptr_class<T> &hostData,
121+
buffer(const std::shared_ptr<T> &hostData,
122122
const range<dimensions> &bufferRange, AllocatorT allocator,
123123
const property_list &propList = {})
124124
: Range(bufferRange) {
@@ -129,7 +129,7 @@ class buffer {
129129
allocator));
130130
}
131131

132-
buffer(const shared_ptr_class<T[]> &hostData,
132+
buffer(const std::shared_ptr<T[]> &hostData,
133133
const range<dimensions> &bufferRange, AllocatorT allocator,
134134
const property_list &propList = {})
135135
: Range(bufferRange) {
@@ -140,7 +140,7 @@ class buffer {
140140
allocator));
141141
}
142142

143-
buffer(const shared_ptr_class<T> &hostData,
143+
buffer(const std::shared_ptr<T> &hostData,
144144
const range<dimensions> &bufferRange,
145145
const property_list &propList = {})
146146
: Range(bufferRange) {
@@ -150,7 +150,7 @@ class buffer {
150150
make_unique_ptr<detail::SYCLMemObjAllocatorHolder<AllocatorT>>());
151151
}
152152

153-
buffer(const shared_ptr_class<T[]> &hostData,
153+
buffer(const std::shared_ptr<T[]> &hostData,
154154
const range<dimensions> &bufferRange,
155155
const property_list &propList = {})
156156
: Range(bufferRange) {
@@ -389,7 +389,7 @@ class buffer {
389389
}
390390

391391
private:
392-
shared_ptr_class<detail::buffer_impl> impl;
392+
std::shared_ptr<detail::buffer_impl> impl;
393393
template <class Obj>
394394
friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
395395
template <typename A, int dims, typename C, typename Enable>
@@ -404,7 +404,7 @@ class buffer {
404404
bool IsSubBuffer = false;
405405

406406
// Reinterpret contructor
407-
buffer(shared_ptr_class<detail::buffer_impl> Impl,
407+
buffer(std::shared_ptr<detail::buffer_impl> Impl,
408408
range<dimensions> reinterpretRange, size_t reinterpretOffset,
409409
bool isSubBuffer)
410410
: impl(Impl), Range(reinterpretRange), OffsetInBytes(reinterpretOffset),

sycl/include/CL/sycl/context.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class __SYCL_EXPORT context {
120120
///
121121
/// \param DeviceList is a list of SYCL device instances.
122122
/// \param PropList is an instance of property_list.
123-
explicit context(const vector_class<device> &DeviceList,
123+
explicit context(const std::vector<device> &DeviceList,
124124
const property_list &PropList = {});
125125

126126
/// Constructs a SYCL context instance using list of devices.
@@ -136,7 +136,7 @@ class __SYCL_EXPORT context {
136136
/// \param DeviceList is a list of SYCL device instances.
137137
/// \param AsyncHandler is an instance of async_handler.
138138
/// \param PropList is an instance of property_list.
139-
explicit context(const vector_class<device> &DeviceList,
139+
explicit context(const std::vector<device> &DeviceList,
140140
async_handler AsyncHandler,
141141
const property_list &PropList = {});
142142

@@ -209,7 +209,7 @@ class __SYCL_EXPORT context {
209209
/// Gets devices associated with this SYCL context.
210210
///
211211
/// \return a vector of valid SYCL device instances.
212-
vector_class<device> get_devices() const;
212+
std::vector<device> get_devices() const;
213213

214214
/// Gets the native handle of the SYCL context.
215215
///
@@ -222,11 +222,11 @@ class __SYCL_EXPORT context {
222222

223223
private:
224224
/// Constructs a SYCL context object from a valid context_impl instance.
225-
context(shared_ptr_class<detail::context_impl> Impl);
225+
context(std::shared_ptr<detail::context_impl> Impl);
226226

227227
pi_native_handle getNative() const;
228228

229-
shared_ptr_class<detail::context_impl> impl;
229+
std::shared_ptr<detail::context_impl> impl;
230230
template <class Obj>
231231
friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
232232

@@ -245,7 +245,7 @@ class __SYCL_EXPORT context {
245245
namespace std {
246246
template <> struct hash<cl::sycl::context> {
247247
size_t operator()(const cl::sycl::context &Context) const {
248-
return hash<cl::sycl::shared_ptr_class<cl::sycl::detail::context_impl>>()(
248+
return hash<std::shared_ptr<cl::sycl::detail::context_impl>>()(
249249
cl::sycl::detail::getSyclObjImpl(Context));
250250
}
251251
};

sycl/include/CL/sycl/detail/accessor_impl.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ class __SYCL_EXPORT AccessorImplHost {
129129
bool MIsESIMDAcc;
130130
};
131131

132-
using AccessorImplPtr = shared_ptr_class<AccessorImplHost>;
132+
using AccessorImplPtr = std::shared_ptr<AccessorImplHost>;
133133

134134
class AccessorBaseHost {
135135
public:
136136
AccessorBaseHost(id<3> Offset, range<3> AccessRange, range<3> MemoryRange,
137137
access::mode AccessMode, detail::SYCLMemObjI *SYCLMemObject,
138138
int Dims, int ElemSize, int OffsetInBytes = 0,
139139
bool IsSubBuffer = false) {
140-
impl = shared_ptr_class<AccessorImplHost>(new AccessorImplHost(
140+
impl = std::shared_ptr<AccessorImplHost>(new AccessorImplHost(
141141
Offset, AccessRange, MemoryRange, AccessMode, SYCLMemObject, Dims,
142142
ElemSize, OffsetInBytes, IsSubBuffer));
143143
}
@@ -180,12 +180,12 @@ class __SYCL_EXPORT LocalAccessorImplHost {
180180
std::vector<char> MMem;
181181
};
182182

183-
using LocalAccessorImplPtr = shared_ptr_class<LocalAccessorImplHost>;
183+
using LocalAccessorImplPtr = std::shared_ptr<LocalAccessorImplHost>;
184184

185185
class LocalAccessorBaseHost {
186186
public:
187187
LocalAccessorBaseHost(sycl::range<3> Size, int Dims, int ElemSize) {
188-
impl = shared_ptr_class<LocalAccessorImplHost>(
188+
impl = std::shared_ptr<LocalAccessorImplHost>(
189189
new LocalAccessorImplHost(Size, Dims, ElemSize));
190190
}
191191
sycl::range<3> &getSize() { return impl->MSize; }
@@ -202,7 +202,7 @@ class LocalAccessorBaseHost {
202202
template <class Obj>
203203
friend decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject);
204204

205-
shared_ptr_class<LocalAccessorImplHost> impl;
205+
std::shared_ptr<LocalAccessorImplHost> impl;
206206
};
207207

208208
using Requirement = AccessorImplHost;

sycl/include/CL/sycl/detail/buffer_impl.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
4545

4646
public:
4747
buffer_impl(size_t SizeInBytes, size_t, const property_list &Props,
48-
unique_ptr_class<SYCLMemObjAllocator> Allocator)
48+
std::unique_ptr<SYCLMemObjAllocator> Allocator)
4949
: BaseT(SizeInBytes, Props, std::move(Allocator)) {
5050

5151
if (Props.has_property<sycl::property::buffer::use_host_ptr>())
@@ -56,7 +56,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
5656

5757
buffer_impl(void *HostData, size_t SizeInBytes, size_t RequiredAlign,
5858
const property_list &Props,
59-
unique_ptr_class<SYCLMemObjAllocator> Allocator)
59+
std::unique_ptr<SYCLMemObjAllocator> Allocator)
6060
: BaseT(SizeInBytes, Props, std::move(Allocator)) {
6161

6262
if (Props.has_property<
@@ -70,7 +70,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
7070

7171
buffer_impl(const void *HostData, size_t SizeInBytes, size_t RequiredAlign,
7272
const property_list &Props,
73-
unique_ptr_class<SYCLMemObjAllocator> Allocator)
73+
std::unique_ptr<SYCLMemObjAllocator> Allocator)
7474
: BaseT(SizeInBytes, Props, std::move(Allocator)) {
7575

7676
if (Props.has_property<
@@ -83,9 +83,9 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
8383
}
8484

8585
template <typename T>
86-
buffer_impl(const shared_ptr_class<T> &HostData, const size_t SizeInBytes,
86+
buffer_impl(const std::shared_ptr<T> &HostData, const size_t SizeInBytes,
8787
size_t RequiredAlign, const property_list &Props,
88-
unique_ptr_class<SYCLMemObjAllocator> Allocator)
88+
std::unique_ptr<SYCLMemObjAllocator> Allocator)
8989
: BaseT(SizeInBytes, Props, std::move(Allocator)) {
9090

9191
if (Props.has_property<
@@ -105,7 +105,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
105105
buffer_impl(EnableIfNotConstIterator<InputIterator> First, InputIterator Last,
106106
const size_t SizeInBytes, size_t RequiredAlign,
107107
const property_list &Props,
108-
unique_ptr_class<SYCLMemObjAllocator> Allocator)
108+
std::unique_ptr<SYCLMemObjAllocator> Allocator)
109109
: BaseT(SizeInBytes, Props, std::move(Allocator)) {
110110

111111
if (Props.has_property<sycl::property::buffer::use_host_ptr>())
@@ -125,7 +125,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
125125
buffer_impl(EnableIfConstIterator<InputIterator> First, InputIterator Last,
126126
const size_t SizeInBytes, size_t RequiredAlign,
127127
const property_list &Props,
128-
unique_ptr_class<SYCLMemObjAllocator> Allocator)
128+
std::unique_ptr<SYCLMemObjAllocator> Allocator)
129129
: BaseT(SizeInBytes, Props, std::move(Allocator)) {
130130

131131
if (Props.has_property<sycl::property::buffer::use_host_ptr>())
@@ -139,7 +139,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
139139

140140
buffer_impl(cl_mem MemObject, const context &SyclContext,
141141
const size_t SizeInBytes,
142-
unique_ptr_class<SYCLMemObjAllocator> Allocator,
142+
std::unique_ptr<SYCLMemObjAllocator> Allocator,
143143
event AvailableEvent)
144144
: BaseT(MemObject, SyclContext, SizeInBytes, std::move(AvailableEvent),
145145
std::move(Allocator)) {}

0 commit comments

Comments
 (0)