DPC++ Runtime
Runtime libraries for oneAPI DPC++
address_cast.hpp
Go to the documentation of this file.
1 //==----------- address_cast.hpp - sycl_ext_oneapi_address_cast ------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <sycl/detail/spirv.hpp>
12 #include <sycl/multi_ptr.hpp>
13 
14 namespace sycl {
15 inline namespace _V1 {
16 namespace ext {
17 namespace oneapi {
18 namespace experimental {
19 
20 template <access::address_space Space, access::decorated DecorateAddress,
21  typename ElementType>
22 multi_ptr<ElementType, Space, DecorateAddress>
23 static_address_cast(ElementType *Ptr) {
24 #ifdef __SYCL_DEVICE_ONLY__
25  auto CastPtr = sycl::detail::spirv::GenericCastToPtr<Space>(Ptr);
27 #else
29 #endif
30 }
31 
32 template <access::address_space Space, access::decorated DecorateAddress,
33  typename ElementType>
35 dynamic_address_cast(ElementType *Ptr) {
36 #ifdef __SYCL_DEVICE_ONLY__
37  auto CastPtr = sycl::detail::spirv::GenericCastToPtrExplicit<Space>(Ptr);
39 #else
41 #endif
42 }
43 
44 } // namespace experimental
45 } // namespace oneapi
46 } // namespace ext
47 } // namespace _V1
48 } // namespace sycl
multi_ptr< ElementType, Space, DecorateAddress > dynamic_address_cast(ElementType *Ptr)
multi_ptr< ElementType, Space, DecorateAddress > static_address_cast(ElementType *Ptr)
Definition: access.hpp:18