Skip to content

Commit 31f3d6a

Browse files
authored
[SYCL] Remove sycl_ext_intel_usm_address_spaces extension (#20916)
Remove in scope of #16929
1 parent c3cdb9f commit 31f3d6a

23 files changed

+79
-646
lines changed

sycl/doc/design/CompilerAndRuntimeDesign.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,6 @@ space attributes in SYCL mode:
983983
| Address space attribute | SYCL address_space enumeration |
984984
|-------------------------|--------------------------------|
985985
| `__attribute__((opencl_global))` | global_space, constant_space |
986-
| `__attribute__((opencl_global_host))` | ext_intel_global_host_space |
987-
| `__attribute__((opencl_global_device))` | ext_intel_global_device_space |
988986
| `__attribute__((opencl_local))` | local_space |
989987
| `__attribute__((opencl_private))` | private_space |
990988
| `__attribute__((opencl_constant))` | N/A

sycl/doc/extensions/supported/sycl_ext_intel_usm_address_spaces.asciidoc renamed to sycl/doc/extensions/removed/sycl_ext_intel_usm_address_spaces.asciidoc

File renamed without changes.

sycl/include/sycl/access/access.hpp

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ enum class address_space : int {
5454
"space is deprecated since SYCL 2020") =
5555
2,
5656
local_space = 3,
57-
ext_intel_global_device_space = 4,
58-
ext_intel_global_host_space = 5,
59-
generic_space = 6, // TODO generic_space address space is not supported yet
57+
generic_space = 4, // TODO generic_space address space is not supported yet
6058
};
6159

6260
enum class decorated : int { no = 0, yes = 1, legacy = 2 };
@@ -112,20 +110,11 @@ template <> struct NegateDecorated<access::decorated::no> {
112110

113111
#ifdef __SYCL_DEVICE_ONLY__
114112
#define __OPENCL_GLOBAL_AS__ __attribute__((opencl_global))
115-
#ifdef __ENABLE_USM_ADDR_SPACE__
116-
#define __OPENCL_GLOBAL_DEVICE_AS__ __attribute__((opencl_global_device))
117-
#define __OPENCL_GLOBAL_HOST_AS__ __attribute__((opencl_global_host))
118-
#else
119-
#define __OPENCL_GLOBAL_DEVICE_AS__ __attribute__((opencl_global))
120-
#define __OPENCL_GLOBAL_HOST_AS__ __attribute__((opencl_global))
121-
#endif // __ENABLE_USM_ADDR_SPACE__
122113
#define __OPENCL_LOCAL_AS__ __attribute__((opencl_local))
123114
#define __OPENCL_CONSTANT_AS__ __attribute__((opencl_constant))
124115
#define __OPENCL_PRIVATE_AS__ __attribute__((opencl_private))
125116
#else
126117
#define __OPENCL_GLOBAL_AS__
127-
#define __OPENCL_GLOBAL_DEVICE_AS__
128-
#define __OPENCL_GLOBAL_HOST_AS__
129118
#define __OPENCL_LOCAL_AS__
130119
#define __OPENCL_CONSTANT_AS__
131120
#define __OPENCL_PRIVATE_AS__
@@ -136,13 +125,6 @@ template <access::target accessTarget> struct TargetToAS {
136125
access::address_space::global_space;
137126
};
138127

139-
#ifdef __ENABLE_USM_ADDR_SPACE__
140-
template <> struct TargetToAS<access::target::device> {
141-
constexpr static access::address_space AS =
142-
access::address_space::ext_intel_global_device_space;
143-
};
144-
#endif // __ENABLE_USM_ADDR_SPACE__
145-
146128
template <> struct TargetToAS<access::target::local> {
147129
constexpr static access::address_space AS =
148130
access::address_space::local_space;
@@ -171,18 +153,6 @@ struct DecoratedType<ElementType, access::address_space::global_space> {
171153
using type = __OPENCL_GLOBAL_AS__ ElementType;
172154
};
173155

174-
template <typename ElementType>
175-
struct DecoratedType<ElementType,
176-
access::address_space::ext_intel_global_device_space> {
177-
using type = __OPENCL_GLOBAL_DEVICE_AS__ ElementType;
178-
};
179-
180-
template <typename ElementType>
181-
struct DecoratedType<ElementType,
182-
access::address_space::ext_intel_global_host_space> {
183-
using type = __OPENCL_GLOBAL_HOST_AS__ ElementType;
184-
};
185-
186156
template <typename ElementType>
187157
struct DecoratedType<ElementType, access::address_space::constant_space> {
188158
// Current implementation of address spaces handling leads to possibility
@@ -211,18 +181,6 @@ template <class T> struct deduce_AS_impl {
211181
access::address_space::generic_space;
212182
};
213183

214-
#ifdef __ENABLE_USM_ADDR_SPACE__
215-
template <class T> struct deduce_AS_impl<__OPENCL_GLOBAL_DEVICE_AS__ T> {
216-
static constexpr access::address_space value =
217-
access::address_space::ext_intel_global_device_space;
218-
};
219-
220-
template <class T> struct deduce_AS_impl<__OPENCL_GLOBAL_HOST_AS__ T> {
221-
static constexpr access::address_space value =
222-
access::address_space::ext_intel_global_host_space;
223-
};
224-
#endif // __ENABLE_USM_ADDR_SPACE__
225-
226184
template <class T> struct deduce_AS_impl<__OPENCL_GLOBAL_AS__ T> {
227185
static constexpr access::address_space value =
228186
access::address_space::global_space;
@@ -259,19 +217,6 @@ template <typename T> struct remove_decoration_impl<__OPENCL_GLOBAL_AS__ T> {
259217
using type = T;
260218
};
261219

262-
#ifdef __ENABLE_USM_ADDR_SPACE__
263-
template <typename T>
264-
struct remove_decoration_impl<__OPENCL_GLOBAL_DEVICE_AS__ T> {
265-
using type = T;
266-
};
267-
268-
template <typename T>
269-
struct remove_decoration_impl<__OPENCL_GLOBAL_HOST_AS__ T> {
270-
using type = T;
271-
};
272-
273-
#endif // __ENABLE_USM_ADDR_SPACE__
274-
275220
template <typename T> struct remove_decoration_impl<__OPENCL_PRIVATE_AS__ T> {
276221
using type = T;
277222
};
@@ -319,8 +264,6 @@ template <typename T>
319264
using remove_decoration_t = typename remove_decoration<T>::type;
320265

321266
#undef __OPENCL_GLOBAL_AS__
322-
#undef __OPENCL_GLOBAL_DEVICE_AS__
323-
#undef __OPENCL_GLOBAL_HOST_AS__
324267
#undef __OPENCL_LOCAL_AS__
325268
#undef __OPENCL_CONSTANT_AS__
326269
#undef __OPENCL_PRIVATE_AS__

sycl/include/sycl/accessor.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,13 +1701,8 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
17011701

17021702
template <int Dims = Dimensions>
17031703
operator typename std::enable_if_t<
1704-
Dims == 0 && AccessMode == access::mode::atomic,
1705-
#ifdef __ENABLE_USM_ADDR_SPACE__
1706-
atomic<DataT, access::address_space::global_space>
1707-
#else
1708-
atomic<DataT, AS>
1709-
#endif
1710-
>() const {
1704+
Dims == 0 && AccessMode == access::mode::atomic, atomic<DataT, AS>>()
1705+
const {
17111706
const size_t LinearIndex = getLinearIndex(id<AdjustedDim>());
17121707
return atomic<DataT, AS>(multi_ptr<DataT, AS, access::decorated::yes>(
17131708
getQualifiedPtr() + LinearIndex));

sycl/include/sycl/atomic.hpp

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ template <typename T> struct IsValidAtomicType {
4242
};
4343

4444
template <sycl::access::address_space AS> struct IsValidAtomicAddressSpace {
45-
static constexpr bool value =
46-
(AS == access::address_space::global_space ||
47-
AS == access::address_space::local_space ||
48-
AS == access::address_space::ext_intel_global_device_space);
45+
static constexpr bool value = (AS == access::address_space::global_space ||
46+
AS == access::address_space::local_space);
4947
};
5048

5149
// Type trait to translate a sycl::access::address_space to
@@ -54,11 +52,6 @@ template <access::address_space AS> struct GetSpirvMemoryScope {};
5452
template <> struct GetSpirvMemoryScope<access::address_space::global_space> {
5553
static constexpr auto scope = __spv::Scope::Device;
5654
};
57-
template <>
58-
struct GetSpirvMemoryScope<
59-
access::address_space::ext_intel_global_device_space> {
60-
static constexpr auto scope = __spv::Scope::Device;
61-
};
6255
template <> struct GetSpirvMemoryScope<access::address_space::local_space> {
6356
static constexpr auto scope = __spv::Scope::Workgroup;
6457
};
@@ -174,7 +167,7 @@ class __SYCL2020_DEPRECATED(
174167
"long long, float");
175168
static_assert(detail::IsValidAtomicAddressSpace<addressSpace>::value,
176169
"Invalid SYCL atomic address_space. Valid address spaces are: "
177-
"global_space, local_space, ext_intel_global_device_space");
170+
"global_space and local_space");
178171
static constexpr auto SpirvScope =
179172
detail::GetSpirvMemoryScope<addressSpace>::scope;
180173

@@ -201,27 +194,6 @@ class __SYCL2020_DEPRECATED(
201194
"T and pointerT must be same size");
202195
}
203196

204-
#ifdef __ENABLE_USM_ADDR_SPACE__
205-
// Create atomic in global_space with one from ext_intel_global_device_space
206-
template <access::address_space _Space = addressSpace,
207-
typename = typename std::enable_if_t<
208-
_Space == addressSpace &&
209-
addressSpace == access::address_space::global_space>>
210-
atomic(const atomic<T, access::address_space::ext_intel_global_device_space>
211-
&RHS) {
212-
Ptr = RHS.Ptr;
213-
}
214-
215-
template <access::address_space _Space = addressSpace,
216-
typename = typename std::enable_if_t<
217-
_Space == addressSpace &&
218-
addressSpace == access::address_space::global_space>>
219-
atomic(
220-
atomic<T, access::address_space::ext_intel_global_device_space> &&RHS) {
221-
Ptr = RHS.Ptr;
222-
}
223-
#endif // __ENABLE_USM_ADDR_SPACE__
224-
225197
void store(T Operand, memory_order Order = memory_order::relaxed) {
226198
__spirv_AtomicStore(Ptr, SpirvScope,
227199
detail::getSPIRVMemorySemanticsMask(Order), Operand);

sycl/include/sycl/atomic_ref.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ template <typename T> struct IsValidAtomicRefType {
4949
};
5050

5151
template <sycl::access::address_space AS> struct IsValidAtomicRefAddressSpace {
52-
static constexpr bool value =
53-
(AS == access::address_space::global_space ||
54-
AS == access::address_space::local_space ||
55-
AS == access::address_space::ext_intel_global_device_space ||
56-
AS == access::address_space::generic_space);
52+
static constexpr bool value = (AS == access::address_space::global_space ||
53+
AS == access::address_space::local_space ||
54+
AS == access::address_space::generic_space);
5755
};
5856

5957
// DefaultOrder parameter is limited to read-modify-write orders
@@ -129,8 +127,7 @@ class atomic_ref_base {
129127
"and pointer types");
130128
static_assert(detail::IsValidAtomicRefAddressSpace<AddressSpace>::value,
131129
"Invalid atomic address_space. Valid address spaces are: "
132-
"global_space, local_space, ext_intel_global_device_space, "
133-
"generic_space");
130+
"global_space, local_space, generic_space");
134131
static_assert(
135132
detail::IsValidDefaultOrder<DefaultOrder>::value,
136133
"Invalid default memory_order for atomics. Valid defaults are: "

sycl/include/sycl/detail/address_space_cast.hpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ address_space_cast_is_possible(access::address_space Src,
3030
if (Src == Dst || Src == generic_space || Dst == generic_space)
3131
return true;
3232

33-
// global_host/global_device could be casted to/from global
34-
auto global_space = access::address_space::global_space;
35-
auto global_device = access::address_space::ext_intel_global_device_space;
36-
auto global_host = access::address_space::ext_intel_global_host_space;
37-
38-
if (Src == global_space || Dst == global_space) {
39-
auto Other = Src == global_space ? Dst : Src;
40-
if (Other == global_device || Other == global_host)
41-
return true;
42-
}
43-
4433
// No more compatible combinations.
4534
return false;
4635
}
@@ -70,10 +59,6 @@ auto dynamic_address_cast(ElementType *Ptr) {
7059
constexpr auto global_space = access::address_space::global_space;
7160
constexpr auto local_space = access::address_space::local_space;
7261
constexpr auto private_space = access::address_space::private_space;
73-
constexpr auto global_device =
74-
access::address_space::ext_intel_global_device_space;
75-
constexpr auto global_host =
76-
access::address_space::ext_intel_global_host_space;
7762

7863
constexpr auto SrcAS = deduce_AS<ElementType *>::value;
7964
using dst_type = typename DecoratedType<
@@ -84,21 +69,6 @@ auto dynamic_address_cast(ElementType *Ptr) {
8469
return (dst_type) nullptr;
8570
} else if constexpr (Space == generic_space) {
8671
return (dst_type)Ptr;
87-
} else if constexpr (Space == global_space &&
88-
(SrcAS == global_device || SrcAS == global_host)) {
89-
return (dst_type)Ptr;
90-
} else if constexpr (SrcAS == global_space &&
91-
(Space == global_device || Space == global_host)) {
92-
#if defined(__ENABLE_USM_ADDR_SPACE__)
93-
static_assert(SupressNotImplementedAssert || Space != Space,
94-
"Not supported yet!");
95-
return detail::static_address_cast<Space>(Ptr);
96-
#else
97-
// If __ENABLE_USM_ADDR_SPACE__ isn't defined then both
98-
// global_device/global_host are just aliases for global_space.
99-
static_assert(std::is_same_v<dst_type, ElementType *>);
100-
return (dst_type)Ptr;
101-
#endif
10272
} else if constexpr (Space == global_space) {
10373
return (dst_type)__spirv_GenericCastToPtrExplicit_ToGlobal(
10474
const_cast<RemoveCvT *>(Ptr), __spv::StorageClass::CrossWorkgroup);
@@ -108,12 +78,6 @@ auto dynamic_address_cast(ElementType *Ptr) {
10878
} else if constexpr (Space == private_space) {
10979
return (dst_type)__spirv_GenericCastToPtrExplicit_ToPrivate(
11080
const_cast<RemoveCvT *>(Ptr), __spv::StorageClass::Function);
111-
#if !defined(__ENABLE_USM_ADDR_SPACE__)
112-
} else if constexpr (SrcAS == generic_space &&
113-
(Space == global_device || Space == global_host)) {
114-
return (dst_type)__spirv_GenericCastToPtrExplicit_ToGlobal(
115-
const_cast<RemoveCvT *>(Ptr), __spv::StorageClass::CrossWorkgroup);
116-
#endif
11781
} else {
11882
static_assert(SupressNotImplementedAssert || Space != Space,
11983
"Not supported yet!");

sycl/include/sycl/ext/intel/usm_pointers.hpp

Lines changed: 0 additions & 58 deletions
This file was deleted.

sycl/include/sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,7 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
263263
using reference =
264264
sycl::ext::oneapi::experimental::annotated_ref<T, property_list_t>;
265265

266-
#ifdef __ENABLE_USM_ADDR_SPACE__
267-
using global_pointer_t = std::conditional_t<
268-
detail::IsUsmKindDevice<property_list_t>::value,
269-
typename sycl::ext::intel::decorated_device_ptr<T>::pointer,
270-
std::conditional_t<
271-
detail::IsUsmKindHost<property_list_t>::value,
272-
typename sycl::ext::intel::decorated_host_ptr<T>::pointer,
273-
typename decorated_global_ptr<T>::pointer>>;
274-
#else
275266
using global_pointer_t = typename decorated_global_ptr<T>::pointer;
276-
#endif // __ENABLE_USM_ADDR_SPACE__
277267

278268
T *m_Ptr;
279269

sycl/include/sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr_properties.hpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,6 @@ struct PropertyMetaInfo<usm_kind_key::value_t<Kind>> {
5454
static constexpr const char *name = "sycl-usm-kind";
5555
static constexpr sycl::usm::alloc value = Kind;
5656
};
57-
58-
template <typename PropertyListT, sycl::usm::alloc Kind>
59-
inline constexpr bool is_usm_kind = []() constexpr {
60-
if constexpr (PropertyListT::template has_property<usm_kind_key>())
61-
return PropertyListT::template get_property<usm_kind_key>() ==
62-
usm_kind<Kind>;
63-
else
64-
return false;
65-
}();
66-
67-
template <typename PropertyListT>
68-
struct IsUsmKindDevice
69-
: std::bool_constant<is_usm_kind<PropertyListT, sycl::usm::alloc::device>> {
70-
};
71-
template <typename PropertyListT>
72-
struct IsUsmKindHost
73-
: std::bool_constant<is_usm_kind<PropertyListT, sycl::usm::alloc::host>> {};
74-
template <typename PropertyListT>
75-
struct IsUsmKindShared
76-
: std::bool_constant<is_usm_kind<PropertyListT, sycl::usm::alloc::shared>> {
77-
};
7857
} // namespace detail
7958

8059
} // namespace experimental

0 commit comments

Comments
 (0)