DPC++ Runtime
Runtime libraries for oneAPI DPC++
owner_less.hpp
Go to the documentation of this file.
1 //==-------------- weak_object.hpp --- SYCL weak objects -------------------==//
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/accessor.hpp>
12 #include <sycl/buffer.hpp>
13 #include <sycl/context.hpp>
15 #include <sycl/device.hpp>
16 #include <sycl/event.hpp>
18 #include <sycl/kernel.hpp>
19 #include <sycl/kernel_bundle.hpp>
20 #include <sycl/platform.hpp>
21 #include <sycl/queue.hpp>
22 
23 namespace sycl {
25 namespace ext::oneapi {
26 
27 namespace detail {
28 template <typename SyclObject> struct owner_less_base {
29  bool operator()(const SyclObject &lhs, const SyclObject &rhs) const noexcept {
30  return lhs.ext_oneapi_owner_before(rhs);
31  }
32 
34  const weak_object<SyclObject> &rhs) const noexcept {
35  return lhs.owner_before(rhs);
36  }
37 
38  bool operator()(const SyclObject &lhs,
39  const weak_object<SyclObject> &rhs) const noexcept {
40  return lhs.ext_oneapi_owner_before(rhs);
41  }
42 
44  const SyclObject &rhs) const noexcept {
45  return lhs.owner_before(rhs);
46  }
47 };
48 } // namespace detail
49 
50 template <typename SyclObject> struct owner_less;
51 
52 template <>
53 struct owner_less<context> : public detail::owner_less_base<context> {};
54 template <>
55 struct owner_less<device> : public detail::owner_less_base<device> {};
56 template <> struct owner_less<event> : public detail::owner_less_base<event> {};
57 template <>
58 struct owner_less<kernel> : public detail::owner_less_base<kernel> {};
59 template <>
60 struct owner_less<kernel_id> : public detail::owner_less_base<kernel_id> {};
61 template <>
62 struct owner_less<platform> : public detail::owner_less_base<platform> {};
63 template <> struct owner_less<queue> : public detail::owner_less_base<queue> {};
64 
65 template <bundle_state State>
66 struct owner_less<device_image<State>>
67  : public detail::owner_less_base<device_image<State>> {};
68 
69 template <bundle_state State>
70 struct owner_less<kernel_bundle<State>>
71  : public detail::owner_less_base<kernel_bundle<State>> {};
72 
73 template <typename DataT, int Dimensions, typename AllocatorT>
74 struct owner_less<buffer<DataT, Dimensions, AllocatorT>>
75  : public detail::owner_less_base<buffer<DataT, Dimensions, AllocatorT>> {};
76 
77 template <typename DataT, int Dimensions, access_mode AccessMode,
78  target AccessTarget, access::placeholder isPlaceholder>
79 struct owner_less<
80  accessor<DataT, Dimensions, AccessMode, AccessTarget, isPlaceholder>>
81  : public detail::owner_less_base<accessor<DataT, Dimensions, AccessMode,
82  AccessTarget, isPlaceholder>> {};
83 
84 template <typename DataT, int Dimensions, access_mode AccessMode>
86  : public detail::owner_less_base<
87  host_accessor<DataT, Dimensions, AccessMode>> {};
88 
89 template <typename DataT, int Dimensions>
91  : public detail::owner_less_base<host_accessor<DataT, Dimensions>> {};
92 
93 template <typename DataT, int Dimensions>
95  : public detail::owner_less_base<local_accessor<DataT, Dimensions>> {};
96 
97 } // namespace ext::oneapi
98 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
99 } // namespace sycl
sycl::_V1::access::mode
mode
Definition: access.hpp:30
device.hpp
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::ext::oneapi::detail::owner_less_base
Definition: owner_less.hpp:28
sycl::_V1::buffer
Defines a shared array that can be used by kernels in queues.
Definition: buffer.hpp:37
context.hpp
event.hpp
sycl::_V1::host_accessor
Definition: accessor.hpp:3011
sycl::_V1::Dimensions
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS Dimensions
Definition: accessor.hpp:2854
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::ext::oneapi::owner_less
Definition: owner_less.hpp:50
sycl::_V1::device_image
Objects of the class represents an instance of an image in a specific state.
Definition: kernel_bundle.hpp:108
sycl::_V1::event
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:40
sycl::_V1::ext::oneapi::detail::owner_less_base::operator()
bool operator()(const SyclObject &lhs, const weak_object< SyclObject > &rhs) const noexcept
Definition: owner_less.hpp:38
sycl::_V1::kernel
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:71
sycl::_V1::ext::oneapi::detail::owner_less_base::operator()
bool operator()(const SyclObject &lhs, const SyclObject &rhs) const noexcept
Definition: owner_less.hpp:29
sycl::_V1::access::placeholder
placeholder
Definition: access.hpp:45
defines_elementary.hpp
sycl::_V1::ext::oneapi::detail::owner_less_base::operator()
bool operator()(const weak_object< SyclObject > &lhs, const weak_object< SyclObject > &rhs) const noexcept
Definition: owner_less.hpp:33
kernel.hpp
kernel_bundle.hpp
sycl::_V1::queue
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:89
sycl::_V1::ext::oneapi::weak_object
Definition: buffer.hpp:40
weak_object.hpp
sycl::_V1::kernel_id
Objects of the class identify kernel is some kernel_bundle related APIs.
Definition: kernel_bundle.hpp:44
sycl::_V1::kernel_bundle
The kernel_bundle class represents collection of device images in a particular state.
Definition: kernel.hpp:29
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:49
queue.hpp
sycl::_V1::access::target
target
Definition: access.hpp:18
sycl::_V1::accessor
Definition: accessor.hpp:225
accessor.hpp
platform.hpp
sycl::_V1::local_accessor
Definition: multi_ptr.hpp:68
buffer.hpp
sycl::_V1::platform
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:45
sycl::_V1::AccessMode
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS AccessMode
Definition: accessor.hpp:2854
sycl::_V1::ext::oneapi::detail::owner_less_base::operator()
bool operator()(const weak_object< SyclObject > &lhs, const SyclObject &rhs) const noexcept
Definition: owner_less.hpp:43
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:41