Skip to content

Commit 7cb8726

Browse files
[NFC][SYCL] Remove explicit cl:: namespace usage (intel#6485)
* [NFC][SYCL] Remove explicit cl:: namespace usage That is part of the change of removing cl:: entirely according to the SYCL 2020 specification.
1 parent 48414c7 commit 7cb8726

File tree

253 files changed

+1563
-1674
lines changed

Some content is hidden

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

253 files changed

+1563
-1674
lines changed

sycl/include/CL/__spirv/spirv_ops.hpp

Lines changed: 129 additions & 153 deletions
Large diffs are not rendered by default.

sycl/include/sycl/accessor.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
22322232
access::target::image, IsPlaceholder> {
22332233
public:
22342234
template <typename AllocatorT>
2235-
accessor(cl::sycl::image<Dimensions, AllocatorT> &Image,
2235+
accessor(sycl::image<Dimensions, AllocatorT> &Image,
22362236
handler &CommandGroupHandler)
22372237
: detail::image_accessor<DataT, Dimensions, AccessMode,
22382238
access::target::image, IsPlaceholder>(
@@ -2245,7 +2245,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
22452245
}
22462246

22472247
template <typename AllocatorT>
2248-
accessor(cl::sycl::image<Dimensions, AllocatorT> &Image,
2248+
accessor(sycl::image<Dimensions, AllocatorT> &Image,
22492249
handler &CommandGroupHandler, const property_list &propList)
22502250
: detail::image_accessor<DataT, Dimensions, AccessMode,
22512251
access::target::image, IsPlaceholder>(
@@ -2291,13 +2291,13 @@ class accessor<DataT, Dimensions, AccessMode, access::target::host_image,
22912291
access::target::host_image, IsPlaceholder> {
22922292
public:
22932293
template <typename AllocatorT>
2294-
accessor(cl::sycl::image<Dimensions, AllocatorT> &Image)
2294+
accessor(sycl::image<Dimensions, AllocatorT> &Image)
22952295
: detail::image_accessor<DataT, Dimensions, AccessMode,
22962296
access::target::host_image, IsPlaceholder>(
22972297
Image, (detail::getSyclObjImpl(Image))->getElementSize()) {}
22982298

22992299
template <typename AllocatorT>
2300-
accessor(cl::sycl::image<Dimensions, AllocatorT> &Image,
2300+
accessor(sycl::image<Dimensions, AllocatorT> &Image,
23012301
const property_list &propList)
23022302
: detail::image_accessor<DataT, Dimensions, AccessMode,
23032303
access::target::host_image, IsPlaceholder>(
@@ -2339,7 +2339,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
23392339
#endif
23402340
public:
23412341
template <typename AllocatorT>
2342-
accessor(cl::sycl::image<Dimensions + 1, AllocatorT> &Image,
2342+
accessor(sycl::image<Dimensions + 1, AllocatorT> &Image,
23432343
handler &CommandGroupHandler)
23442344
: detail::image_accessor<DataT, Dimensions + 1, AccessMode,
23452345
access::target::image, IsPlaceholder>(
@@ -2352,7 +2352,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
23522352
}
23532353

23542354
template <typename AllocatorT>
2355-
accessor(cl::sycl::image<Dimensions + 1, AllocatorT> &Image,
2355+
accessor(sycl::image<Dimensions + 1, AllocatorT> &Image,
23562356
handler &CommandGroupHandler, const property_list &propList)
23572357
: detail::image_accessor<DataT, Dimensions + 1, AccessMode,
23582358
access::target::image, IsPlaceholder>(
@@ -2615,13 +2615,13 @@ host_accessor(buffer<DataT, Dimensions, AllocatorT>, Type1, Type2, Type3, Type4,
26152615
} // __SYCL_INLINE_NAMESPACE(cl)
26162616

26172617
namespace std {
2618-
template <typename DataT, int Dimensions, cl::sycl::access::mode AccessMode,
2619-
cl::sycl::access::target AccessTarget,
2620-
cl::sycl::access::placeholder IsPlaceholder>
2621-
struct hash<cl::sycl::accessor<DataT, Dimensions, AccessMode, AccessTarget,
2622-
IsPlaceholder>> {
2623-
using AccType = cl::sycl::accessor<DataT, Dimensions, AccessMode,
2624-
AccessTarget, IsPlaceholder>;
2618+
template <typename DataT, int Dimensions, sycl::access::mode AccessMode,
2619+
sycl::access::target AccessTarget,
2620+
sycl::access::placeholder IsPlaceholder>
2621+
struct hash<sycl::accessor<DataT, Dimensions, AccessMode, AccessTarget,
2622+
IsPlaceholder>> {
2623+
using AccType = sycl::accessor<DataT, Dimensions, AccessMode, AccessTarget,
2624+
IsPlaceholder>;
26252625

26262626
size_t operator()(const AccType &A) const {
26272627
#ifdef __SYCL_DEVICE_ONLY__
@@ -2631,7 +2631,7 @@ struct hash<cl::sycl::accessor<DataT, Dimensions, AccessMode, AccessTarget,
26312631
#else
26322632
// getSyclObjImpl() here returns a pointer to either AccessorImplHost
26332633
// or LocalAccessorImplHost depending on the AccessTarget.
2634-
auto AccImplPtr = cl::sycl::detail::getSyclObjImpl(A);
2634+
auto AccImplPtr = sycl::detail::getSyclObjImpl(A);
26352635
return hash<decltype(AccImplPtr)>()(AccImplPtr);
26362636
#endif
26372637
}

sycl/include/sycl/aliases.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class half;
2626
} // __SYCL_INLINE_NAMESPACE(cl)
2727

2828
#define __SYCL_MAKE_VECTOR_ALIAS(ALIAS, TYPE, N) \
29-
using ALIAS##N = cl::sycl::vec<TYPE, N>;
29+
using ALIAS##N = sycl::vec<TYPE, N>;
3030

3131
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES(N) \
3232
__SYCL_MAKE_VECTOR_ALIAS(char, char, N) \
@@ -38,17 +38,17 @@ class half;
3838
__SYCL_MAKE_VECTOR_ALIAS(half, half, N)
3939

4040
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \
41-
__SYCL_MAKE_VECTOR_ALIAS(cl_char, cl::sycl::cl_char, N) \
42-
__SYCL_MAKE_VECTOR_ALIAS(cl_uchar, cl::sycl::cl_uchar, N) \
43-
__SYCL_MAKE_VECTOR_ALIAS(cl_short, cl::sycl::cl_short, N) \
44-
__SYCL_MAKE_VECTOR_ALIAS(cl_ushort, cl::sycl::cl_ushort, N) \
45-
__SYCL_MAKE_VECTOR_ALIAS(cl_int, cl::sycl::cl_int, N) \
46-
__SYCL_MAKE_VECTOR_ALIAS(cl_uint, cl::sycl::cl_uint, N) \
47-
__SYCL_MAKE_VECTOR_ALIAS(cl_long, cl::sycl::cl_long, N) \
48-
__SYCL_MAKE_VECTOR_ALIAS(cl_ulong, cl::sycl::cl_ulong, N) \
49-
__SYCL_MAKE_VECTOR_ALIAS(cl_float, cl::sycl::cl_float, N) \
50-
__SYCL_MAKE_VECTOR_ALIAS(cl_double, cl::sycl::cl_double, N) \
51-
__SYCL_MAKE_VECTOR_ALIAS(cl_half, cl::sycl::cl_half, N)
41+
__SYCL_MAKE_VECTOR_ALIAS(cl_char, sycl::cl_char, N) \
42+
__SYCL_MAKE_VECTOR_ALIAS(cl_uchar, sycl::cl_uchar, N) \
43+
__SYCL_MAKE_VECTOR_ALIAS(cl_short, sycl::cl_short, N) \
44+
__SYCL_MAKE_VECTOR_ALIAS(cl_ushort, sycl::cl_ushort, N) \
45+
__SYCL_MAKE_VECTOR_ALIAS(cl_int, sycl::cl_int, N) \
46+
__SYCL_MAKE_VECTOR_ALIAS(cl_uint, sycl::cl_uint, N) \
47+
__SYCL_MAKE_VECTOR_ALIAS(cl_long, sycl::cl_long, N) \
48+
__SYCL_MAKE_VECTOR_ALIAS(cl_ulong, sycl::cl_ulong, N) \
49+
__SYCL_MAKE_VECTOR_ALIAS(cl_float, sycl::cl_float, N) \
50+
__SYCL_MAKE_VECTOR_ALIAS(cl_double, sycl::cl_double, N) \
51+
__SYCL_MAKE_VECTOR_ALIAS(cl_half, sycl::cl_half, N)
5252

5353
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N) \
5454
__SYCL_MAKE_VECTOR_ALIAS(schar, signed char, N) \
@@ -74,7 +74,7 @@ using uint = unsigned int;
7474
using ulong = unsigned long;
7575
using longlong = long long;
7676
using ulonglong = unsigned long long;
77-
using half = cl::sycl::detail::half_impl::half;
77+
using half = sycl::detail::half_impl::half;
7878
using cl_bool = bool;
7979
using cl_char = std::int8_t;
8080
using cl_uchar = std::uint8_t;

sycl/include/sycl/atomic.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class multi_ptr;
3434

3535
namespace detail {
3636

37-
using memory_order = cl::sycl::memory_order;
37+
using memory_order = sycl::memory_order;
3838

3939
template <typename T> struct IsValidAtomicType {
4040
static constexpr bool value =
@@ -45,14 +45,14 @@ template <typename T> struct IsValidAtomicType {
4545
std::is_same<T, float>::value);
4646
};
4747

48-
template <cl::sycl::access::address_space AS> struct IsValidAtomicAddressSpace {
48+
template <sycl::access::address_space AS> struct IsValidAtomicAddressSpace {
4949
static constexpr bool value =
5050
(AS == access::address_space::global_space ||
5151
AS == access::address_space::local_space ||
5252
AS == access::address_space::ext_intel_global_device_space);
5353
};
5454

55-
// Type trait to translate a cl::sycl::access::address_space to
55+
// Type trait to translate a sycl::access::address_space to
5656
// a SPIR-V memory scope
5757
template <access::address_space AS> struct GetSpirvMemoryScope {};
5858
template <> struct GetSpirvMemoryScope<access::address_space::global_space> {
@@ -76,7 +76,7 @@ template <> struct GetSpirvMemoryScope<access::address_space::local_space> {
7676
__SYCL_INLINE_NAMESPACE(cl) {
7777
namespace sycl {
7878
namespace detail {
79-
// Translate cl::sycl::memory_order or __spv::MemorySemanticsMask::Flag
79+
// Translate sycl::memory_order or __spv::MemorySemanticsMask::Flag
8080
// into std::memory_order
8181
// Only relaxed memory semantics are supported currently
8282
static inline std::memory_order
@@ -92,55 +92,55 @@ getStdMemoryOrder(__spv::MemorySemanticsMask::Flag) {
9292
template <typename T>
9393
void __spirv_AtomicStore(std::atomic<T> *Ptr, __spv::Scope::Flag,
9494
__spv::MemorySemanticsMask::Flag MS, T V) {
95-
Ptr->store(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
95+
Ptr->store(V, ::sycl::detail::getStdMemoryOrder(MS));
9696
}
9797

9898
template <typename T>
9999
T __spirv_AtomicLoad(const std::atomic<T> *Ptr, __spv::Scope::Flag,
100100
__spv::MemorySemanticsMask::Flag MS) {
101-
return Ptr->load(::cl::sycl::detail::getStdMemoryOrder(MS));
101+
return Ptr->load(::sycl::detail::getStdMemoryOrder(MS));
102102
}
103103

104104
template <typename T>
105105
T __spirv_AtomicExchange(std::atomic<T> *Ptr, __spv::Scope::Flag,
106106
__spv::MemorySemanticsMask::Flag MS, T V) {
107-
return Ptr->exchange(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
107+
return Ptr->exchange(V, ::sycl::detail::getStdMemoryOrder(MS));
108108
}
109109

110110
template <typename T>
111111
extern T __spirv_AtomicIAdd(std::atomic<T> *Ptr, __spv::Scope::Flag,
112112
__spv::MemorySemanticsMask::Flag MS, T V) {
113-
return Ptr->fetch_add(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
113+
return Ptr->fetch_add(V, ::sycl::detail::getStdMemoryOrder(MS));
114114
}
115115

116116
template <typename T>
117117
extern T __spirv_AtomicISub(std::atomic<T> *Ptr, __spv::Scope::Flag,
118118
__spv::MemorySemanticsMask::Flag MS, T V) {
119-
return Ptr->fetch_sub(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
119+
return Ptr->fetch_sub(V, ::sycl::detail::getStdMemoryOrder(MS));
120120
}
121121

122122
template <typename T>
123123
extern T __spirv_AtomicAnd(std::atomic<T> *Ptr, __spv::Scope::Flag,
124124
__spv::MemorySemanticsMask::Flag MS, T V) {
125-
return Ptr->fetch_and(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
125+
return Ptr->fetch_and(V, ::sycl::detail::getStdMemoryOrder(MS));
126126
}
127127

128128
template <typename T>
129129
extern T __spirv_AtomicOr(std::atomic<T> *Ptr, __spv::Scope::Flag,
130130
__spv::MemorySemanticsMask::Flag MS, T V) {
131-
return Ptr->fetch_or(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
131+
return Ptr->fetch_or(V, ::sycl::detail::getStdMemoryOrder(MS));
132132
}
133133

134134
template <typename T>
135135
extern T __spirv_AtomicXor(std::atomic<T> *Ptr, __spv::Scope::Flag,
136136
__spv::MemorySemanticsMask::Flag MS, T V) {
137-
return Ptr->fetch_xor(V, ::cl::sycl::detail::getStdMemoryOrder(MS));
137+
return Ptr->fetch_xor(V, ::sycl::detail::getStdMemoryOrder(MS));
138138
}
139139

140140
template <typename T>
141141
extern T __spirv_AtomicMin(std::atomic<T> *Ptr, __spv::Scope::Flag,
142142
__spv::MemorySemanticsMask::Flag MS, T V) {
143-
std::memory_order MemoryOrder = ::cl::sycl::detail::getStdMemoryOrder(MS);
143+
std::memory_order MemoryOrder = ::sycl::detail::getStdMemoryOrder(MS);
144144
T Val = Ptr->load(MemoryOrder);
145145
while (V < Val) {
146146
if (Ptr->compare_exchange_strong(Val, V, MemoryOrder, MemoryOrder))
@@ -153,7 +153,7 @@ extern T __spirv_AtomicMin(std::atomic<T> *Ptr, __spv::Scope::Flag,
153153
template <typename T>
154154
extern T __spirv_AtomicMax(std::atomic<T> *Ptr, __spv::Scope::Flag,
155155
__spv::MemorySemanticsMask::Flag MS, T V) {
156-
std::memory_order MemoryOrder = ::cl::sycl::detail::getStdMemoryOrder(MS);
156+
std::memory_order MemoryOrder = ::sycl::detail::getStdMemoryOrder(MS);
157157
T Val = Ptr->load(MemoryOrder);
158158
while (V > Val) {
159159
if (Ptr->compare_exchange_strong(Val, V, MemoryOrder, MemoryOrder))

sycl/include/sycl/atomic_ref.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ __SYCL_INLINE_NAMESPACE(cl) {
2626
namespace sycl {
2727
namespace detail {
2828

29-
using memory_order = cl::sycl::memory_order;
30-
using memory_scope = cl::sycl::memory_scope;
29+
using memory_order = sycl::memory_order;
30+
using memory_scope = sycl::memory_scope;
3131

3232
template <typename T> struct IsValidAtomicRefType {
3333
static constexpr bool value =
@@ -39,8 +39,7 @@ template <typename T> struct IsValidAtomicRefType {
3939
std::is_pointer<T>::value);
4040
};
4141

42-
template <cl::sycl::access::address_space AS>
43-
struct IsValidAtomicRefAddressSpace {
42+
template <sycl::access::address_space AS> struct IsValidAtomicRefAddressSpace {
4443
static constexpr bool value =
4544
(AS == access::address_space::global_space ||
4645
AS == access::address_space::local_space ||

sycl/include/sycl/buffer.hpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,14 @@ class buffer {
328328
sizeof(T), rangeToArray(Range).data());
329329

330330
if (b.is_sub_buffer())
331-
throw cl::sycl::invalid_object_error(
331+
throw sycl::invalid_object_error(
332332
"Cannot create sub buffer from sub buffer.", PI_ERROR_INVALID_VALUE);
333333
if (isOutOfBounds(baseIndex, subRange, b.Range))
334-
throw cl::sycl::invalid_object_error(
334+
throw sycl::invalid_object_error(
335335
"Requested sub-buffer size exceeds the size of the parent buffer",
336336
PI_ERROR_INVALID_VALUE);
337337
if (!isContiguousRegion(baseIndex, subRange, b.Range))
338-
throw cl::sycl::invalid_object_error(
338+
throw sycl::invalid_object_error(
339339
"Requested sub-buffer region is not contiguous",
340340
PI_ERROR_INVALID_VALUE);
341341
}
@@ -434,7 +434,7 @@ class buffer {
434434
id<dimensions> accessOffset = {},
435435
const detail::code_location CodeLoc = detail::code_location::current()) {
436436
if (isOutOfBounds(accessOffset, accessRange, this->Range))
437-
throw cl::sycl::invalid_object_error(
437+
throw sycl::invalid_object_error(
438438
"Requested accessor would exceed the bounds of the buffer",
439439
PI_ERROR_INVALID_VALUE);
440440

@@ -450,7 +450,7 @@ class buffer {
450450
range<dimensions> accessRange, id<dimensions> accessOffset = {},
451451
const detail::code_location CodeLoc = detail::code_location::current()) {
452452
if (isOutOfBounds(accessOffset, accessRange, this->Range))
453-
throw cl::sycl::invalid_object_error(
453+
throw sycl::invalid_object_error(
454454
"Requested accessor would exceed the bounds of the buffer",
455455
PI_ERROR_INVALID_VALUE);
456456

@@ -495,7 +495,7 @@ class buffer {
495495
buffer<ReinterpretT, ReinterpretDim, AllocatorT>
496496
reinterpret(range<ReinterpretDim> reinterpretRange) const {
497497
if (sizeof(ReinterpretT) * reinterpretRange.size() != byte_size())
498-
throw cl::sycl::invalid_object_error(
498+
throw sycl::invalid_object_error(
499499
"Total size in bytes represented by the type and range of the "
500500
"reinterpreted SYCL buffer does not equal the total size in bytes "
501501
"represented by the type and range of this SYCL buffer",
@@ -522,7 +522,7 @@ class buffer {
522522
reinterpret() const {
523523
long sz = byte_size();
524524
if (sz % sizeof(ReinterpretT) != 0)
525-
throw cl::sycl::invalid_object_error(
525+
throw sycl::invalid_object_error(
526526
"Total byte size of buffer is not evenly divisible by the size of "
527527
"the reinterpreted type",
528528
PI_ERROR_INVALID_VALUE);
@@ -680,11 +680,10 @@ buffer(const T *, const range<dimensions> &, const property_list & = {})
680680

681681
namespace std {
682682
template <typename T, int dimensions, typename AllocatorT>
683-
struct hash<cl::sycl::buffer<T, dimensions, AllocatorT>> {
684-
size_t
685-
operator()(const cl::sycl::buffer<T, dimensions, AllocatorT> &b) const {
686-
return hash<std::shared_ptr<cl::sycl::detail::buffer_impl>>()(
687-
cl::sycl::detail::getSyclObjImpl(b));
683+
struct hash<sycl::buffer<T, dimensions, AllocatorT>> {
684+
size_t operator()(const sycl::buffer<T, dimensions, AllocatorT> &b) const {
685+
return hash<std::shared_ptr<sycl::detail::buffer_impl>>()(
686+
sycl::detail::getSyclObjImpl(b));
688687
}
689688
};
690689
} // namespace std

sycl/include/sycl/context.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ class __SYCL_EXPORT context {
253253
} // __SYCL_INLINE_NAMESPACE(cl)
254254

255255
namespace std {
256-
template <> struct hash<cl::sycl::context> {
257-
size_t operator()(const cl::sycl::context &Context) const {
258-
return hash<std::shared_ptr<cl::sycl::detail::context_impl>>()(
259-
cl::sycl::detail::getSyclObjImpl(Context));
256+
template <> struct hash<sycl::context> {
257+
size_t operator()(const sycl::context &Context) const {
258+
return hash<std::shared_ptr<sycl::detail::context_impl>>()(
259+
sycl::detail::getSyclObjImpl(Context));
260260
}
261261
};
262262
} // namespace std

sycl/include/sycl/detail/array.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ template <int dimensions = 1> class array {
4848
array() : array(0, 0, 0) {}
4949

5050
// Conversion operators to derived classes
51-
operator cl::sycl::id<dimensions>() const {
52-
cl::sycl::id<dimensions> result;
51+
operator sycl::id<dimensions>() const {
52+
sycl::id<dimensions> result;
5353
for (int i = 0; i < dimensions; ++i) {
5454
result[i] = common_array[i];
5555
}
5656
return result;
5757
}
5858

59-
operator cl::sycl::range<dimensions>() const {
60-
cl::sycl::range<dimensions> result;
59+
operator sycl::range<dimensions>() const {
60+
sycl::range<dimensions> result;
6161
for (int i = 0; i < dimensions; ++i) {
6262
result[i] = common_array[i];
6363
}
@@ -111,8 +111,8 @@ template <int dimensions = 1> class array {
111111
__SYCL_ALWAYS_INLINE void check_dimension(int dimension) const {
112112
#ifndef __SYCL_DEVICE_ONLY__
113113
if (dimension >= dimensions || dimension < 0) {
114-
throw cl::sycl::invalid_parameter_error("Index out of range",
115-
PI_ERROR_INVALID_VALUE);
114+
throw sycl::invalid_parameter_error("Index out of range",
115+
PI_ERROR_INVALID_VALUE);
116116
}
117117
#endif
118118
(void)dimension;

0 commit comments

Comments
 (0)