DPC++ Runtime
Runtime libraries for oneAPI DPC++
image_properties.hpp
Go to the documentation of this file.
1 //==----------- image_properties.hpp --- SYCL image properties -------------==//
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/context.hpp>
14 
15 namespace sycl {
17 namespace property {
18 namespace image {
19 class use_host_ptr : public detail::DataLessProperty<detail::ImageUseHostPtr> {
20 };
21 
22 class use_mutex : public detail::PropertyWithData<detail::ImageUseMutex> {
23 public:
24  use_mutex(std::mutex &MutexRef) : MMutex(MutexRef) {}
25 
26  std::mutex *get_mutex_ptr() const { return &MMutex; }
27 
28 private:
29  std::mutex &MMutex;
30 };
31 
33  : public detail::PropertyWithData<detail::ImageContextBound> {
34 public:
35  context_bound(sycl::context BoundContext) : MCtx(std::move(BoundContext)) {}
36 
37  sycl::context get_context() const { return MCtx; }
38 
39 private:
40  sycl::context MCtx;
41 };
42 } // namespace image
43 } // namespace property
44 
45 // Forward declaration
46 template <int Dimensions, typename AllocatorT> class image;
47 
48 // Image property trait specializations
49 template <>
50 struct is_property<property::image::use_host_ptr> : std::true_type {};
51 template <> struct is_property<property::image::use_mutex> : std::true_type {};
52 template <>
53 struct is_property<property::image::context_bound> : std::true_type {};
54 
55 template <int Dimensions, typename AllocatorT>
56 struct is_property_of<property::image::use_host_ptr,
57  image<Dimensions, AllocatorT>> : std::true_type {};
58 template <int Dimensions, typename AllocatorT>
59 struct is_property_of<property::image::use_mutex, image<Dimensions, AllocatorT>>
60  : std::true_type {};
61 template <int Dimensions, typename AllocatorT>
62 struct is_property_of<property::image::context_bound,
63  image<Dimensions, AllocatorT>> : std::true_type {};
64 
65 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
66 } // namespace sycl
sycl::_V1::image
Defines a shared image data.
Definition: image.hpp:181
property_traits.hpp
sycl::_V1::detail::DataLessProperty
Definition: property_helper.hpp:62
sycl::_V1::is_property
Definition: property_traits.hpp:15
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:13
context.hpp
sycl::_V1::is_property_of
Definition: property_traits.hpp:18
sycl::_V1::property::image::use_mutex::get_mutex_ptr
std::mutex * get_mutex_ptr() const
Definition: image_properties.hpp:26
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:13
sycl::_V1::property::image::use_mutex::use_mutex
use_mutex(std::mutex &MutexRef)
Definition: image_properties.hpp:24
sycl::_V1::property::image::context_bound::get_context
sycl::context get_context() const
Definition: image_properties.hpp:37
sycl::_V1::detail::PropertyWithData
Definition: property_helper.hpp:83
sycl::_V1::property::image::use_host_ptr
Definition: image_properties.hpp:19
property_helper.hpp
sycl::_V1::property::image::context_bound::context_bound
context_bound(sycl::context BoundContext)
Definition: image_properties.hpp:35
sycl::_V1::property::image::use_mutex
Definition: image_properties.hpp:22
std
Definition: accessor.hpp:3071
sycl::_V1::property::image::context_bound
Definition: image_properties.hpp:32