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 
11 namespace sycl {
12 inline namespace _V1 {
13 
14 namespace detail {
15 
16 // All properties are split here to dataless properties and properties with
17 // data. A dataless property is one which has no data stored in it. A property
18 // with data is one which has data stored in it and usually provides and access
19 // to it. For dataless property we just store a bool which indicates if a
20 // property is set or not. For properties with data we store a pointer to the
21 // base class because we do not know the size of such properties beforehand.
22 
23 // List of all dataless properties' IDs
28  InOrder = 3,
29  NoInit = 4,
50  // Indicates the last known dataless property.
52  // Exceeding 32 may cause ABI breaking change on some of OSes.
54 };
55 
56 // List of all properties with data IDs
67 };
68 
69 // Base class for dataless properties, needed to check that the type of an
70 // object passed to the property_list is a property.
72 
73 // Helper class for the dataless properties. Every such property is supposed
74 // to inherit from it. The ID template parameter should be one from
75 // DataLessPropKind.
76 template <int ID> class DataLessProperty : DataLessPropertyBase {
77 public:
78  static constexpr int getKind() { return ID; }
79 };
80 
81 // Base class for properties with data, needed to check that the type of an
82 // object passed to the property_list is a property and for checking if two
83 // properties with data are of the same type.
85 public:
86  PropertyWithDataBase(int ID) : MID(ID) {}
87  bool isSame(int ID) const { return ID == MID; }
88  virtual ~PropertyWithDataBase() = default;
89 
90 private:
91  int MID = -1;
92 };
93 
94 // Helper class for the properties with data. Every such property is supposed
95 // to inherit from it. The ID template parameter should be one from
96 // PropWithDataKind.
97 template <int ID> class PropertyWithData : public PropertyWithDataBase {
98 public:
100  static int getKind() { return ID; }
101 };
102 
103 } // namespace detail
104 
105 } // namespace _V1
106 } // namespace sycl
sycl::_V1::detail::AccPropBufferLocation
@ AccPropBufferLocation
Definition: property_helper.hpp:63
sycl::_V1::detail::FusionPromoteLocal
@ FusionPromoteLocal
Definition: property_helper.hpp:37
sycl::_V1::detail::BufferContextBound
@ BufferContextBound
Definition: property_helper.hpp:59
sycl::_V1::detail::DataLessProperty
Definition: property_helper.hpp:76
sycl::_V1::detail::BufferMemChannel
@ BufferMemChannel
Definition: property_helper.hpp:62
sycl::_V1::detail::LastKnownDataLessPropKind
@ LastKnownDataLessPropKind
Definition: property_helper.hpp:51
sycl::_V1::detail::DataLessProperty::getKind
static constexpr int getKind()
Definition: property_helper.hpp:78
sycl::_V1::detail::QueuePriorityHigh
@ QueuePriorityHigh
Definition: property_helper.hpp:43
sycl::_V1::detail::ImageUseHostPtr
@ ImageUseHostPtr
Definition: property_helper.hpp:26
sycl::_V1::detail::QueueSubmissionImmediate
@ QueueSubmissionImmediate
Definition: property_helper.hpp:46
sycl::_V1::detail::DeviceReadOnly
@ DeviceReadOnly
Definition: property_helper.hpp:35
sycl::_V1::detail::InOrder
@ InOrder
Definition: property_helper.hpp:28
sycl::_V1::detail::FusionNoBarrier
@ FusionNoBarrier
Definition: property_helper.hpp:38
sycl::_V1::detail::GraphDependOnAllLeaves
@ GraphDependOnAllLeaves
Definition: property_helper.hpp:49
sycl::_V1::detail::PropertyWithDataBase::PropertyWithDataBase
PropertyWithDataBase(int ID)
Definition: property_helper.hpp:86
sycl::_V1::detail::PropWithDataKind
PropWithDataKind
Definition: property_helper.hpp:57
sycl::_V1::detail::DiscardEvents
@ DiscardEvents
Definition: property_helper.hpp:34
sycl::_V1::detail::QueuePriorityLow
@ QueuePriorityLow
Definition: property_helper.hpp:42
sycl::_V1::detail::DataLessPropKindSize
@ DataLessPropKindSize
Definition: property_helper.hpp:53
sycl
Definition: access.hpp:18
sycl::_V1::detail::GraphNoCycleCheck
@ GraphNoCycleCheck
Definition: property_helper.hpp:44
sycl::_V1::detail::ImageUseMutex
@ ImageUseMutex
Definition: property_helper.hpp:60
sycl::_V1::detail::GraphNodeDependencies
@ GraphNodeDependencies
Definition: property_helper.hpp:65
sycl::_V1::detail::PropertyWithData::getKind
static int getKind()
Definition: property_helper.hpp:100
sycl::_V1::detail::UsePrimaryContext
@ UsePrimaryContext
Definition: property_helper.hpp:31
sycl::_V1::detail::FusionPromotePrivate
@ FusionPromotePrivate
Definition: property_helper.hpp:36
sycl::_V1::detail::PropertyWithData
Definition: property_helper.hpp:97
sycl::_V1::detail::PropertyWithDataBase::~PropertyWithDataBase
virtual ~PropertyWithDataBase()=default
sycl::_V1::detail::DataLessPropertyBase
Definition: property_helper.hpp:71
sycl::_V1::detail::QueueComputeIndex
@ QueueComputeIndex
Definition: property_helper.hpp:64
sycl::_V1::detail::ImageContextBound
@ ImageContextBound
Definition: property_helper.hpp:61
sycl::_V1::detail::BufferUseHostPtr
@ BufferUseHostPtr
Definition: property_helper.hpp:25
sycl::_V1::detail::QueueEnableProfiling
@ QueueEnableProfiling
Definition: property_helper.hpp:27
sycl::_V1::detail::PropertyWithDataBase
Definition: property_helper.hpp:84
sycl::_V1::detail::BufferUseMutex
@ BufferUseMutex
Definition: property_helper.hpp:58
sycl::_V1::detail::PropertyWithDataBase::isSame
bool isSame(int ID) const
Definition: property_helper.hpp:87
sycl::_V1::detail::QueuePriorityNormal
@ QueuePriorityNormal
Definition: property_helper.hpp:41
sycl::_V1::detail::BufferUsePinnedHostMemory
@ BufferUsePinnedHostMemory
Definition: property_helper.hpp:30
sycl::_V1::detail::DataLessPropKind
DataLessPropKind
Definition: property_helper.hpp:24
sycl::_V1::detail::FusionEnable
@ FusionEnable
Definition: property_helper.hpp:39
sycl::_V1::detail::FusionForce
@ FusionForce
Definition: property_helper.hpp:40
sycl::_V1::detail::GraphAssumeDataOutlivesBuffer
@ GraphAssumeDataOutlivesBuffer
Definition: property_helper.hpp:47
sycl::_V1::detail::PropertyWithData::PropertyWithData
PropertyWithData()
Definition: property_helper.hpp:99
sycl::_V1::detail::QueueSubmissionBatched
@ QueueSubmissionBatched
Definition: property_helper.hpp:45
sycl::_V1::detail::NoInit
@ NoInit
Definition: property_helper.hpp:29
sycl::_V1::detail::PropWithDataKindSize
@ PropWithDataKindSize
Definition: property_helper.hpp:66
sycl::_V1::detail::UseDefaultStream
@ UseDefaultStream
Definition: property_helper.hpp:33
sycl::_V1::detail::InitializeToIdentity
@ InitializeToIdentity
Definition: property_helper.hpp:32
sycl::_V1::detail::GraphAssumeBufferOutlivesGraph
@ GraphAssumeBufferOutlivesGraph
Definition: property_helper.hpp:48