DPC++ Runtime
Runtime libraries for oneAPI DPC++
property_helper.hpp
Go to the documentation of this file.
1 //==--------- property_helper.hpp --- SYCL property helper -----------------==//
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 
12 
14 namespace sycl {
15 
16 namespace detail {
17 
18 // All properties are split here to dataless properties and properties with
19 // data. A dataless property is one which has no data stored in it. A property
20 // with data is one which has data stored in it and usually provides and access
21 // to it. For dataless property we just store a bool which indicates if a
22 // property is set or not. For properties with data we store a pointer to the
23 // base class because we do not know the size of such properties beforehand.
24 
25 // List of all dataless properties' IDs
30  InOrder = 3,
31  NoInit = 4,
38  // Indicates the last known dataless property.
40  // Exceeding 32 may cause ABI breaking change on some of OSes.
42 };
43 
44 // List of all properties with data IDs
53 };
54 
55 // Base class for dataless properties, needed to check that the type of an
56 // object passed to the property_list is a property.
58 
59 // Helper class for the dataless properties. Every such property is supposed
60 // to inherit from it. The ID template parameter should be one from
61 // DataLessPropKind.
62 template <int ID> class DataLessProperty : DataLessPropertyBase {
63 public:
64  static constexpr int getKind() { return ID; }
65 };
66 
67 // Base class for properties with data, needed to check that the type of an
68 // object passed to the property_list is a property and for checking if two
69 // properties with data are of the same type.
71 public:
72  PropertyWithDataBase(int ID) : MID(ID) {}
73  bool isSame(int ID) const { return ID == MID; }
74  virtual ~PropertyWithDataBase() = default;
75 
76 private:
77  int MID = -1;
78 };
79 
80 // Helper class for the properties with data. Every such property is supposed
81 // to inherit from it. The ID template parameter should be one from
82 // PropWithDataKind.
83 template <int ID> class PropertyWithData : public PropertyWithDataBase {
84 public:
86  static int getKind() { return ID; }
87 };
88 
89 } // namespace detail
90 
91 } // namespace sycl
92 } // __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::detail::DataLessPropKind
DataLessPropKind
Definition: property_helper.hpp:26
cl::sycl::detail::AccPropBufferLocation
@ AccPropBufferLocation
Definition: property_helper.hpp:51
cl::sycl::detail::DataLessPropKindSize
@ DataLessPropKindSize
Definition: property_helper.hpp:41
cl::sycl::detail::DataLessProperty::getKind
static constexpr int getKind()
Definition: property_helper.hpp:64
cl::sycl::detail::DataLessPropertyBase
Definition: property_helper.hpp:57
cl::sycl::detail::BufferContextBound
@ BufferContextBound
Definition: property_helper.hpp:47
cl::sycl::detail::NoInit
@ NoInit
Definition: property_helper.hpp:31
cl::sycl::detail::PropertyWithDataBase::PropertyWithDataBase
PropertyWithDataBase(int ID)
Definition: property_helper.hpp:72
cl::sycl::detail::UsePrimaryContext
@ UsePrimaryContext
Definition: property_helper.hpp:33
cl::sycl::detail::PropertyWithData::PropertyWithData
PropertyWithData()
Definition: property_helper.hpp:85
cl::sycl::detail::BufferUseHostPtr
@ BufferUseHostPtr
Definition: property_helper.hpp:27
sycl
Definition: invoke_simd.hpp:68
cl::sycl::detail::UseDefaultStream
@ UseDefaultStream
Definition: property_helper.hpp:35
cl::sycl::detail::InOrder
@ InOrder
Definition: property_helper.hpp:30
cl::sycl::detail::PropertyWithDataBase::isSame
bool isSame(int ID) const
Definition: property_helper.hpp:73
cl::sycl::detail::DataLessProperty
Definition: property_helper.hpp:62
cl::sycl::detail::PropertyWithDataBase
Definition: property_helper.hpp:70
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::detail::PropertyWithData::getKind
static int getKind()
Definition: property_helper.hpp:86
cl::sycl::detail::PropWithDataKindSize
@ PropWithDataKindSize
Definition: property_helper.hpp:52
cl::sycl::detail::DiscardEvents
@ DiscardEvents
Definition: property_helper.hpp:36
cl::sycl::detail::BufferUsePinnedHostMemory
@ BufferUsePinnedHostMemory
Definition: property_helper.hpp:32
cl::sycl::detail::InitializeToIdentity
@ InitializeToIdentity
Definition: property_helper.hpp:34
cl::sycl::detail::BufferMemChannel
@ BufferMemChannel
Definition: property_helper.hpp:50
cl::sycl::detail::DeviceReadOnly
@ DeviceReadOnly
Definition: property_helper.hpp:37
cl::sycl::detail::LastKnownDataLessPropKind
@ LastKnownDataLessPropKind
Definition: property_helper.hpp:39
cl::sycl::detail::ImageUseMutex
@ ImageUseMutex
Definition: property_helper.hpp:48
common.hpp
cl::sycl::detail::ImageContextBound
@ ImageContextBound
Definition: property_helper.hpp:49
cl::sycl::detail::BufferUseMutex
@ BufferUseMutex
Definition: property_helper.hpp:46
cl::sycl::detail::PropertyWithData
Definition: property_helper.hpp:83
cl::sycl::detail::ImageUseHostPtr
@ ImageUseHostPtr
Definition: property_helper.hpp:28
cl::sycl::detail::PropWithDataKind
PropWithDataKind
Definition: property_helper.hpp:45
cl::sycl::detail::QueueEnableProfiling
@ QueueEnableProfiling
Definition: property_helper.hpp:29
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12