DPC++ Runtime
Runtime libraries for oneAPI DPC++
physical_mem.hpp
Go to the documentation of this file.
1
//==--- physical_mem.hpp - sycl_ext_oneapi_virtual_mem physical_mem class --==//
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/access/access.hpp
>
12
#include <
sycl/context.hpp
>
13
#include <
sycl/detail/common.hpp
>
14
#include <
sycl/detail/owner_less_base.hpp
>
15
#include <
sycl/device.hpp
>
16
#include <
sycl/queue.hpp
>
17
18
namespace
sycl
{
19
inline
namespace
_V1 {
20
21
namespace
detail {
22
class
physical_mem_impl;
23
}
// namespace detail
24
25
namespace
ext::oneapi::experimental {
26
27
enum class
address_access_mode
: char {
none
= 0,
read
= 1,
read_write
= 2 };
28
29
class
__SYCL_EXPORT
physical_mem
30
:
public
sycl::detail::OwnerLessBase
<physical_mem> {
31
public
:
32
physical_mem
(
const
device
&SyclDevice,
const
context
&SyclContext,
33
size_t
NumBytes);
34
35
physical_mem
(
const
queue
&SyclQueue,
size_t
NumBytes)
36
:
physical_mem
(SyclQueue.
get_device
(), SyclQueue.get_context(),
37
NumBytes) {}
38
39
physical_mem
(
const
physical_mem
&rhs) =
default
;
40
physical_mem
(
physical_mem
&&rhs) =
default
;
41
42
physical_mem
&
operator=
(
const
physical_mem
&rhs) =
default
;
43
physical_mem
&
operator=
(
physical_mem
&&rhs) =
default
;
44
45
~physical_mem
()
noexcept
(false) {};
46
47
bool
operator==
(
const
physical_mem
&rhs)
const
{
return
impl == rhs.impl; }
48
bool
operator!=
(
const
physical_mem
&rhs)
const
{
return
!(*
this
== rhs); }
49
50
void
*map(uintptr_t Ptr,
size_t
NumBytes,
address_access_mode
Mode
,
51
size_t
Offset = 0)
const
;
52
53
context
get_context()
const
;
54
device
get_device
()
const
;
55
56
size_t
size() const
noexcept
;
57
58
private:
59
std
::shared_ptr<
sycl
::detail::physical_mem_impl> impl;
60
61
template <class Obj>
62
friend const decltype(Obj::impl) &
63
sycl
::detail::
getSyclObjImpl
(const Obj &SyclObject);
64
65
template <class T>
66
friend T
sycl
::detail::
createSyclObjFromImpl
(decltype(T::impl) ImplObj);
67
};
68
69
}
// namespace ext::oneapi::experimental
70
}
// namespace _V1
71
}
// namespace sycl
72
73
namespace
std
{
74
template
<>
struct
hash<
sycl
::ext::oneapi::experimental::physical_mem> {
75
size_t
operator()
(
76
const
sycl::ext::oneapi::experimental::physical_mem
&PhysicalMem)
const
{
77
return
hash<std::shared_ptr<sycl::detail::physical_mem_impl>>()(
78
sycl::detail::getSyclObjImpl
(PhysicalMem));
79
}
80
};
81
}
// namespace std
access.hpp
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition:
context.hpp:50
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition:
device.hpp:64
sycl::_V1::ext::oneapi::experimental::physical_mem
Definition:
physical_mem.hpp:30
sycl::_V1::ext::oneapi::experimental::physical_mem::operator!=
bool operator!=(const physical_mem &rhs) const
Definition:
physical_mem.hpp:48
sycl::_V1::ext::oneapi::experimental::physical_mem::physical_mem
physical_mem(const queue &SyclQueue, size_t NumBytes)
Definition:
physical_mem.hpp:35
sycl::_V1::ext::oneapi::experimental::physical_mem::operator=
physical_mem & operator=(physical_mem &&rhs)=default
sycl::_V1::ext::oneapi::experimental::physical_mem::operator=
physical_mem & operator=(const physical_mem &rhs)=default
sycl::_V1::ext::oneapi::experimental::physical_mem::physical_mem
physical_mem(physical_mem &&rhs)=default
sycl::_V1::ext::oneapi::experimental::physical_mem::~physical_mem
~physical_mem() noexcept(false)
Definition:
physical_mem.hpp:45
sycl::_V1::ext::oneapi::experimental::physical_mem::physical_mem
physical_mem(const physical_mem &rhs)=default
sycl::_V1::ext::oneapi::experimental::physical_mem::operator==
bool operator==(const physical_mem &rhs) const
Definition:
physical_mem.hpp:47
sycl::_V1::queue
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition:
queue.hpp:110
sycl::OwnerLessBase
context.hpp
common.hpp
std
Definition:
accessor.hpp:2915
sycl::_V1::detail::getSyclObjImpl
decltype(Obj::impl) const & getSyclObjImpl(const Obj &SyclObject)
Definition:
impl_utils.hpp:31
sycl::_V1::detail::createSyclObjFromImpl
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
Definition:
impl_utils.hpp:40
sycl::_V1::ext::oneapi::experimental::address_access_mode
address_access_mode
Definition:
physical_mem.hpp:27
sycl::_V1::ext::oneapi::experimental::address_access_mode::read_write
@ read_write
sycl::_V1::ext::oneapi::experimental::address_access_mode::none
@ none
sycl::_V1::ext::oneapi::experimental::address_access_mode::read
@ read
sycl::_V1::Mode
Mode
Definition:
multi_ptr.hpp:504
sycl
Definition:
access.hpp:18
syclcompat::get_device
static device_ext & get_device(unsigned int id)
Util function to get a device by id.
Definition:
device.hpp:915
owner_less_base.hpp
queue.hpp
noexcept
_Abi const simd< _Tp, _Abi > & noexcept
Definition:
simd.hpp:1324
std::hash< sycl::ext::oneapi::experimental::physical_mem >::operator()
size_t operator()(const sycl::ext::oneapi::experimental::physical_mem &PhysicalMem) const
Definition:
physical_mem.hpp:75
device.hpp
include
sycl
ext
oneapi
virtual_mem
physical_mem.hpp
Generated by
1.9.1