Skip to content

Commit 9ee5382

Browse files
Resolve constant_space TODO
1 parent 6a90fef commit 9ee5382

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sycl/include/sycl/access/access.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ namespace detail {
329329
inline constexpr bool
330330
address_space_cast_is_possible(access::address_space Src,
331331
access::address_space Dst) {
332+
// constant_space is unique and is not interchangeable with any other.
333+
auto constant_space = access::address_space::constant_space;
334+
if (Src == constant_space || Dst == constant_space)
335+
return Src == Dst;
336+
332337
auto generic_space = access::address_space::generic_space;
333338
if (Src == Dst || Src == generic_space || Dst == generic_space)
334339
return true;
@@ -348,7 +353,6 @@ address_space_cast_is_possible(access::address_space Src,
348353
return false;
349354
}
350355

351-
// TODO: Should generic <-> constant be allowed?
352356
template <access::address_space Space, typename ElementType>
353357
auto static_address_cast(ElementType *Ptr) {
354358
constexpr auto generic_space = access::address_space::generic_space;
@@ -394,6 +398,7 @@ auto static_address_cast(ElementType *Ptr) {
394398
}
395399
#endif
396400
}
401+
397402
// Previous implementation (`castAS`, used in `multi_ptr` ctors among other
398403
// places), used C-style cast instead of a proper dynamic check for some
399404
// backends/spaces. `SupressNotImplementedAssert = true` parameter is emulating

0 commit comments

Comments
 (0)