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);
26
return
multi_ptr<ElementType, Space, DecorateAddress>
(CastPtr);
27
#else
28
return
multi_ptr<ElementType, Space, DecorateAddress>
(Ptr);
29
#endif
30
}
31
32
template
<
access::address_space
Space,
access::decorated
DecorateAddress,
33
typename
ElementType>
34
multi_ptr<ElementType, Space, DecorateAddress>
35
dynamic_address_cast
(ElementType *Ptr) {
36
#ifdef __SYCL_DEVICE_ONLY__
37
auto
CastPtr = sycl::detail::spirv::GenericCastToPtrExplicit<Space>(Ptr);
38
return
multi_ptr<ElementType, Space, DecorateAddress>
(CastPtr);
39
#else
40
return
multi_ptr<ElementType, Space, DecorateAddress>
(Ptr);
41
#endif
42
}
43
44
}
// namespace experimental
45
}
// namespace oneapi
46
}
// namespace ext
47
}
// namespace _V1
48
}
// namespace sycl
sycl::_V1::multi_ptr
Definition:
atomic.hpp:34
multi_ptr.hpp
sycl::_V1::access::decorated
decorated
Definition:
access.hpp:63
sycl::_V1::access::address_space
address_space
Definition:
access.hpp:51
sycl::_V1::ext::oneapi::experimental::dynamic_address_cast
multi_ptr< ElementType, Space, DecorateAddress > dynamic_address_cast(ElementType *Ptr)
Definition:
address_cast.hpp:35
sycl::_V1::ext::oneapi::experimental::static_address_cast
multi_ptr< ElementType, Space, DecorateAddress > static_address_cast(ElementType *Ptr)
Definition:
address_cast.hpp:23
sycl
Definition:
access.hpp:18
spirv.hpp
include
sycl
ext
oneapi
experimental
address_cast.hpp
Generated by
1.9.1