51 "space is deprecated since SYCL 2020") =
78 inline constexpr mode_target_tag_t<access_mode::read, target::constant_buffer>
80 inline constexpr mode_target_tag_t<access_mode::read, target::host_task>
90 return T == access::target::host_buffer || T == access::target::host_image;
99 return m != access::mode::read;
110 #ifdef __SYCL_DEVICE_ONLY__
111 #define __OPENCL_GLOBAL_AS__ __attribute__((opencl_global))
112 #ifdef __ENABLE_USM_ADDR_SPACE__
113 #define __OPENCL_GLOBAL_DEVICE_AS__ __attribute__((opencl_global_device))
114 #define __OPENCL_GLOBAL_HOST_AS__ __attribute__((opencl_global_host))
116 #define __OPENCL_GLOBAL_DEVICE_AS__ __attribute__((opencl_global))
117 #define __OPENCL_GLOBAL_HOST_AS__ __attribute__((opencl_global))
118 #endif // __ENABLE_USM_ADDR_SPACE__
119 #define __OPENCL_LOCAL_AS__ __attribute__((opencl_local))
120 #define __OPENCL_CONSTANT_AS__ __attribute__((opencl_constant))
121 #define __OPENCL_PRIVATE_AS__ __attribute__((opencl_private))
123 #define __OPENCL_GLOBAL_AS__
124 #define __OPENCL_GLOBAL_DEVICE_AS__
125 #define __OPENCL_GLOBAL_HOST_AS__
126 #define __OPENCL_LOCAL_AS__
127 #define __OPENCL_CONSTANT_AS__
128 #define __OPENCL_PRIVATE_AS__
133 access::address_space::global_space;
136 #ifdef __ENABLE_USM_ADDR_SPACE__
137 template <>
struct TargetToAS<access::target::device> {
139 access::address_space::ext_intel_global_device_space;
141 #endif // __ENABLE_USM_ADDR_SPACE__
145 access::address_space::local_space;
148 template <>
struct TargetToAS<access::target::constant_buffer> {
150 access::address_space::constant_space;
153 template <
typename ElementType, access::address_space addressSpace>
156 template <
typename ElementType>
161 template <
typename ElementType>
166 template <
typename ElementType>
171 template <
typename ElementType>
173 access::address_space::ext_intel_global_device_space> {
177 template <
typename ElementType>
179 access::address_space::ext_intel_global_host_space> {
183 template <
typename ElementType>
190 #if defined(RESTRICT_WRITE_ACCESS_TO_CONSTANT_PTR)
197 template <
typename ElementType>
202 #ifdef __SYCL_DEVICE_ONLY__
203 template <
class T>
struct deduce_AS_impl {
208 access::address_space::generic_space;
211 #ifdef __ENABLE_USM_ADDR_SPACE__
214 access::address_space::ext_intel_global_device_space;
219 access::address_space::ext_intel_global_host_space;
221 #endif // __ENABLE_USM_ADDR_SPACE__
225 access::address_space::global_space;
230 access::address_space::private_space;
235 access::address_space::local_space;
240 access::address_space::constant_space;
246 std::remove_pointer_t<std::remove_reference_t<std::remove_cv_t<T>>>> {
281 #ifdef __SYCL_DEVICE_ONLY__
286 #ifdef __ENABLE_USM_ADDR_SPACE__
295 #endif // __ENABLE_USM_ADDR_SPACE__
308 #endif // __SYCL_DEVICE_ONLY__
310 template <
typename T>
316 template <
typename ToT,
typename FromT>
inline ToT
cast_AS(FromT from) {
317 #ifdef __SYCL_DEVICE_ONLY__
320 if constexpr (FromAS == access::address_space::generic_space) {
321 #if defined(__NVPTX__) || defined(__AMDGCN__)
328 using ToElemT = std::remove_pointer_t<remove_decoration_t<ToT>>;
329 if constexpr (ToAS == access::address_space::global_space)
330 return __SYCL_GenericCastToPtrExplicit_ToGlobal<ToElemT>(from);
331 else if constexpr (ToAS == access::address_space::local_space)
332 return __SYCL_GenericCastToPtrExplicit_ToLocal<ToElemT>(from);
333 else if constexpr (ToAS == access::address_space::private_space)
334 return __SYCL_GenericCastToPtrExplicit_ToPrivate<ToElemT>(from);
335 #ifdef __ENABLE_USM_ADDR_SPACE__
337 ext_intel_global_device_space ||
339 access::address_space::ext_intel_global_host_space)
344 #endif // __ENABLE_USM_ADDR_SPACE__
346 return reinterpret_cast<ToT
>(from);
347 #endif // defined(__NVPTX__) || defined(__AMDGCN__)
349 #ifdef __ENABLE_USM_ADDR_SPACE__
350 if constexpr (FromAS == access::address_space::global_space &&
352 access::address_space::ext_intel_global_device_space ||
354 access::address_space::ext_intel_global_host_space)) {
359 #endif // __ENABLE_USM_ADDR_SPACE__
360 #endif // __SYCL_DEVICE_ONLY__
362 return reinterpret_cast<ToT
>(from);
368 #undef __OPENCL_GLOBAL_AS__
369 #undef __OPENCL_GLOBAL_DEVICE_AS__
370 #undef __OPENCL_GLOBAL_HOST_AS__
371 #undef __OPENCL_LOCAL_AS__
372 #undef __OPENCL_CONSTANT_AS__
373 #undef __OPENCL_PRIVATE_AS__