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 <CL/sycl/context.hpp>
14 
16 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 } // namespace sycl
66 } // __SYCL_INLINE_NAMESPACE(cl)
property_traits.hpp
cl::sycl::property::image::use_mutex
Definition: image_properties.hpp:22
cl::sycl::property::image::context_bound::context_bound
context_bound(sycl::context BoundContext)
Definition: image_properties.hpp:35
context.hpp
sycl
Definition: invoke_simd.hpp:68
cl::sycl::property::image::use_host_ptr
Definition: image_properties.hpp:19
cl::sycl::is_property
Definition: property_traits.hpp:15
cl::sycl::detail::DataLessProperty
Definition: property_helper.hpp:62
cl::sycl::is_property_of
Definition: property_traits.hpp:18
cl::sycl::property::image::context_bound
Definition: image_properties.hpp:32
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::property::image::use_mutex::get_mutex_ptr
std::mutex * get_mutex_ptr() const
Definition: image_properties.hpp:26
cl::sycl::image
Defines a shared image data.
Definition: image_impl.hpp:29
property_helper.hpp
cl::sycl::property::image::context_bound::get_context
sycl::context get_context() const
Definition: image_properties.hpp:37
std
Definition: accessor.hpp:2616
cl::sycl::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:35
cl::sycl::detail::PropertyWithData
Definition: property_helper.hpp:83
cl::sycl::property::image::use_mutex::use_mutex
use_mutex(std::mutex &MutexRef)
Definition: image_properties.hpp:24
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12