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
#include <
sycl/detail/common.hpp
>
12
13
namespace
sycl
{
14
__SYCL_INLINE_VER_NAMESPACE
(_V1) {
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
26
enum
DataLessPropKind
{
27
BufferUseHostPtr
= 0,
28
ImageUseHostPtr
= 1,
29
QueueEnableProfiling
= 2,
30
InOrder
= 3,
31
NoInit
= 4,
32
BufferUsePinnedHostMemory
= 5,
33
UsePrimaryContext
= 6,
34
InitializeToIdentity
= 7,
35
UseDefaultStream
= 8,
36
DiscardEvents
= 9,
37
DeviceReadOnly
= 10,
38
FusionPromotePrivate
= 11,
39
FusionPromoteLocal
= 12,
40
FusionNoBarrier
= 13,
41
FusionEnable
= 14,
42
FusionForce
= 15,
43
QueuePriorityNormal
= 16,
44
QueuePriorityLow
= 17,
45
QueuePriorityHigh
= 18,
46
// Indicates the last known dataless property.
47
LastKnownDataLessPropKind
= 18,
48
// Exceeding 32 may cause ABI breaking change on some of OSes.
49
DataLessPropKindSize
= 32
50
};
51
52
// List of all properties with data IDs
53
enum
PropWithDataKind
{
54
BufferUseMutex
= 0,
55
BufferContextBound
= 1,
56
ImageUseMutex
= 2,
57
ImageContextBound
= 3,
58
BufferMemChannel
= 4,
59
AccPropBufferLocation
= 5,
60
QueueComputeIndex
= 6,
61
PropWithDataKindSize
= 7,
62
};
63
64
// Base class for dataless properties, needed to check that the type of an
65
// object passed to the property_list is a property.
66
class
DataLessPropertyBase
{};
67
68
// Helper class for the dataless properties. Every such property is supposed
69
// to inherit from it. The ID template parameter should be one from
70
// DataLessPropKind.
71
template
<
int
ID>
class
DataLessProperty
:
DataLessPropertyBase
{
72
public
:
73
static
constexpr
int
getKind
() {
return
ID; }
74
};
75
76
// Base class for properties with data, needed to check that the type of an
77
// object passed to the property_list is a property and for checking if two
78
// properties with data are of the same type.
79
class
PropertyWithDataBase
{
80
public
:
81
PropertyWithDataBase
(
int
ID) : MID(ID) {}
82
bool
isSame
(
int
ID)
const
{
return
ID == MID; }
83
virtual
~
PropertyWithDataBase
() =
default
;
84
85
private
:
86
int
MID = -1;
87
};
88
89
// Helper class for the properties with data. Every such property is supposed
90
// to inherit from it. The ID template parameter should be one from
91
// PropWithDataKind.
92
template
<
int
ID>
class
PropertyWithData
:
public
PropertyWithDataBase
{
93
public
:
94
PropertyWithData
() :
PropertyWithDataBase
(ID) {}
95
static
int
getKind
() {
return
ID; }
96
};
97
98
}
// namespace detail
99
100
}
// __SYCL_INLINE_VER_NAMESPACE(_V1)
101
}
// namespace sycl
sycl::_V1::detail::AccPropBufferLocation
@ AccPropBufferLocation
Definition:
property_helper.hpp:59
sycl::_V1::detail::FusionPromoteLocal
@ FusionPromoteLocal
Definition:
property_helper.hpp:39
sycl::_V1::detail::BufferContextBound
@ BufferContextBound
Definition:
property_helper.hpp:55
sycl::_V1::detail::DataLessProperty
Definition:
property_helper.hpp:71
sycl::_V1::detail::BufferMemChannel
@ BufferMemChannel
Definition:
property_helper.hpp:58
sycl::_V1::detail::LastKnownDataLessPropKind
@ LastKnownDataLessPropKind
Definition:
property_helper.hpp:47
sycl::_V1::detail::DataLessProperty::getKind
static constexpr int getKind()
Definition:
property_helper.hpp:73
sycl::_V1::detail::QueuePriorityHigh
@ QueuePriorityHigh
Definition:
property_helper.hpp:45
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition:
defines_elementary.hpp:11
sycl::_V1::detail::ImageUseHostPtr
@ ImageUseHostPtr
Definition:
property_helper.hpp:28
sycl::_V1::detail::DeviceReadOnly
@ DeviceReadOnly
Definition:
property_helper.hpp:37
sycl::_V1::detail::InOrder
@ InOrder
Definition:
property_helper.hpp:30
sycl::_V1::detail::FusionNoBarrier
@ FusionNoBarrier
Definition:
property_helper.hpp:40
sycl::_V1::detail::PropertyWithDataBase::PropertyWithDataBase
PropertyWithDataBase(int ID)
Definition:
property_helper.hpp:81
sycl::_V1::detail::PropWithDataKind
PropWithDataKind
Definition:
property_helper.hpp:53
sycl::_V1::detail::DiscardEvents
@ DiscardEvents
Definition:
property_helper.hpp:36
sycl::_V1::detail::QueuePriorityLow
@ QueuePriorityLow
Definition:
property_helper.hpp:44
sycl::_V1::detail::DataLessPropKindSize
@ DataLessPropKindSize
Definition:
property_helper.hpp:49
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition:
access.hpp:14
sycl::_V1::detail::ImageUseMutex
@ ImageUseMutex
Definition:
property_helper.hpp:56
sycl::_V1::detail::PropertyWithData::getKind
static int getKind()
Definition:
property_helper.hpp:95
sycl::_V1::detail::UsePrimaryContext
@ UsePrimaryContext
Definition:
property_helper.hpp:33
sycl::_V1::detail::FusionPromotePrivate
@ FusionPromotePrivate
Definition:
property_helper.hpp:38
sycl::_V1::detail::PropertyWithData
Definition:
property_helper.hpp:92
sycl::_V1::detail::DataLessPropertyBase
Definition:
property_helper.hpp:66
sycl::_V1::detail::QueueComputeIndex
@ QueueComputeIndex
Definition:
property_helper.hpp:60
sycl::_V1::detail::ImageContextBound
@ ImageContextBound
Definition:
property_helper.hpp:57
sycl::_V1::detail::BufferUseHostPtr
@ BufferUseHostPtr
Definition:
property_helper.hpp:27
sycl::_V1::detail::QueueEnableProfiling
@ QueueEnableProfiling
Definition:
property_helper.hpp:29
common.hpp
sycl::_V1::detail::PropertyWithDataBase
Definition:
property_helper.hpp:79
sycl::_V1::detail::BufferUseMutex
@ BufferUseMutex
Definition:
property_helper.hpp:54
sycl::_V1::detail::PropertyWithDataBase::isSame
bool isSame(int ID) const
Definition:
property_helper.hpp:82
sycl::_V1::detail::QueuePriorityNormal
@ QueuePriorityNormal
Definition:
property_helper.hpp:43
sycl::_V1::detail::BufferUsePinnedHostMemory
@ BufferUsePinnedHostMemory
Definition:
property_helper.hpp:32
sycl::_V1::detail::DataLessPropKind
DataLessPropKind
Definition:
property_helper.hpp:26
sycl::_V1::detail::FusionEnable
@ FusionEnable
Definition:
property_helper.hpp:41
sycl::_V1::detail::FusionForce
@ FusionForce
Definition:
property_helper.hpp:42
sycl::_V1::detail::PropertyWithData::PropertyWithData
PropertyWithData()
Definition:
property_helper.hpp:94
sycl::_V1::detail::NoInit
@ NoInit
Definition:
property_helper.hpp:31
sycl::_V1::detail::PropWithDataKindSize
@ PropWithDataKindSize
Definition:
property_helper.hpp:61
sycl::_V1::detail::UseDefaultStream
@ UseDefaultStream
Definition:
property_helper.hpp:35
sycl::_V1::detail::InitializeToIdentity
@ InitializeToIdentity
Definition:
property_helper.hpp:34
include
sycl
detail
property_helper.hpp
Generated by
1.8.17