13
13
#include < CL/sycl/detail/export.hpp>
14
14
#include < CL/sycl/exception_list.hpp>
15
15
#include < CL/sycl/info/info_desc.hpp>
16
+ #include < CL/sycl/property_list.hpp>
16
17
#include < CL/sycl/stl.hpp>
17
18
18
19
#include < type_traits>
@@ -33,46 +34,94 @@ class context_impl;
33
34
// / \ingroup sycl_api
34
35
class __SYCL_EXPORT context {
35
36
public:
37
+ // / Constructs a SYCL context instance using an instance of default_selector.
38
+ // /
39
+ // / The instance of default_selector is used to select the associated platform
40
+ // / and device(s).
41
+ // / SYCL properties are passed to the constructed SYCL context through
42
+ // / PropList.
43
+ // /
44
+ // / \param PropList is an instance of property_list.
45
+ explicit context (const property_list &PropList = {});
46
+
36
47
// / Constructs a SYCL context instance using an instance of default_selector.
37
48
// /
38
49
// / The instance of default_selector is used to select the associated platform
39
50
// / and device(s).
40
51
// / The constructed SYCL context will use the AsyncHandler parameter to handle
41
52
// / exceptions.
53
+ // / SYCL properties are passed to the constructed SYCL context through
54
+ // / PropList.
42
55
// /
43
56
// / \param AsyncHandler is an instance of async_handler.
44
- // / \param UseCUDAPrimaryContext is a bool determining whether to use the
45
- // / primary context in the CUDA backend.
46
- explicit context (const async_handler &AsyncHandler = {},
47
- bool UseCUDAPrimaryContext = false );
57
+ // / \param PropList is an instance of property_list.
58
+ explicit context (const async_handler &AsyncHandler,
59
+ const property_list &PropList = {});
60
+
61
+ // / Constructs a SYCL context instance using the provided device.
62
+ // /
63
+ // / Newly created context is associated with the Device and the SYCL platform
64
+ // / that is associated with the Device.
65
+ // / SYCL properties are passed to the constructed SYCL context through
66
+ // / PropList.
67
+ // /
68
+ // / \param Device is an instance of SYCL device.
69
+ // / \param PropList is an instance of property_list.
70
+ explicit context (const device &Device, const property_list &PropList = {});
48
71
49
72
// / Constructs a SYCL context instance using the provided device.
50
73
// /
51
74
// / Newly created context is associated with the Device and the SYCL platform
52
75
// / that is associated with the Device.
53
76
// / The constructed SYCL context will use the AsyncHandler parameter to handle
54
77
// / exceptions.
78
+ // / SYCL properties are passed to the constructed SYCL context through
79
+ // / PropList.
55
80
// /
56
81
// / \param Device is an instance of SYCL device.
57
82
// / \param AsyncHandler is an instance of async_handler.
58
- // / \param UseCUDAPrimaryContext is a bool determining whether to use the
59
- // / primary context in the CUDA backend.
60
- explicit context (const device &Device, async_handler AsyncHandler = {},
61
- bool UseCUDAPrimaryContext = false );
83
+ // / \param PropList is an instance of property_list.
84
+ explicit context (const device &Device, async_handler AsyncHandler,
85
+ const property_list &PropList = {});
86
+
87
+ // / Constructs a SYCL context instance using the provided platform.
88
+ // /
89
+ // / Newly created context is associated with the Platform and with each
90
+ // / SYCL device that is associated with the Platform.
91
+ // / SYCL properties are passed to the constructed SYCL context through
92
+ // / PropList.
93
+ // /
94
+ // / \param Platform is an instance of SYCL platform.
95
+ // / \param PropList is an instance of property_list.
96
+ explicit context (const platform &Platform,
97
+ const property_list &PropList = {});
62
98
63
99
// / Constructs a SYCL context instance using the provided platform.
64
100
// /
65
101
// / Newly created context is associated with the Platform and with each
66
102
// / SYCL device that is associated with the Platform.
67
103
// / The constructed SYCL context will use the AsyncHandler parameter to handle
68
104
// / exceptions.
105
+ // / SYCL properties are passed to the constructed SYCL context through
106
+ // / PropList.
69
107
// /
70
108
// / \param Platform is an instance of SYCL platform.
71
- // / \param AsyncHandler is an instance of async_handler.
72
- // / \param UseCUDAPrimaryContext is a bool determining whether to use the
73
- // / primary context in the CUDA backend.
74
- explicit context (const platform &Platform, async_handler AsyncHandler = {},
75
- bool UseCUDAPrimaryContext = false );
109
+ // / \param PropList is an instance of property_list.
110
+ explicit context (const platform &Platform, async_handler AsyncHandler,
111
+ const property_list &PropList = {});
112
+
113
+ // / Constructs a SYCL context instance using list of devices.
114
+ // /
115
+ // / Newly created context will be associated with each SYCL device in the
116
+ // / DeviceList. This requires that all SYCL devices in the list have the same
117
+ // / associated SYCL platform.
118
+ // / SYCL properties are passed to the constructed SYCL context through
119
+ // / PropList.
120
+ // /
121
+ // / \param DeviceList is a list of SYCL device instances.
122
+ // / \param PropList is an instance of property_list.
123
+ explicit context (const vector_class<device> &DeviceList,
124
+ const property_list &PropList = {});
76
125
77
126
// / Constructs a SYCL context instance using list of devices.
78
127
// /
@@ -81,14 +130,15 @@ class __SYCL_EXPORT context {
81
130
// / associated SYCL platform.
82
131
// / The constructed SYCL context will use the AsyncHandler parameter to handle
83
132
// / exceptions.
133
+ // / SYCL properties are passed to the constructed SYCL context through
134
+ // / PropList.
84
135
// /
85
136
// / \param DeviceList is a list of SYCL device instances.
86
137
// / \param AsyncHandler is an instance of async_handler.
87
- // / \param UseCUDAPrimaryContext is a bool determining whether to use the
88
- // / primary context in the CUDA backend.
138
+ // / \param PropList is an instance of property_list.
89
139
explicit context (const vector_class<device> &DeviceList,
90
- async_handler AsyncHandler = {} ,
91
- bool UseCUDAPrimaryContext = false );
140
+ async_handler AsyncHandler,
141
+ const property_list &PropList = {} );
92
142
93
143
// / Constructs a SYCL context instance from OpenCL cl_context.
94
144
// /
@@ -119,6 +169,19 @@ class __SYCL_EXPORT context {
119
169
120
170
bool operator !=(const context &rhs) const { return !(*this == rhs); }
121
171
172
+ // / Checks if this context has a property of type propertyT.
173
+ // /
174
+ // / \return true if this context has a property of type propertyT.
175
+ template <typename propertyT> bool has_property () const ;
176
+
177
+ // / Gets the specified property of this context.
178
+ // /
179
+ // / Throws invalid_object_error if this context does not have a property
180
+ // / of type propertyT.
181
+ // /
182
+ // / \return a copy of the property of type propertyT.
183
+ template <typename propertyT> propertyT get_property () const ;
184
+
122
185
// / Gets OpenCL interoperability context.
123
186
// /
124
187
// / The OpenCL cl_context handle is retained on return.
0 commit comments